diff --git a/AUTHORS b/AUTHORS index c902404f3c..7e91eda833 100644 --- a/AUTHORS +++ b/AUTHORS @@ -280,6 +280,7 @@ answer newbie questions, and generally made Django that much better: Neal Norwitz Todd O'Bryan oggie rob + oggy Jay Parlar Carlos Eduardo de Paula pavithran s diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py index bcc5e4b83d..451420c7d8 100644 --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -161,6 +161,15 @@ def translation(language): res = _translation(globalpath) + # We want to ensure that, for example, "en-gb" and "en-us" don't share + # the same translation object (thus, merging en-us with a local update + # doesn't affect en-gb), even though they will both use the core "en" + # translation. So we have to subvert Python's internal gettext caching. + base_lang = lambda x: x.split('-', 1)[0] + if base_lang(lang) in [base_lang(trans) for trans in _translations]: + res._info = res._info.copy() + res._catalog = res._catalog.copy() + def _merge(path): t = _translation(path) if t is not None: