Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the right way to specify dest lang as Chinese? #48

Closed
xrkk opened this issue Mar 2, 2022 · 3 comments
Closed

What is the right way to specify dest lang as Chinese? #48

xrkk opened this issue Mar 2, 2022 · 3 comments

Comments

@xrkk
Copy link

xrkk commented Mar 2, 2022

from translatepy.utils.request import Request
from translatepy.translators.google import GoogleTranslateV1

proxy_request = Request(proxy_urls=["127.0.0.1:10809"])
translator = GoogleTranslateV1(request=proxy_request)
print(translator.translate(txt, Language("zh-cn")).result)

With above code, exception occurs:

translatepy.exceptions.UnknownLanguage: Couldn't recognize the given language (zh-cn)
Did you mean: czech (Similarity: 67.61%)?

I tried again with "zh-CN" or "Chinese", none of them worked!

@ZhymabekRoman
Copy link
Contributor

ZhymabekRoman commented Mar 2, 2022

I tried again with "zh-CN" or "Chinese", none of them worked!

Try specify "zho", this is a workaround for this unfixed bug.

Upd: "Chinese" also works

@Animenosekai
Copy link
Owner

Thank you for reporting this issue @xrkk

Indeed, zh-CN wasn't in the CODES list.

199c566 should fix your problem!

@xrkk
Copy link
Author

xrkk commented Mar 5, 2022

Yes, it worked! Thank you for your good work. Closing this issue.

@xrkk xrkk closed this as completed Mar 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants