From c11fbe8bfc84373f880ba9696b6b2fd7b0b90269 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Mon, 8 Feb 2016 11:18:11 -0800 Subject: [PATCH] Bug 9159: Date format does not match system. Make US English a special-case locale with en_GB the default if the locale is en_XX where XX != US. Note that untranslated languages will still end up using the 'C' locale. --- gramps/gen/utils/grampslocale.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gramps/gen/utils/grampslocale.py b/gramps/gen/utils/grampslocale.py index 8bb098b81..6ca959f87 100644 --- a/gramps/gen/utils/grampslocale.py +++ b/gramps/gen/utils/grampslocale.py @@ -120,6 +120,10 @@ def _check_mswin_locale(locale): msloc = _LOCALE_NAMES[locale[:2]][:2] locale = locale[:2] except KeyError: + #US English is the outlier, all other English locales want + #real English: + if locale[:2] == ('en') and locale[:5] != 'en_US': + return ('en_GB', '1252') return (None, None) return (locale, msloc) @@ -127,7 +131,9 @@ def _check_mswin_locale_reverse(locale): for (loc, msloc) in _LOCALE_NAMES.items(): if msloc and locale == msloc[0]: return (loc, msloc[1]) - + #US English is the outlier, all other English locales want real English: + if locale.startswith('English') and locale != 'English_United States': + return ('en_GB', '1252') return (None, None) #------------------------------------------------------------------------ @@ -284,6 +290,8 @@ class GrampsLocale(object): if not locale[0]: return False lang = self.check_available_translations(locale[0]) + if not lang and locale[0].startswith('en'): + locale[0] = lang = 'en_GB' if not lang: return False self.lang = locale[0] @@ -795,9 +803,11 @@ class GrampsLocale(object): if locale[:5] in self.languages: return locale[:5] + #US English is the outlier, all other English locales want real English: + if locale[:2] == 'en' and locale[:5] != 'en_US': + return 'en_GB' if locale[:2] in self.languages: return locale[:2] - return None def get_language_dict(self):