Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #7163 -- Fixed a translation-sharing problem so that you can ha…

…ve en-gb

and en-us at the app-level, even though Django only has an "en" translation
(for example). Analysis and patch from ognjen.maric@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7857 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 72544950e198c08ac49ba9d878ea7440313b13a7 1 parent 8975bba
Malcolm Tredinnick authored July 07, 2008
1  AUTHORS
@@ -280,6 +280,7 @@ answer newbie questions, and generally made Django that much better:
280 280
     Neal Norwitz <nnorwitz@google.com>
281 281
     Todd O'Bryan <toddobryan@mac.com>
282 282
     oggie rob <oz.robharvey@gmail.com>
  283
+    oggy <ognjen.maric@gmail.com>
283 284
     Jay Parlar <parlar@gmail.com>
284 285
     Carlos Eduardo de Paula <carlosedp@gmail.com>
285 286
     pavithran s <pavithran.s@gmail.com>
9  django/utils/translation/trans_real.py
@@ -161,6 +161,15 @@ def _translation(path):
161 161
 
162 162
         res = _translation(globalpath)
163 163
 
  164
+        # We want to ensure that, for example,  "en-gb" and "en-us" don't share
  165
+        # the same translation object (thus, merging en-us with a local update
  166
+        # doesn't affect en-gb), even though they will both use the core "en"
  167
+        # translation. So we have to subvert Python's internal gettext caching.
  168
+        base_lang = lambda x: x.split('-', 1)[0]
  169
+        if base_lang(lang) in [base_lang(trans) for trans in _translations]:
  170
+            res._info = res._info.copy()
  171
+            res._catalog = res._catalog.copy()
  172
+
164 173
         def _merge(path):
165 174
             t = _translation(path)
166 175
             if t is not None:

0 notes on commit 7254495

Please sign in to comment.
Something went wrong with that request. Please try again.