Package: translators
Translatorsis a library that aims to bringfree, multiple, enjoyabletranslations to individuals and students in Python.Supported Translation ServicesInstallationGetting StartedSupported LanguagesDebug TipsStar HistorySupported Translation ServicesIDTranslatorNumber of Supported LanguagesAdvantageServiceStatus1Niutrans452support the most languages in the worldNortheastern University/Niutrans, China/2MyMemory330support the most languages in the worldTranslated, Italystable3Alibaba221support most languages, support professional fieldAlibaba, Chinastable4Baidu201support most languages, support professional field, support classical ChineseBaidu, Chinastable5ModernMt200open-source, support more languages in the worldModernmt/Translated, Italystable6VolcEngine189support more languages in the world, support professional fieldByteDance, China/7Iciba187support the most languages in the worldKingsoft/Xiaomi, Chinastable8Iflytek137support the most languages in the worldIflytek, China/9Google134support more languages in the worldGoogle, Americastable(offline in China inland)10Bing128support more languages in the worldMicrosoft, Americastable11Lingvanex112support translation of different regions but the same languageLingvanex, Cyprusstable12Yandex102support more languages in the world, support word to emojiYandex, Russia/13Itranslate101support translation of different regions but the same language, such as en-US, en-UK, en-AUItranslate, Austriastable14SysTran52support more languages in the worldSysTran, Francestable15Argos46open-sourceArgos/Libre, Americastable16Apertium45open-sourceApertium, Spainstable17Reverso42popular on Mac and IphoneReverso, Francestable18Deepl30high quality to translate but response slowlyDeepl, Germanystable19CloudTranslation28support main languagesXiamen University/CloudTranslation, Chinastable20QQTranSmart22support main languagesTencent, Chinastable21TranslateCom21good at English translationTranslateCom, Americastable22Sogou20support more languages in the worldTencent, Chinastable23Tilde20good at lv, de, fr translationTilde, Latvia/24QQFanyi17support main languagesTencent, Chinastable25TranslateMe16good at English translationTranslateMe/Neosus, Lithuania/26Papago15good at Korean translationNaver, South Koreastable27Mirai15good at Japanese translationMiraiTranslate, Japan/28Youdao12support main languages, high qualityNetease, Chinastable29Iflyrec12good at Chinese translationIflytek, Chinastable30Hujiang12supported by baiduHujiang, Chinastable31Yeekit10support main languagesCTC, China/32LanguageWire8good at English translationLanguageWire, Denmarkstable33Caiyun7high quality to translate but response slowly, support professional fieldColorfulClouds, Chinastable34Elia6good at Basque translationElhuyar, Spainstable35Judic4good at European translationCrossLang, Belgium/36Mglip3good at Mongolia translationInner Mongolia University, Chinastable37Utibet2good at Tibet translationTibet University, ChinastableInstallation# PYPIpipinstall--upgradetranslators# Condacondainstallconda-forge::translators# Sourcegitclonehttps://github.com/UlionTse/translators.gitcdtranslators
pythonsetup.pyinstallGetting Startedimporttranslatorsastsq_text='季姬寂，集鸡，鸡即棘鸡。棘鸡饥叽，季姬及箕稷济鸡。'q_html='''<!DOCTYPE html><html><head><title>《季姬击鸡记》</title></head><body><p>还有另一篇文章《施氏食狮史》。</p></body></html>'''### usage_=ts.preaccelerate_and_speedtest()# Optional. Caching sessions in advance, which can help improve access speed.print(ts.translators_pool)print(ts.translate_text(q_text))print(ts.translate_html(q_html,translator='alibaba'))### parametershelp(ts.translate_text)"""translate_text(query_text: str, translator: str = 'bing', from_language: str = 'auto', to_language: str = 'en', **kwargs) -> Union[str, dict]:param query_text: str, must.:param translator: str, default 'bing'.:param from_language: str, default 'auto'.:param to_language: str, default 'en'.:param if_use_preacceleration: bool, default False.:param **kwargs::param is_detail_result: bool, default False.:param professional_field: str, default None. Support alibaba(), baidu(), caiyun(), cloudTranslation(), elia(), sysTran(), youdao(), volcEngine() only.:param timeout: float, default None.:param proxies: dict, default None.:param sleep_seconds: float, default 0.:param update_session_after_freq: int, default 1000.:param update_session_after_seconds: float, default 1500.:param if_use_cn_host: bool, default False. Support google(), bing() only.:param reset_host_url: str, default None. Support google(), yandex() only.:param if_check_reset_host_url: bool, default True. Support google(), yandex() only.:param if_ignore_empty_query: bool, default False.:param limit_of_length: int, default 20000.:param if_ignore_limit_of_length: bool, default False.:param if_show_time_stat: bool, default False.:param show_time_stat_precision: int, default 2.:param if_print_warning: bool, default True.:param lingvanex_mode: str, default 'B2C', choose from ("B2C", "B2B").:param myMemory_mode: str, default "web", choose from ("web", "api").:return: str or dict"""Supported LanguagesLanguageLanguage of TranslatorGoogleYandexBingBaiduAlibabaTencentYoudaoSogouDeeplCaiyunArgosothers...englishenYYYYYYYYYYY...chinesezhYYYYYYYYYYYarabicarYYYY(ara)YYYYYrussianruYYYYYYYYYYYfrenchfrYYYY(fra)YYYYYYYgermandeYYYYYYYYYspanishesYYYY(spa)YYYYYYYportugueseptYYY(pt/pt-pt)YYYYYYYitalianitYYYYYYYYYYjapanesejaYYYY(jp)YYYYYYkoreankoYYYY(kor)YYYYgreekelYYYYYYdutchnlYYYYYYYhindihiYYYYYYturkishtrYYYYYYYmalaymsYYYYYthaithYYYYYYYvietnameseviYYYY(vie)YYYYYindonesianidYYYYYYYYhebrewheY(iw)YYYpolishplYYYYYYYmongolianmnYYczechcsYYYYYYhungarianhuYYYYYYestonianetYYYY(est)YYbulgarianbgYYYY(bul)YYdanishdaYYYY(dan)YYfinnishfiYYYY(fin)YYromanianroYYYY(rom)YYswedishsvYYYY(swe)YYslovenianslYYYY(slo)YYpersian/farsifaYYYYbosnianbsYYY(bs-Latn)Y(bs-Latn)serbiansrYYY(sr-Latn/sr-Cyrl)Y(sr-Latn/sr-Cyrl)fijianfjYYfilipinotlYYY(fil)Y(fil)haitiancreolehtYYYYcatalancaYYYYcroatianhrYYYYlatvianlvYYYYYlithuanianltYYYYYurduurYYYYukrainianukYYYYwelshcyYYYYtahitityYYtongantoYYswahiliswYYYYsamoansmYYYslovakskYYYYYafrikaansafYYYYnorwegiannoYYYYbengalibnYYY(bn-BD)YmalagasymgYYYYmaltesemtYYYYqueretaro otomiotqYYklingon/tlhingan holtlhYYgujaratiguYYYtamiltaYYYteluguteYYYpunjabipaYYYamharicamYYazerbaijaniazYYbashkirbaYbelarusianbeYYcebuanocebYYchuvashcvYesperantoeoYYbasqueeuYYirishgaYYYemojiemjY......About Chinese LanguageLanguageLanguage of TranslatorGoogleYandexBingBaiduAlibabaTencentYoudaoSogouIcibaIflytekCaiyunDeeplArgosItranslateReversoTranslateComPapagoUtibetChinese(简体)zh-CHSY(zh-CN)Y(zh)Y(zh-Hans)Y(zh)Y(zh)Y(zh)YYY(zh)Y(zh)Y(zh)Y(zh)Y(zh)Y(zh-CN)Y(zh/chi)...Y(zh-CN)Y(zh)Chinese(繁体)zh-CHTY(zh-TW)Y(zh-Hant)Y(cht)Y(zh-TW)YY(cnt)Y(zh-TW)Y(zh-TW)Chinese(文言文)wywYChinese(粤语)yueYYYYYY(zh-HK)Chinese(内蒙语)mnN[外蒙]N[外蒙]Y[内蒙]N[外蒙]Chinese(维吾尔语)uyYChinese(藏语)tiYYChinese(白苗文)mwwYYYChinese(彝语)iiYChinese(苗语)hmnYChinese(壮语)zybDebug TipsLinux Runtime EnvironmentTo support javascript runtime environment, you shoulddownload and install Node.js.Function baidu() doesn't work on Linux without desktop.HttpError 4xxCheck whether you made high frequency requests, especially httperror 429.Check whether this service is provided in your region.Detail to solveHttpErroritself.Issue me, thanks.NetworkError or ProxyErrorCheck whether the network is connected correctly.Check the proxy are enabled on your computer. If it is enabled, try turning it off or otherwise.Star History