GrampsLocale: Make maclocale.mac_setup_localization() set glocale attributes directly
svn: r21273
This commit is contained in:
parent
f644717309
commit
29873cc9d4
@ -151,7 +151,7 @@ class GrampsLocale(object):
|
|||||||
|
|
||||||
if mac():
|
if mac():
|
||||||
from . import maclocale
|
from . import maclocale
|
||||||
(self.lang, self.language) = maclocale.mac_setup_localization(self, lang, language)
|
maclocale.mac_setup_localization(self, lang, language)
|
||||||
else:
|
else:
|
||||||
self.__init_from_environment(lang, language)
|
self.__init_from_environment(lang, language)
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ def mac_setup_localization(glocale, lang, language):
|
|||||||
if len(loc) > 2:
|
if len(loc) > 2:
|
||||||
loc = loc[:2]
|
loc = loc[:2]
|
||||||
# First see if it matches lang
|
# 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]))):
|
and os.path.exists(os.path.join(locale_dir, lang[:5]))):
|
||||||
return lang[:5]
|
return lang[:5]
|
||||||
else:
|
else:
|
||||||
@ -258,6 +258,7 @@ def mac_setup_localization(glocale, lang, language):
|
|||||||
|
|
||||||
elif len(collation) > 0:
|
elif len(collation) > 0:
|
||||||
lang = mac_resolve_locale(collation)
|
lang = mac_resolve_locale(collation)
|
||||||
|
glocale.lang = lang
|
||||||
|
|
||||||
if not language or len(language) == 0:
|
if not language or len(language) == 0:
|
||||||
if "LANGUAGE" in os.environ:
|
if "LANGUAGE" in os.environ:
|
||||||
@ -275,4 +276,4 @@ def mac_setup_localization(glocale, lang, language):
|
|||||||
and not collation.startswith("en")):
|
and not collation.startswith("en")):
|
||||||
language = [collation]
|
language = [collation]
|
||||||
|
|
||||||
return (lang, language)
|
glocale.language = language
|
||||||
|
Loading…
Reference in New Issue
Block a user