@@ -337,6 +337,7 @@ def translate_text(
337
337
* ,
338
338
source_lang : Union [str , Language , None ] = None ,
339
339
target_lang : Union [str , Language ],
340
+ context : Optional [str ] = None ,
340
341
split_sentences : Union [str , SplitSentences , None ] = None ,
341
342
preserve_formatting : Optional [bool ] = None ,
342
343
formality : Union [str , Formality , None ] = None ,
@@ -357,6 +358,11 @@ def translate_text(
357
358
language. If a glossary is used, source_lang must be specified.
358
359
:param target_lang: language code to translate text into, for example
359
360
"DE", "EN-US", "FR".
361
+ :param context: (Optional) Additional contextual text to influence
362
+ translations, that is not translated itself. Note: this is an alpha
363
+ feature: it may be deprecated at any time, or incur charges if it
364
+ becomes generally available. See the API documentation for more
365
+ information and example usage.
360
366
:param split_sentences: (Optional) Controls how the translation engine
361
367
should split input into sentences before translation, see
362
368
:class:`SplitSentences`.
@@ -406,6 +412,8 @@ def translate_text(
406
412
)
407
413
request_data ["text" ] = text
408
414
415
+ if context is not None :
416
+ request_data ["context" ] = context
409
417
if split_sentences is not None :
410
418
request_data ["split_sentences" ] = str (split_sentences )
411
419
if preserve_formatting is not None :
0 commit comments