diff --git a/gramps/gen/utils/grampslocale.py b/gramps/gen/utils/grampslocale.py index f256eb239..62889d072 100644 --- a/gramps/gen/utils/grampslocale.py +++ b/gramps/gen/utils/grampslocale.py @@ -251,6 +251,16 @@ class GrampsLocale(object): else: self.calendar = self.lang + if 'LC_NUMERIC' in os.environ: + self.numeric = os.environ['LC_NUMERIC'] + else: + self.numeric = self.lang + + if 'LC_MONETARY' in os.environ: + self.currency = os.environ['LC_MONETARY'] + else: + self.currency = self.lang + def _init_from_environment(self): def _check_locale(locale): @@ -304,6 +314,18 @@ class GrampsLocale(object): else: self.collation = self.lang + loc = locale.getlocale(locale.LC_NUMERIC) + if loc and loc[0]: + self.numeric = '.'.join(loc) + else: + self.numeric = self.lang + + loc = locale.getlocale(locale.LC_MONETARY) + if loc and loc[0]: + self.currency = '.'.join(loc) + else: + self.currency = self.lang + def _win_bindtextdomain(self, localedomain, localedir): """ Help routine for loading and setting up libintl attributes @@ -343,7 +365,7 @@ class GrampsLocale(object): else: self._init_from_environment() else: - self.currency = self.calendar = self.collation = self.lang + self.numeric = self.currency = self.calendar = self.collation = self.lang if not self.lang: self.lang = 'en_US.UTF-8' diff --git a/gramps/gen/utils/maclocale.py b/gramps/gen/utils/maclocale.py index 0b842d3aa..c596614ca 100644 --- a/gramps/gen/utils/maclocale.py +++ b/gramps/gen/utils/maclocale.py @@ -130,6 +130,10 @@ def mac_setup_localization(glocale): locale = "" calendar = "" currency = "" +#Note that numeric separators are encoded in AppleICUNumberSymbols, +#with [0] being the decimal separator and [1] the thousands +#separator. This obviously won't translate into a locale without +#searching the locales database for a match. default_locale = _mac_get_gramps_defaults("AppleLocale") if not default_locale: return (locale, calendar, currency) @@ -281,4 +285,9 @@ def mac_setup_localization(glocale): else: glocale.collation = glocale.lang[:5] + if "LC_NUMERIC" in os.environ: + glocale.numeric = os.environ["LC_NUMERIC"] + else: + glocale.numeric = glocale.lang[:5] +