Fixed #18149 -- Changed language codes for Chinese #1868

Merged
merged 1 commit into from Nov 4, 2013

Conversation

Projects
None yet
3 participants
Contributor

Bouke commented Nov 4, 2013

See ticket 18419 for rationale.

Language codes for Chinese are zh_Hans (Simplified) and zh_Hant (Traditional). Added support for browsers that still send the deprecated language codes.

Thanks to Olli Wang for the report.

@aaugustin aaugustin commented on an outdated diff Nov 4, 2013

django/utils/translation/trans_real.py
@@ -185,6 +185,17 @@ def activate(language):
language and installs it as the current translation object for the current
thread.
"""
+ if isinstance(language, basestring):
+ if language == 'zh-cn':
+ warnings.warn(
+ "The use of the language code 'zh-cn' is deprecated. "
+ "Please use the 'zh-hans' translation instead.",
+ PendingDeprecationWarning)
@aaugustin

aaugustin Nov 4, 2013

Owner

Could you add stacklevel=2 here? That makes the warning marginally more useful.

Same for the second warning.

Owner

aaugustin commented Nov 4, 2013

I see that a bunch of other warnings in the code base don't have a proper stacklevel. I'll merge this and fix the warnings later.

@Bouke Bouke Fixed #18149 -- Changed language codes for Chinese
Language codes for Chinese are zh_Hans (Simplified) and zh_Hant (Traditional).
Added support for browsers that still send the deprecated language codes.

Thanks to Olli Wang for the report.
c0a2388

@aaugustin aaugustin added a commit that referenced this pull request Nov 4, 2013

@aaugustin aaugustin Merge pull request #1868 from Bouke/tickets/18419
Fixed #18149 -- Changed language codes for Chinese
859a205

@aaugustin aaugustin merged commit 859a205 into django:master Nov 4, 2013

Member

bmispelon commented on c0a2388 Nov 4, 2013

This commit introduced two test failures in i18n.tests.MiscTests.

Contributor

Bouke replied Nov 5, 2013

I assume you've fixed those in bdca494?

Member

bmispelon replied Nov 5, 2013

I only fixed the python3 incompatibility. The two tests I mentionned are still broken (from what I understand they expect zh-cn which has been replaced).

Bouke deleted the Bouke:tickets/18419 branch Nov 5, 2013

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