Unit OlfSoftware.DeepL.ClientLib
Description
***************************************************************************
DeepL API client library for Delphi
Copyright 2020-2024 Patrick Prémartin under AGPL 3.0 license.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************
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 : 04/08/2024 07:56:16 Signature : dc624178028740235135fa88f275713da3713fcb ***************************************************************************
Overview
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; |
procedure DeepLTranslateTextASync(auth_key, source_lang, target_lang, text: string; onTexTranslatedProc: TOnTextTranslatedProc; onTexTranslatedErrorProc: TOnTextTranslatedErrorProc = nil; split_sentences: string = '1'; preserve_formatting: string = '0'; formality: string = 'default'); overload; |
procedure DeepLTranslateTextASync(auth_key, source_lang, target_lang, text: string; onTexTranslatedEvent: TOnTextTranslatedEvent; onTexTranslatedErrorEvent: TOnTextTranslatedErrorEvent = nil; split_sentences: string = '1'; preserve_formatting: string = '0'; formality: string = 'default'); overload; |
procedure DeepLSetAPIURL(APIURL: string = CDeepLAPIURL_Free); |
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 = 'https://api-free.deepl.com'; |
CDeepLAPIURL_Pro = 'https://api.deepl.com'; |
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; |
call DeepL API to translate the text from source_lang to target_lang (synchrone - current thread is freezed during process)
look at https://www.deepl.com/docs-api/translating-text/response/ |
procedure DeepLTranslateTextASync(auth_key, source_lang, target_lang, text: string; onTexTranslatedProc: TOnTextTranslatedProc; onTexTranslatedErrorProc: TOnTextTranslatedErrorProc = nil; split_sentences: string = '1'; preserve_formatting: string = '0'; formality: string = 'default'); overload; |
call DeepL API to translate the text from source_lang to target_lang (asynchrone - don't freeze current thread)
look at https://www.deepl.com/docs-api/translating-text/response/ |
procedure DeepLTranslateTextASync(auth_key, source_lang, target_lang, text: string; onTexTranslatedEvent: TOnTextTranslatedEvent; onTexTranslatedErrorEvent: TOnTextTranslatedErrorEvent = nil; split_sentences: string = '1'; preserve_formatting: string = '0'; formality: string = 'default'); overload; |
call DeepL API to translate the text from source_lang to target_lang (asynchrone - don't freeze current thread)
look at https://www.deepl.com/docs-api/translating-text/response/ |
procedure DeepLSetAPIURL(APIURL: string = CDeepLAPIURL_Free); |
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 = 'https://api-free.deepl.com'; |
CDeepLAPIURL_Pro = 'https://api.deepl.com'; |
Generated by PasDoc 0.16.0.