Skip to content

Adding "rest_framework" to settings.py changes translations of gettext #3735

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

Closed
guettli opened this issue Dec 14, 2015 · 5 comments
Closed
Labels

Comments

@guettli
Copy link

guettli commented Dec 14, 2015

In django the string "This field is required." gets translated to the german string "Dieses Feld ist zwingend erforderlich."

As soon as I add "rest_framework" to the settings.py the german string changes to "Dieses Feld ist erforderlich."

The german word "zwingend" is missing.

You don't need to understand the german words.

But why does this happen?

Here is the django po file translation:

https://github.com/django/django/blob/master/django/conf/locale/de/LC_MESSAGES/django.po#L611

Where does the other translation come from?

I could not find a po-file in the repo of django-rest-framework

Why does this sentence get translated twice? One time in django, one time in the rest-framework?

@xordoquy
Copy link
Collaborator

The Django translation engine doesn't take into account strings that are already translated as part of another application.
Translations are managed by Transifex.
Thanks for the report, we will see if we can avoid translating strings that are already part of the Django package.

@xordoquy
Copy link
Collaborator

@claudep
Copy link

claudep commented Dec 16, 2015

One possible workaround (completely untested): create a django_trans("My string") utility which simply returns ugettext(string).

@guettli
Copy link
Author

guettli commented Dec 18, 2015

@claudep In my case _('...') returns the translation from the rest-framework. But I would like to get the translation from django. I guess ugettext(string) works the same: the rest-framework translation gets returned. I guess I am missing something. How to create django_trans()?

@claudep
Copy link

claudep commented Dec 18, 2015

My suggestion was not for your code, but for rest-framework itself, so the string wouldn't be extracted in DRF translation catalogs.

@tomchristie tomchristie closed this as not planned Won't fix, can't repro, duplicate, stale Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants