FlineDev / BartyCrouch

Localization/I18n: Incrementally update/translate your Strings files from .swift, .h, .m(m), .storyboard or .xib files.
MIT License
1.37k stars 121 forks source link

Fix: DeepL translation doesn't work for Simplified Chinese #232

Closed mshibanami closed 3 years ago

mshibanami commented 3 years ago

(No related issue)

Problem

Suppose you want to translate an English word "Hello" to Simplified Chinese with DeepL API via BartyCrouch. Currently, BartyCrouch sends a request like this:

https://api-free.deepl.com/v2/translate?source_lang=En&text=Hello&target_lang=Zh-Hans&auth_key={auth key}

But DeepL doesn't allow Zh-Hans for target_lang nor source_lang, so they always return 400 Bad Request.

This is the documentation of what they allow: https://www.deepl.com/docs-api/translating-text/request/

Proposed Changes

So this PR will change the above URL into this:

https://api-free.deepl.com/v2/translate?source_lang=EN&text=Hello&target_lang=ZH&auth_key={your auth key}
mshibanami commented 3 years ago

Thanks!

Jeehut commented 3 years ago

Released in version 4.7.1. 🚀