MCPcopy Create free account
hub / github.com/DeepL/deepl-python / get_target_languages

Method get_target_languages

deepl/translator.py:989–1010  ·  view source on GitHub ↗

Request the list of available target languages. :param skip_cache: Deprecated, and now has no effect as the corresponding internal functionality has been removed. This parameter will be removed in a future version. :return: List of supported target languages.

(self, skip_cache: bool = False)

Source from the content-addressed store, hash-verified

987 ]
988
989 def get_target_languages(self, skip_cache: bool = False) -> List[Language]:
990 """Request the list of available target languages.
991
992 :param skip_cache: Deprecated, and now has no effect as the
993 corresponding internal functionality has been removed. This
994 parameter will be removed in a future version.
995 :return: List of supported target languages.
996 """
997 data = {"type": "target"}
998 status, content, json = self._api_call(
999 "v2/languages", method="GET", data=data
1000 )
1001 self._raise_for_status(status, content, json)
1002 languages = json if (json and isinstance(json, list)) else []
1003 return [
1004 Language(
1005 language["language"],
1006 language["name"],
1007 language.get("supports_formality", None),
1008 )
1009 for language in languages
1010 ]
1011
1012 def get_glossary_languages(self) -> List[GlossaryLanguagePair]:
1013 """Request the list of language pairs supported for glossaries."""

Callers 3

action_languagesFunction · 0.80
test_target_langFunction · 0.80
test_languageFunction · 0.80

Calls 3

_api_callMethod · 0.95
_raise_for_statusMethod · 0.95
LanguageClass · 0.90

Tested by 2

test_target_langFunction · 0.64
test_languageFunction · 0.64