Opened 2 years ago
Closed 2 years ago
#33863 closed Bug (fixed)
Strings from default locale missing from Django JavaScript catalog
Reported by: | Carlos Mermingas | Owned by: | Claude Paroz |
---|---|---|---|
Component: | Internationalization | Version: | 4.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Problem
The JavaScript catalog doesn't include fallback strings in certain scenarios. In other words: when string "A" is not translated in es_MX
but it is translated in es
, the JavaScript catalog contains the default or untranslated "A" string.
I set up an app that demonstrates this problem: https://github.com/cmermingas/i18n_test
I believe that this is an issue but I asked in StackOverflow, in case it's improper use: https://stackoverflow.com/questions/73086306/strings-from-default-locale-missing-from-django-javascript-catalog
Setup
LOCALE_PATHS
set toPROJECT_ROOT/locale
.
- Translations for all apps stored under
LOCALE_PATHS
.
JavaScriptCatalog
configured without packages:
path('jsi18n/', JavaScriptCatalog.as_view(), name='javascript-catalog')
es_MX
andes
translations that demonstrate the problem:
- The string
"es - Not translated"
is translated in thees
locale. - The string
"es_MX - Not translated"
is translated in thees_MX
locale.
Workaround
This works if I pass packages
to JavaScriptCatalog
:
path( 'jsi18n/', JavaScriptCatalog.as_view(packages=["testapp"]), name='javascript-catalog' )
But this is not required, is it?
Change History (6)
comment:1 by , 2 years ago
comment:2 by , 2 years ago
Thank you Claude. The only difference that I see in that test setup is that the "locale" folder is under "view_tests", which is an installed app.
How about this? https://github.com/cmermingas/django/commit/20f1a1a2f0d0a11f96f6c182b017230bf58ecfa6
comment:3 by , 2 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Bug |
Thanks for your test, I spotted the issue.
comment:5 by , 2 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
I was not able to reproduce your issue with https://github.com/claudep/django/commit/8941db68bef
Did I miss something?