Skip to content

Commit

Permalink
Add example with options
Browse files Browse the repository at this point in the history
  • Loading branch information
komape committed Oct 9, 2024
1 parent dd1dbb3 commit b2eadae
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions example/deepl_dart_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@ void main() async {
await translator.translateTextSingular('Hello World', 'de');
print(result);

// Translate single text with options
TextResult resultWithOptions =
await translator.translateTextSingular('Hello World', 'de',
options: TranslateTextOptions(
splitSentences: "0",
preserveFormatting: true,
formality: "more",
glossaryId: "123",
tagHandling: "xml",
outlineDetection: true,
nonSplittingTags: "tag1,tag2",
splittingTags: "tag3,tag4",
ignoreTags: "tag5,tag6",
context: "This is my context.",
));
print(resultWithOptions);

// Translate multiple texts
List<TextResult> results =
await translator.translateTextList(['Hello World', 'Hola Mundo'], 'de');
Expand Down

0 comments on commit b2eadae

Please sign in to comment.