text package

translate module

multimodaltranslation.text.translate.translate_text(text: str, lang: str, targets: list[str]) list[dict[str, str]]

Translates the text provided into the desired languages (targets).

Parameters:
  • text (-) – The text you want to translate.

  • lang (-) – The original language of the text.

  • targets (-) – List of languages you want to translate to.

Returns:

List of translated texts with their target languages.

In case the language is not found , it will return empty text

Return type:

list