Opened 5 years ago
Closed 5 years ago
#31132 closed Bug (needsinfo)
Django Internationalization Issue
Reported by: | Tiago Borges | Owned by: | nobody |
---|---|---|---|
Component: | Internationalization | Version: | 2.2 |
Severity: | Normal | Keywords: | internationalization |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
I have a application in django 2.2 to translate just as below:
LANGUAGES = ( ('pt', _('Portuguese')), ('en', _('English')), ('es', _('Spanish')), ) LANGUAGE_CODE = 'en' USE_I18N = True
The translation itself is working on the templates and for the default language (LANGUAGE_CODE). The issue lies on the translation triggering. Since this is for a REST api, I will not be using cookies or sessions, the translation needs to watch the Accept-Language
header. Debugging the Locale middleware, I can confirm that the correct language is being found, but the translated text are returned always for the default language (LANGUAGE_CODE), ignoring the language found by the middleware. If I replace the LANGUAGE_CODE
for pt or es, it works just fine. The django docs states that LANGUAGE_CODE
was supposed to be the last fallback.
Change History (2)
comment:1 by , 5 years ago
Description: | modified (diff) |
---|
comment:2 by , 5 years ago
Resolution: | → needsinfo |
---|---|
Severity: | Release blocker → Normal |
Status: | new → closed |
There is not enough elements in your report to demonstrate that Django is at fault. You may try to provide a failing test, or use first a support channel to ensure that this is a bug in Django.