[r21274]GrampsLocale: Introduce new GrampsLocale attributes

currency, calendar, and collate

svn: r21415
This commit is contained in:
John Ralls 2013-02-24 00:55:32 +00:00
parent 7127f8f2da
commit 879c48f57d
2 changed files with 48 additions and 19 deletions

View File

@ -113,6 +113,22 @@ class GrampsLocale(object):
else:
self.language = ["en"]
if "LC_MONETARY" not in os.environ:
self.currency = lang
else:
self.currency = os.environ[LC_MONETARY]
if "LC_TIME" not in os.environ:
self.calendar = lang
else:
self.calendar = os.environ["LC_TIME"]
if "LC_COLLATE" not in os.environ:
self.collation = lang
else:
self.collation = os.environ["LC_COLLATE"]
def __init_first_instance(self, localedir=None, lang=None,
domain=None, language=None):

View File

@ -225,21 +225,11 @@ def mac_setup_localization(glocale, lang, language):
# The action starts here
(loc, currency, calendar) = mac_get_locale()
collation = mac_get_collation()
translations = mac_language_list()
if currency and "LC_MONETARY" not in os.environ:
os.environ["LC_MONETARY"] = currency
if calendar and "LC_TIME" not in os.environ:
os.environ["LC_TIME"] = calendar
if currency and "LC_MONETARY" not in os.environ:
os.environ["LC_MONETARY"] = currency
if calendar and "LC_TIME" not in os.environ:
os.environ["LC_TIME"] = calendar
if "LC_COLLATE" in os.environ:
collation = os.environ["LC_COLLATE"]
else:
collation = mac_get_collation()
if not lang:
if "LANG" in os.environ:
@ -249,12 +239,9 @@ def mac_setup_localization(glocale, lang, language):
loc = mac_resolve_locale(loc)
if loc != None:
lang = loc
collation = mac_resolve_locale(collation)
if "LC_COLLATE" not in os.environ and collation != None:
os.environ["LC_COLLATE"] = collation
if not lang and collation != None:
lang = mac_resolve_locale(collation)
elif len(collation) > 0:
lang = mac_resolve_locale(collation)
glocale.lang = lang
if not language or len(language) == 0:
@ -274,3 +261,29 @@ def mac_setup_localization(glocale, lang, language):
language = [collation]
glocale.language = language
if currency and "LC_MONETARY" not in os.environ:
glocale.currency = currency
os.environ["LC_MONETARY"] = currency
elif "LC_MONETARY" in os.environ:
glocale.currency = os.environ[LC_MONETARY]
else:
glocale.currency = lang
if calendar and "LC_TIME" not in os.environ:
glocale.calendar = calendar
os.environ["LC_TIME"] = calendar
elif "LC_TIME" in os.environ:
glocale.calendar = os.environ["LC_TIME"]
else:
glocale.calendar = lang
if collation and "LC_COLLATION" not in os.environ:
glocale.collation = collation
os.environ["LC_COLLATION"] = calendar
elif "LC_COLLATION" in os.environ:
glocale.collation = os.environ["LC_COLLATION"]
else:
glocale.collation = lang