#31381 closed Bug (invalid)
jsi18n with zh-hans (or zh-hant) not working.
| Reported by: | tyx1703 | Owned by: | nobody |
|---|---|---|---|
| Component: | Internationalization | Version: | 1.11 |
| Severity: | Normal | Keywords: | zh-hans djangojs |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
When language equal 'zh-hans' (or 'zh-hant', the language code which the length of second part split by '-' more than 2 has this problem), Django will occur a bug that djangojs not working
For example:
django will find django.mo in '/local/zh_Hant/LC_MESSAGES/django.mo'
But, when domain is 'djangojs', django find djangojs.mo in '/local/zh_hant/LC_MESSAGES/djangojs.mo'.
H case is causing the problem directly.
After debugging, I found that django call to_locale twice in _get_locale defined in the django/views/i18n.py when domain is djangojs, but once when domain is django
At brief:
domain: django, call to_local once
zh-hans => to_local('zh-hans') => zh_Hant => /local/zh_Hant/LC_MESSAGES/django.mo
domain: djangojs, call to_local twice
zh-hans => to_local('zh-hans') => zh_Hant => to_local('zh_Hant') => zh_hant => /local/zh_hant/LC_MESSAGES/django.mo
Change History (2)
follow-up: 2 comment:1 by , 6 years ago
| Component: | Uncategorized → Internationalization |
|---|---|
| Resolution: | → invalid |
| Status: | new → closed |
| Summary: | jsi18n with zh-hans (or zh-hant) not working → jsi18n with zh-hans (or zh-hant) not working. |
comment:2 by , 6 years ago
Thanks for your reply.
I found that use JavaScriptCatalog.as_view() instead of javascript_catalog will solve this problem today.
So sorry for your wasted time. Hope this comment can help someone guys with same problem.
Django 1.11 doesn't receive bugfixes anymore, moreover
_get_locale()was removed in Django 2.0 (2b20e4148f4f54431834e6a43af6c39dc75e6362). We will not consider this as a valid issue unless you're able to reproduce your it with Django 3.0+.