1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #24413 -- Prevented translation fallback for English

Thanks Tomasz Kontusz for the report, Baptiste Mispelon for
analysis and Tim Graham for the review.
This commit is contained in:
Claude Paroz
2015-02-27 20:17:04 +01:00
parent dcdef1fe2e
commit 3cf1c02695
2 changed files with 18 additions and 5 deletions

View File

@@ -169,11 +169,9 @@ class DjangoTranslation(gettext_module.GNUTranslations):
def _add_fallback(self):
"""Sets the GNUTranslations() fallback with the default language."""
# Don't set a fallback for the default language or for
# en-us (as it's empty, so it'll ALWAYS fall back to the default
# language; found this as part of #21498, as we set en-us for
# management commands)
if self.__language == settings.LANGUAGE_CODE or self.__language == "en-us":
# Don't set a fallback for the default language or any English variant
# (as it's empty, so it'll ALWAYS fall back to the default language)
if self.__language == settings.LANGUAGE_CODE or self.__language.startswith('en'):
return
default_translation = translation(settings.LANGUAGE_CODE)
self.add_fallback(default_translation)