From 7127f8f2da91ad04fcd8cb4a8cb31f7347489a39 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sun, 24 Feb 2013 00:55:23 +0000 Subject: [PATCH] [r21273] GrampsLocale: Directly set glocale attributes ... in maclocale.mac_setup_localization() svn: r21414 --- gramps/gen/utils/grampslocale.py | 2 +- gramps/gen/utils/maclocale.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gramps/gen/utils/grampslocale.py b/gramps/gen/utils/grampslocale.py index 6e7a756eb..4e0b2c5ce 100644 --- a/gramps/gen/utils/grampslocale.py +++ b/gramps/gen/utils/grampslocale.py @@ -151,7 +151,7 @@ class GrampsLocale(object): if mac(): from . import maclocale - (self.lang, self.language) = maclocale.mac_setup_localization(self, lang, language) + maclocale.mac_setup_localization(self, lang, language) else: self.__init_from_environment(lang, language) diff --git a/gramps/gen/utils/maclocale.py b/gramps/gen/utils/maclocale.py index 4ce0c75ed..a59e9fe88 100644 --- a/gramps/gen/utils/maclocale.py +++ b/gramps/gen/utils/maclocale.py @@ -200,7 +200,7 @@ def mac_setup_localization(glocale, lang, language): if len(loc) > 2: loc = loc[:2] # First see if it matches lang - if (lang.startswith(loc) + if (lang and lang.startswith(loc) and os.path.exists(os.path.join(locale_dir, lang[:5]))): return lang[:5] else: @@ -255,6 +255,7 @@ def mac_setup_localization(glocale, lang, language): elif len(collation) > 0: lang = mac_resolve_locale(collation) + glocale.lang = lang if not language or len(language) == 0: if "LANGUAGE" in os.environ: @@ -272,4 +273,4 @@ def mac_setup_localization(glocale, lang, language): and not collation.startswith("en")): language = [collation] - return (lang, language) + glocale.language = language