

Provide options to the translateText function as an associative array, Translate text into a target language, in this case, French: $translationResult = $translator-> translateText( 'Hello, world!', 'en', 'fr') Įcho $translationResult-> text // 'Bonjour, le monde !' // Translate multiple texts into British English: $translations = $translator-> translateText(Įcho $translations-> text // 'How are you?' echo $translations-> detectedSourceLang // 'ja' echo $translations-> text // 'How are you?' echo $translations-> detectedSourceLang // 'es' // Translate into German with less and more Formality: echo $translator-> translateText( 'How are you?', null, 'de', ) // 'Wie geht es dir?' echo $translator-> translateText( 'How are you?', null, 'de', ) // 'Wie geht es Ihnen?' Text translation options The translated text, and detectedSourceLang is the detected source languageĬode. TranslateText() returns a TextResult, or an array of TextResultsĬorresponding to your input text(s).

Translation options, see Text translation options The last argument to translateText() is optional, and specifies extra Language also accepts null, to enable auto-detection of the source language.
DEEPL TRANSLATOR BEST ISO
Variant according to ISO 3166-1, for example 'en-US', or 'pt-BR'. Some target languages also include the regional Language codes are case-insensitive strings according to ISO 639-1, forĮxample 'de', 'fr', 'ja''. The second and third arguments are the source and target language codes. The first argument is a stringĬontaining the text you want to translate, or an array of strings if you want to Translator accepts options as the second argument, seeĬonfiguration for more information. $result = $translator-> translateText( 'Hello, world!', null, 'fr') Įcho $result-> text // Bonjour, le monde! $authKey = " f63c02c5-f056-." // Replace with your key $translator = new \ DeepL\ Translator( $authKey)
DEEPL TRANSLATOR BEST PRO
The first argument is a string containing yourĪPI authentication key as found in your DeepL Pro Account.īe careful not to expose your key, for example when sharing source code. The library officially supports PHP 7.3 and later.
DEEPL TRANSLATOR BEST INSTALL
To use this library in your project, install it using Composer: composer require deeplcom/deepl-php Requirements You can translate up to 500,000 characters/month for free. To use deepl-php, you'll need an API authentication key. With the library, though support for new features may be added to the libraryĪfter they’re added to the API. The DeepL PHP library offers a convenient way for applications written for This opens a whole universe of opportunities forĭevelopers: any translation product you can imagine can now be built on top ofĭeepL's best-in-class translation technology. The DeepL API is a language translation API that allows otherĬomputer programs to send texts and documents to DeepL's servers and receive Official PHP client library for the DeepL API.
