Fixed #18419 -- Full backwards compatibility for old language codes #1872

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@bmispelon

View changes

django/utils/translation/trans_real.py
@@ -48,6 +48,12 @@
language_code_prefix_re = re.compile(r'^/([\w-]+)(/|$)')
+# some browsers use deprecated locales. refs #18419
+deprecated_locales = {

This comment has been minimized.

Show comment Hide comment
@bmispelon

bmispelon Nov 5, 2013

Member

Just to make sure people don't start using, this, I'd make it a "private" variable (and maybe make it a "constant" too): _DEPRECATED_LOCALES.

@bmispelon

bmispelon Nov 5, 2013

Member

Just to make sure people don't start using, this, I'd make it a "private" variable (and maybe make it a "constant" too): _DEPRECATED_LOCALES.

@bmispelon

View changes

django/utils/translation/trans_real.py
if supported is None:
from django.conf import settings
supported = OrderedDict(settings.LANGUAGES)
if lang_code:
+ # some browsers use deprecated language codes -- #18419
+ if lang_code not in supported and lang_code in deprecated_locales:

This comment has been minimized.

Show comment Hide comment
@bmispelon

bmispelon Nov 5, 2013

Member

I think you could merge the two if statements into one:

if (lang_code not in supported and lang_code in deprecated_locales and
        deprecated_locales[lang_code] in supported):
    return deprecated_locales[lang_code]
@bmispelon

bmispelon Nov 5, 2013

Member

I think you could merge the two if statements into one:

if (lang_code not in supported and lang_code in deprecated_locales and
        deprecated_locales[lang_code] in supported):
    return deprecated_locales[lang_code]
Fixed #18419 -- Full backwards compatibility for old language codes
Improved documentation about zh-* deprecation and upgrade path.

Thanks to Baptiste Mispelon for the code reviews.
@bmispelon

This comment has been minimized.

Show comment Hide comment
@bmispelon

bmispelon Nov 5, 2013

Member

Merged in e5e044d.

Thanks.

Member

bmispelon commented Nov 5, 2013

Merged in e5e044d.

Thanks.

@bmispelon bmispelon closed this Nov 5, 2013

@gwasser gwasser referenced this pull request in django-helpdesk/django-helpdesk Dec 9, 2017

Closed

Email templates translation zh_Hans (zh_CN) #572

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment