terryyin / terryyin/translate-python
auto-detect doesn't work when translating from zh_CN to en
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 759
- Forks
- 152
- PR merge metrics
- No merged PRs in 30d
Description
Awesome Job ! This project really helps me a lot ! But maybe there is a small issue about language auto-detect when translating from zh_CN to en.
Based on the document , if you want to translate a sentence from en to zh_CN , you just need to use three lines:
In [1]: from translate import Translator
In [2]: translator= Translator(to_lang="zh")
In [3]: translation = translator.translate("This is a pen.")
Out [3]: 这是一支笔
So based on my understanding , if you want to implement the reversed action, you also need three lines:
In [1]: from translate import Translator
In [2]: translator= Translator(to_lang="en")
In [3]: translation = translator.translate("这是一支笔")
Out [3]: 这是一支笔 # Still the original sentence. translation doesn't work
But if you specify the input language,it will work:
In [1]: from translate import Translator
In [2]: translator= Translator(from_lang="zh_CN",to_lang="en")
In [3]: translation = translator.translate("这是一支笔")
Out [3]: This is a pen # Translate successfully
Below is the screenshot tested on python3.5:

Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two Translator examples in the issue, then trace the Translator auto-detection path for a zh_CN source with en as the target. Done means the automatic case translates the Chinese sentence to English while the explicit from_lang case continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- localization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100