

Optionally you can pass the source language as well.

DocumentStatus status = await anslateDocument( As well as with the text translation a target language is required. The document translation method internally uploads given input file, waits for the translation to finish and downloads the file into the given output file. At the moment of writing the following file types are supported: TextResult result = await anslateTextSingular(ĭeepL also supports the translation of documents. You can pass a TranslateTextOptions object to configure the translation. List targetLangs = await translator.getTargetLanguages() List sourceLangs = await translator.getSourceLanguages() If you unsure which languages are supported you can request them.

translateTextSingular('Hello World', 'de', sourceLang: 'en') DeepL detects the source language automatically. The basic text translation takes one or more texts and a target language to return the translated text. In production code, the authentication key should not be hard-coded, but instead fetched from a configuration file or environment variable.Īdd further arguments to the constructor: Translator translator = Translator( This example is for demonstration purposes only. Pass it via Translator constructor: Translator translator = Translator(authKey: '') A auth_key from DeepL is required to send requests. Translator translator = Translator(authKey: '') Īwait anslateTextSingular('Hello World', 'de') Īwait anslateTextList(, 'de') Īll requests to the DeepL API go via a Translator object.
DEEPL TRANSLATOR PLUGIN PRO
The required argument authKey is a string containing your API authentication key as found in your DeepL Pro Account.īe careful not to expose your key, for example when sharing source code.Īn example using async/await: import 'package:deepl_dart/deepl_dart.dart' Import the package and construct a Translator. In the dependencies: section of your pubspec.yaml, add the following line: dependencies: You can translate up to 500,000characters/month for free. To get a key, please create an account here. To use the package, you'll need an API authentication key. We intend to support all API functions with the library, though support for new features may be added to the library after they’re added to the API. The DeepL library offers a convenient way for applications written for to interact with the DeepL API. This opens a whole universe of opportunities for developers: any translation product you can imagine can now be built on top of DeepL's best-in-class translation technology. The DeepL API is a language translation API that allows other computer programs to send texts and documents to DeepL's servers and receive high-quality translations. This package is heavily inspired by the official Node.js Client Library for the DeepL API: Issues here are answered by maintainers and other community members on GitHub on a best-effort basis. This package is maintained by volunteers but is not a supported DeepL product and not maintained by DeepL SE.
