The translated text, and detectedSourceLang is the detected source language 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. 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)