Unit OlfSoftware.DeepL.ClientLib

Description

C2PP ***************************************************************************

DeepL API client library for Delphi Copyright (c) 2020-2026 Patrick PREMARTIN

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

***************************************************************************

DeepL is an online text and document translation tool, also available as software and APIs.

This project is a client library in Pascal for Delphi to use the main translation API. Examples of use are also proposed.

To use the API of DeepL you must have a free or paid account.

***************************************************************************

Author(s) : Patrick PREMARTIN

Site : https://deepl4delphi.developpeur-pascal.fr

Project site : https://github.com/DeveloppeurPascal/DeepL4Delphi

*************************************************************************** File last update : 2026-02-24T19:48:54.000+01:00 Signature : ce96e802a04e4aaeae5330c5564da79f6ee6b588 ***************************************************************************

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class TDeepLAPI  

Functions and Procedures

function DeepLTranslateTextSync(auth_key, source_lang, target_lang, text: string; split_sentences: string = '1'; preserve_formatting: string = '0'; formality: string = 'default'): string; deprecated 'use TDeepLAPI.TranslateTextSync';
procedure DeepLTranslateTextASync(auth_key, source_lang, target_lang, text: string; onTextTranslatedProc: TOnTextTranslatedProc; onTextTranslatedErrorProc: TOnTextTranslatedErrorProc = nil; split_sentences: string = '1'; preserve_formatting: string = '0'; formality: string = 'default'); overload; deprecated 'use TDeepLAPI.TranslateTextASync';
procedure DeepLTranslateTextASync(auth_key, source_lang, target_lang, text: string; onTextTranslatedEvent: TOnTextTranslatedEvent; onTextTranslatedErrorEvent: TOnTextTranslatedErrorEvent = nil; split_sentences: string = '1'; preserve_formatting: string = '0'; formality: string = 'default'); overload; deprecated 'use TDeepLAPI.TranslateTextASync';
procedure DeepLSetAPIURL(APIURL: string = TDeepLAPI.ServerURLFree); deprecated 'use TDeepLAPI.Init';

Types

TOnTextTranslatedProc = reference to procedure(OriginalText, TranslatedText, SourceLang, TargetLang: string);
TOnTextTranslatedErrorProc = reference to procedure(OriginalText, SourceLang, TargetLang, ErrorText: string);
TOnTextTranslatedEvent = procedure(OriginalText, TranslatedText, SourceLang, TargetLang: string) of object;
TOnTextTranslatedErrorEvent = procedure(OriginalText, SourceLang, TargetLang, ErrorText: string) of object;

Constants

CDeepLAPIURL_Free = TDeepLAPI.ServerURLFree deprecated 'use TDeepLAPI.ServerURLFree';
CDeepLAPIURL_Pro = TDeepLAPI.ServerURLPro deprecated 'use TDeepLAPI.ServerURLPro';

Description

Functions and Procedures

function DeepLTranslateTextSync(auth_key, source_lang, target_lang, text: string; split_sentences: string = '1'; preserve_formatting: string = '0'; formality: string = 'default'): string; deprecated 'use TDeepLAPI.TranslateTextSync';

Warning: this symbol is deprecated: use TDeepLAPI.TranslateTextSync

call DeepL API to translate the text from source_lang to target_lang (synchrone - current thread is freezed during process)

look at https://developers.deepl.com/api-reference/translate

procedure DeepLTranslateTextASync(auth_key, source_lang, target_lang, text: string; onTextTranslatedProc: TOnTextTranslatedProc; onTextTranslatedErrorProc: TOnTextTranslatedErrorProc = nil; split_sentences: string = '1'; preserve_formatting: string = '0'; formality: string = 'default'); overload; deprecated 'use TDeepLAPI.TranslateTextASync';

Warning: this symbol is deprecated: use TDeepLAPI.TranslateTextASync

call DeepL API to translate the text from source_lang to target_lang (asynchrone - don't freeze current thread)

look at https://developers.deepl.com/api-reference/translate

procedure DeepLTranslateTextASync(auth_key, source_lang, target_lang, text: string; onTextTranslatedEvent: TOnTextTranslatedEvent; onTextTranslatedErrorEvent: TOnTextTranslatedErrorEvent = nil; split_sentences: string = '1'; preserve_formatting: string = '0'; formality: string = 'default'); overload; deprecated 'use TDeepLAPI.TranslateTextASync';

Warning: this symbol is deprecated: use TDeepLAPI.TranslateTextASync

call DeepL API to translate the text from source_lang to target_lang (asynchrone - don't freeze current thread)

look at https://developers.deepl.com/api-reference/translate

procedure DeepLSetAPIURL(APIURL: string = TDeepLAPI.ServerURLFree); deprecated 'use TDeepLAPI.Init';

Warning: this symbol is deprecated: use TDeepLAPI.Init

Call to initialize DeepL API URL. If you forget to do, you will be on Free API.

Types

TOnTextTranslatedProc = reference to procedure(OriginalText, TranslatedText, SourceLang, TargetLang: string);

Callback procedure when translation is ok

TOnTextTranslatedErrorProc = reference to procedure(OriginalText, SourceLang, TargetLang, ErrorText: string);

Callback procedure when translation has an error

TOnTextTranslatedEvent = procedure(OriginalText, TranslatedText, SourceLang, TargetLang: string) of object;

Callback method/event when translation is ok

TOnTextTranslatedErrorEvent = procedure(OriginalText, SourceLang, TargetLang, ErrorText: string) of object;

Callback method/event when translation has an error

Constants

CDeepLAPIURL_Free = TDeepLAPI.ServerURLFree deprecated 'use TDeepLAPI.ServerURLFree';

Warning: this symbol is deprecated: use TDeepLAPI.ServerURLFree

 
CDeepLAPIURL_Pro = TDeepLAPI.ServerURLPro deprecated 'use TDeepLAPI.ServerURLPro';

Warning: this symbol is deprecated: use TDeepLAPI.ServerURLPro

 
DeepL API client library for Delphi (c) 2020-2026 Patrick PREMARTIN - Powered by PasDoc
Generated by PasDoc 0.16.0.