Please send pull requests, very much appreciated. To use DeepL’s pro API, pass an additional parameter called pro to the Translator object and set it to True and use your pro authentication key as the secret_access_key In : translator = Translator ( provider = 'microsoft', to_lang = to_lang, secret_access_key = secret, pro = True ) DocumentationĬheck out the latest translate documentation at Read the Docs Contributing translate ( 'the book is on the table' ) Out : '碗是在桌子上。' The DeepL Provider Use a different translation provider In : from translate import Translator In : to_lang = 'zh' In : secret = '' In : translator = Translator ( provider = '', to_lang = to_lang, secret_access_key = secret ) In : translator. translate ( "This is a pen." ) Out : 这是一支笔 Or run the command line and follow the steps: $ translate-cli -generate-config-file Translate from : Translate to: Provider : Secret Access Key : Use As A Python Module In : from translate import Translator In : translator = Translator ( to_lang = "zh" ) In : translation = translator. The cfg is not for use as a Python module. In ~/.python-translate.cfg: from_lang = autodetect to_lang = de provider = mymemory secret_access_key = o, -output_only Set to display the translation only. secret_access_key TEXT Set the secret access key used to get provider oAuth token. p, -provider TEXT Set the provider you want to use. t, -to TEXT Set the language you want to translate. f, -from TEXT Sets the language of the text being translated. generate-config-file Generate the config file using a Wizard and exit. ) Options: -version Show the version and exit. Python command line tool to make online translations Example: $ translate-cli -t zh the book is on the table 碗是在桌子上。 Available languages: Examples: (e.g. Or $ translate-cli -t zh "This is a pen." -o 这是一支笔 Options $ translate-cli -help Usage: _main_.py TEXT. In your command-line: $ translate-cli -t zh "This is a pen." Translation: 这是一支笔 - Translated by: MyMemory Featuresĭo translation in your terminal using the command line Prefix ‘sudo’ if you encounter a problem. Or, you can download the source and $ python setup.py install The biggest reason to use translate is to make translations in a simple way without the need of biggerĮffort and can be used as a translation tool like command line Installation $ pip install translate Translated MyMemory API, LibreTranslate, and DeepL’s free and pro APIs Why Should I Use This? By now we offer integration with Microsoft Translation API, Translate is a simple but powerful translation tool written in python with with support for
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |