terryyin / translate-python

Online translation as a Python module & command line tool. No key, no authentication needed.
MIT License
724 stars 155 forks source link

Failed to translate from Chinese to Korean #108

Closed HeavySnowJakarta closed 9 months ago

HeavySnowJakarta commented 9 months ago
>>> t = tr(from_lang="zh", to_lang="kr")
>>> t.translate("你好")
Traceback (most recent call last):
  File "C:\pyenv\pyenv-win\versions\3.10.5\lib\site-packages\translate\translate.py", line 45, in <genexpr>
    return ' '.join(self.provider.get_translation(text_wraped) for text_wraped in text_list)
  File "C:\pyenv\pyenv-win\versions\3.10.5\lib\site-packages\translate\providers\mymemory_translated.py", line 49, in get_translation
    next_best_match = next(match for match in matches)
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\pyenv\pyenv-win\versions\3.10.5\lib\site-packages\translate\translate.py", line 45, in translate
    return ' '.join(self.provider.get_translation(text_wraped) for text_wraped in text_list)
RuntimeError: generator raised StopIteration
>>>
HeavySnowJakarta commented 9 months ago

I was wrong. For Korean it should be ko instead of kr.