-
Notifications
You must be signed in to change notification settings - Fork 75
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
Any way to get native language names from the list? #22
Comments
Hi @mkinney, thanks for the question. We don't have this information in the languages list. You could instead use the translator itself to translate the native language name: Edited to add: warning, this approach to determine native names does not always yield correct results, see below.
Edited to add: After reviewing this code above, it might not work correctly in some cases. DeepL translates best when the input text includes context; translating singular words may lead to mistakes. The example above for Chinese "中国" has a closer meaning to "China" (the country). This approach might have similar problems for other languages due to the lack of context. |
That's great! Do you want a PR to update the README example with that updated code snippet? |
I edited the message above after reviewing: the approach above is wrong in some cases e.g. Chinese. As the approach is flawed I would not add it to the README. Coming back to your original question, it seems we don't have an easy way to get native language names. Some languages and/or UI frameworks (e.g. .NET) include a locale framework that defines native language names, but unfortunately after a cursory search I could not find something suitable in Python. |
Ok. I would be content with the list of languages in native language somewhere. For context, this is what I’m using as a language picker in a list. |
Hi again, I do not have an update regarding our API, however this StackOverflow post might provide a good solution using the ICU Python package: https://stackoverflow.com/questions/10405915/how-to-get-the-language-name-in-native-language. |
Hi @mkinney, the team discussed this topic: we won't add the native language names. Various platforms offer alternatives you can use to get the native names, for example ICU Python package above. |
For instance, in the README it shows this snippet:
It would be wonderful if the "native" translation of their language could be shown, too.
In other words, "DE (German)" would also print "Deutsch". Most of the languages I can figure out, but not really sure what the "ZH" equivalent would be.
I'm using the free api level, so I'm hoping that could be added to that level.
The text was updated successfully, but these errors were encountered: