Translator class
Wrapper for the DeepL API for language translation. Create an instance of Translator to use the DeepL API.
- Annotations
-
- @Deprecated("Use the DeepL class instead. See changelog for detailed guidance. This class will be removed in the next major release.")
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createGlossary(
{required String name, required String sourceLang, required String targetLang, required GlossaryEntries entries}) → Future< GlossaryInfo> - Creates a new glossary on DeepL server with given name, languages, and entries.
-
createGlossaryWithCsvFile(
{required String name, required String sourceLang, required String targetLang, required File csvFile}) → Future< GlossaryInfo> - Creates a new glossary on DeepL server with given name, languages, and CSV data.
-
deleteGlossary(
{String? glossaryId, GlossaryInfo? glossaryInfo}) → Future< void> - Deletes the glossary with the given glossary ID or GlossaryInfo. @param glossary Glossary ID or GlossaryInfo of glossary to be deleted. @return Fulfills with undefined when the glossary is deleted.
-
downloadDocument(
DocumentHandle handle, File outputFile) → Future< void> - Downloads the translated document associated with the given document handle to the specified output file path or stream.handle.
-
getDocumentStatus(
DocumentHandle handle) → Future< DocumentStatus> - Retrieves the status of the document translation associated with the given document handle.
-
getGlossary(
String glossaryId) → Future< GlossaryInfo> - Gets information about an existing glossary.
-
getGlossaryEntries(
{String? glossaryId, GlossaryInfo? glossaryInfo}) → Future< GlossaryEntries> - Retrieves the entries stored with the glossary with the given glossary ID or GlossaryInfo.
-
getGlossaryLanguagePairs(
) → Future< List< GlossaryLanguagePair> > - Queries language pairs supported for glossaries by DeepL API.
-
getSourceLanguages(
) → Future< List< Language> > - Queries source languages supported by DeepL API.
-
getTargetLanguages(
) → Future< List< Language> > - Queries target languages supported by DeepL API.
-
getUsage(
) → Future< Usage> - Queries character and document usage during the current billing period.
-
isDocumentTranslationComplete(
DocumentHandle handle) → Future< DocumentTranslationStatus> - Returns a promise that resolves when the given document translation completes, or rejects if there was an error communicating with the DeepL API or the document translation failed.
-
listGlossaries(
) → Future< List< GlossaryInfo> > - Gets information about all existing glossaries.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
translateDocument(
File inputFile, File outputFile, String targetLang, {String? sourceLang, DocumentTranslateOptions? options}) → Future< DocumentStatus> - Uploads specified document to DeepL to translate into given target language, waits for translation to complete, then downloads translated document to specified output path.
-
translateTextList(
List< String> texts, String targetLang, {String? sourceLang, TranslateTextOptions? options}) → Future<List< TextResult> > - Translates specified array of text strings into the target language.
-
translateTextSingular(
String text, String targetLang, {String? sourceLang, TranslateTextOptions? options}) → Future< TextResult> - Translates specified text string into the target language.
-
uploadDocument(
File inputFile, String targetLang, {String? sourceLang, DocumentTranslateOptions? options}) → Future< DocumentHandle> - Uploads specified document to DeepL to translate into target language, and returns handle associated with the document.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
isFreeAccountAuthKey(
String authKey) → bool - Returns true if the specified DeepL Authentication Key is associated with a free account, otherwise false.