MCPcopy Index your code
hub / github.com/PDFMathTranslate/PDFMathTranslate / translate

Method translate

pdf2zh/translator.py:839–854  ·  view source on GitHub ↗
(self, text: str, ignore_cache: bool = False)

Source from the content-addressed store, hash-verified

837 argostranslate.package.install_from_path(download_path)
838
839 def translate(self, text: str, ignore_cache: bool = False):
840 # Translate
841 import argotranslate.translate # noqa: F401
842
843 installed_languages = (
844 argostranslate.translate.get_installed_languages() # noqa: F821
845 )
846 from_lang = list(filter(lambda x: x.code == self.lang_in, installed_languages))[
847 0
848 ]
849 to_lang = list(filter(lambda x: x.code == self.lang_out, installed_languages))[
850 0
851 ]
852 translation = from_lang.get_translation(to_lang)
853 translatedText = translation.translate(text)
854 return translatedText
855
856
857class GrokTranslator(OpenAITranslator):

Callers

nothing calls this directly

Calls 1

translateMethod · 0.45

Tested by

no test coverage detected