translate-python
Online translation as a Python module & command line tool. No key, no authentication needed.
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 26 committers (3.8%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.3%) to scientific vocabulary
Last synced: 11 months ago
·
JSON representation
Repository
Online translation as a Python module & command line tool. No key, no authentication needed.
Basic Info
Statistics
- Stars: 750
- Watchers: 17
- Forks: 153
- Open Issues: 36
- Releases: 0
Created about 13 years ago
· Last pushed over 2 years ago
Metadata Files
Readme
Changelog
License
README.rst
========================
Translate Tool in Python
========================
|PyPI latest| |PyPI Version| |PyPI License| |Docs| |Travis Build Status|
Translate is a simple but powerful translation tool written in python with with support for
multiple translation providers. By now we offer integration with Microsoft Translation API,
Translated MyMemory API, LibreTranslate, and DeepL's free and pro APIs
Why Should I Use This?
----------------------
The biggest reason to use translate is to make translations in a simple way without the need of bigger
effort and can be used as a translation tool like command line
Installation
------------
.. code-block:: bash
$ pip install translate
Or, you can download the source and
.. code-block:: bash
$ python setup.py install
Prefix 'sudo' if you encounter a problem.
Features
--------
- Translate your output in real time
- Do translation in your terminal using the command line
Usage
-----
In your command-line:
.. code-block:: bash
$ translate-cli -t zh "This is a pen."
Translation: 这是一支笔
-------------------------
Translated by: MyMemory
Or
.. code-block:: bash
$ translate-cli -t zh "This is a pen." -o
这是一支笔
Options
~~~~~~~
.. code-block:: bash
$ translate-cli --help
Usage: __main__.py [OPTIONS] TEXT...
Python command line tool to make online translations
Example:
$ translate-cli -t zh the book is on the table
碗是在桌子上。
Available languages:
https://en.wikipedia.org/wiki/ISO_639-1
Examples: (e.g. en, ja, ko, pt, zh, zh-TW, ...)
Options:
--version Show the version and exit.
--generate-config-file Generate the config file using a Wizard and exit.
-f, --from TEXT Sets the language of the text being translated.
The default value is 'autodetect'.
-t, --to TEXT Set the language you want to translate.
-p, --provider TEXT Set the provider you want to use. The default
value is 'mymemory'.
--secret_access_key TEXT Set the secret access key used to get provider
oAuth token.
-o, --output_only Set to display the translation only.
-r, --region TEXT Set to pass a region in to API calls that require it.
--help Show this message and exit.
Change Default Languages
~~~~~~~~~~~~~~~~~~~~~~~~
In ~/.python-translate.cfg:
.. code-block:: bash
[DEFAULT]
from_lang = autodetect
to_lang = de
provider = mymemory
secret_access_key =
The cfg is not for use as a Python module.
or run the command line and follow the steps:
.. code-block:: bash
$ translate-cli --generate-config-file
Translate from [autodetect]:
Translate to:
Provider [mymemory]:
Secret Access Key []:
Use As A Python Module
----------------------
.. code-block:: python
In [1]: from translate import Translator
In [2]: translator = Translator(to_lang="zh")
In [3]: translation = translator.translate("This is a pen.")
Out [3]: 这是一支笔
The result is usually a unicode string.
Use a different translation provider
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
In [1]: from translate import Translator
In [2]: to_lang = 'zh'
In [3]: secret = ''
In [4]: translator = Translator(provider='', to_lang=to_lang, secret_access_key=secret)
In [5]: translator.translate('the book is on the table')
Out [5]: '碗是在桌子上。'
The DeepL Provider
~~~~~~~~~~~~~~~~~~
To use DeepL's pro API, pass an additional parameter named pro to the Translator object and set it to True and use your pro authentication key as the secret_access_key
.. code-block:: python
In: translator = Translator(provider='microsoft', to_lang=to_lang, secret_access_key=secret, pro=True)
Documentation
-------------
Check out the latest ``translate`` documentation at `Read the Docs `_
Contributing
------------
Please send pull requests, very much appreciated.
1. Fork the `repository `_ on GitHub.
2. Make a branch off of master and commit your changes to it.
3. (Optional) if you want an isolated environment, you can install nixOS (https://nixos.org) and run ``nix-shell --pure`` under the project folder
3. Install requirements. ``pip install -r requirements-dev.txt``
4. Install pre-commit. ``pre-commit install``
5. Run the tests with ``py.test -vv -s``
6. Create a Pull Request with your contribution.
.. |Docs| image:: https://readthedocs.org/projects/translate-python/badge/?version=latest
:target: http://translate-python.readthedocs.org/en/latest/?badge=latest
.. |Travis Build Status| image:: https://api.travis-ci.org/terryyin/translate-python.png?branch=master
:target: https://travis-ci.org/terryyin/translate-python
.. |PyPI Version| image:: https://img.shields.io/pypi/pyversions/translate.svg?maxAge=2592000
:target: https://pypi.python.org/pypi/translate
.. |PyPI License| image:: https://img.shields.io/pypi/l/translate.svg?maxAge=2592000
:target: https://github.com/terryyin/translate-python/blob/master/LICENSE
.. |PyPI latest| image:: https://img.shields.io/pypi/v/translate.svg?maxAge=360
:target: https://pypi.python.org/pypi/translate
Owner
- Name: Terry Yin
- Login: terryyin
- Kind: user
- Location: Singapore
- Company: @nerds-odd-e
- Repositories: 75
- Profile: https://github.com/terryyin
Programmer and Supreme Leader @nerds-odd-e .
GitHub Events
Total
- Issues event: 2
- Watch event: 25
- Fork event: 1
Last Year
- Issues event: 2
- Watch event: 25
- Fork event: 1
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Rafael Henter | h****r@g****m | 72 |
| terryyin | t****y@o****m | 49 |
| kxrob | k****o@g****m | 8 |
| Azin Zahraei | a****i@d****m | 5 |
| Matt Fellows | g****b@m****k | 3 |
| P.J. Finlay | p****t@g****m | 3 |
| Dan Goje | g****8@g****m | 2 |
| Kamiel Choi | k****r@h****m | 2 |
| theSage21 | a****4@g****m | 2 |
| Jacob Tyndall | j****l@g****m | 1 |
| Quang Linh LE | l****k@g****m | 1 |
| gingebot | g****t@U****) | 1 |
| Adrian Valente | a****e@e****r | 1 |
| Anton Bolotinsky | b****n@g****m | 1 |
| Cléber Zavadniak | c****r@d****m | 1 |
| Crude Rags | c****s@g****m | 1 |
| FeetsTV | 7****v | 1 |
| Gonzalo Odiard | g****d@g****m | 1 |
| Magnun Leno | m****o@g****m | 1 |
| Michalis Ioak | i****s@g****m | 1 |
| NVN1518 | 6****8 | 1 |
| Tim Gates | t****s@i****m | 1 |
| hanxiaomax-mac | h****x@q****m | 1 |
| karimk123 | 6****3 | 1 |
| madina | 3****s | 1 |
| mketab | m****b@i****m | 1 |
Committer Domains (Top 20 + Academic)
qq.com: 1
iress.com: 1
dronemapp.com: 1
ens.fr: 1
unknown.(none): 1
github.com: 1
matt-fellows.me.uk: 1
deepl.com: 1
odd-e.com: 1
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 70
- Total pull requests: 39
- Average time to close issues: 12 months
- Average time to close pull requests: about 1 month
- Total issue authors: 56
- Total pull request authors: 25
- Average comments per issue: 1.43
- Average comments per pull request: 1.18
- Merged pull requests: 35
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 2
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 0.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- rhenter (7)
- rbu (3)
- terryyin (2)
- beyondguo (2)
- PJ-Finlay (2)
- kristalacka (2)
- HeavySnowJakarta (2)
- mrx23dot (2)
- AYMBotBuildersOfficial (1)
- ghost (1)
- Moriand (1)
- Rawan44 (1)
- rasaworkshop (1)
- andrewsanchez (1)
- arsenikov (1)
Pull Request Authors
- rhenter (10)
- MattFellows (4)
- terryyin (3)
- azin-z (2)
- PJ-Finlay (2)
- feetstv (1)
- godiard (1)
- adrian-valente (1)
- theSage21 (1)
- pringon (1)
- karimk123 (1)
- kxrob (1)
- michalisioak (1)
- Bachstelze (1)
- cleberzavadniak (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
requirements-build.txt
pypi
- pytest *
- pytest-cov *
- vcrpy *
- wheel *
requirements-dev.txt
pypi
- Sphinx *
- codecov *
- coveralls *
- ipdb *
- ipython *
- pre-commit *
- pytest *
- pytest-cov *
- sphinx-autobuild *
- sphinx-rtd-theme *
- tox *
- twine *
- vcrpy *
- wheel *
requirements.txt
pypi
- click *
- libretranslatepy ==2.1.1
- lxml *
- requests *