Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#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)

comment:1 by Mariusz Felisiak, 5 years ago

Component: UncategorizedInternationalization
Resolution: invalid
Status: newclosed
Summary: jsi18n with zh-hans (or zh-hant) not workingjsi18n with zh-hans (or zh-hant) not working.

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+.

in reply to:  1 comment:2 by tyx1703, 5 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.

Note: See TracTickets for help on using tickets.
Back to Top