grampslocale: Remove unused currency
This commit is contained in:
parent
53d32945d4
commit
2accc585f3
@ -330,11 +330,6 @@ class GrampsLocale:
|
|||||||
else:
|
else:
|
||||||
self.numeric = self.lang
|
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 _init_from_environment(self):
|
||||||
|
|
||||||
def _check_locale(locale):
|
def _check_locale(locale):
|
||||||
@ -403,12 +398,6 @@ class GrampsLocale:
|
|||||||
else:
|
else:
|
||||||
self.numeric = self.lang
|
self.numeric = self.lang
|
||||||
|
|
||||||
loc = locale.getlocale(locale.LC_MONETARY)
|
|
||||||
if loc and loc[0]:
|
|
||||||
self.currency = '.'.join(loc)
|
|
||||||
else:
|
|
||||||
self.currency = self.lang
|
|
||||||
|
|
||||||
# $LANGUAGE overrides $LANG, $LC_MESSAGES
|
# $LANGUAGE overrides $LANG, $LC_MESSAGES
|
||||||
if "LANGUAGE" in os.environ:
|
if "LANGUAGE" in os.environ:
|
||||||
language = [x for x in [self.check_available_translations(l)
|
language = [x for x in [self.check_available_translations(l)
|
||||||
@ -468,7 +457,7 @@ class GrampsLocale:
|
|||||||
else:
|
else:
|
||||||
self._init_from_environment()
|
self._init_from_environment()
|
||||||
else:
|
else:
|
||||||
self.numeric = self.currency = self.calendar = self.collation = self.lang
|
self.numeric = self.calendar = self.collation = self.lang
|
||||||
|
|
||||||
if not self.lang:
|
if not self.lang:
|
||||||
self.lang = 'en_US.UTF-8'
|
self.lang = 'en_US.UTF-8'
|
||||||
@ -570,7 +559,7 @@ class GrampsLocale:
|
|||||||
if not self.language and _first.language:
|
if not self.language and _first.language:
|
||||||
self.language = _first.language
|
self.language = _first.language
|
||||||
|
|
||||||
self.numeric = self.currency = self.calendar = self.collation = self.lang
|
self.numeric = self.calendar = self.collation = self.lang
|
||||||
|
|
||||||
self.rtl_locale = False
|
self.rtl_locale = False
|
||||||
if self.language[0] in _RTL_LOCALES:
|
if self.language[0] in _RTL_LOCALES:
|
||||||
|
@ -46,9 +46,8 @@ are the names of the controls in System Preferences; the names in the
|
|||||||
defaults system are AppleCollationOrder and AppleLocale,
|
defaults system are AppleCollationOrder and AppleLocale,
|
||||||
respectively.)
|
respectively.)
|
||||||
|
|
||||||
The user can override the currency and calendar, and those values are
|
The user can override the calendar, and thise value is appended to AppleLocale
|
||||||
appended to AppleLocale and parsed below. But Gramps makes no use of
|
and parsed below. But Gramps sets the calendar in its own preferences, so it is
|
||||||
currency and sets the calendar in its own preferences, so they're
|
|
||||||
ignored.
|
ignored.
|
||||||
|
|
||||||
Where the mismatch becomes a problem is in date and number
|
Where the mismatch becomes a problem is in date and number
|
||||||
@ -148,7 +147,6 @@ def mac_setup_localization(glocale):
|
|||||||
def _mac_check_locale(locale_string):
|
def _mac_check_locale(locale_string):
|
||||||
locale = None
|
locale = None
|
||||||
calendar = None
|
calendar = None
|
||||||
currency = None
|
|
||||||
div = locale_string.strip().split("@")
|
div = locale_string.strip().split("@")
|
||||||
LOG.debug("Checking Locale %s", ' '.join(div))
|
LOG.debug("Checking Locale %s", ' '.join(div))
|
||||||
locale = glocale.check_available_translations(div[0])
|
locale = glocale.check_available_translations(div[0])
|
||||||
@ -158,10 +156,8 @@ def mac_setup_localization(glocale):
|
|||||||
(name, value) = phrase.split("=")
|
(name, value) = phrase.split("=")
|
||||||
if name == "calendar":
|
if name == "calendar":
|
||||||
calendar = glocale.check_available_translations(value)
|
calendar = glocale.check_available_translations(value)
|
||||||
elif name == "currency":
|
|
||||||
currency = value
|
|
||||||
|
|
||||||
return (locale, calendar, currency)
|
return (locale, calendar)
|
||||||
|
|
||||||
def _mac_get_locale():
|
def _mac_get_locale():
|
||||||
"""
|
"""
|
||||||
@ -214,7 +210,6 @@ def mac_setup_localization(glocale):
|
|||||||
_locale = None
|
_locale = None
|
||||||
_failure = False
|
_failure = False
|
||||||
glocale.calendar = None
|
glocale.calendar = None
|
||||||
glocale.currency = None
|
|
||||||
try:
|
try:
|
||||||
locale.setlocale(locale.LC_ALL, '')
|
locale.setlocale(locale.LC_ALL, '')
|
||||||
_locale = locale.getlocale()
|
_locale = locale.getlocale()
|
||||||
@ -229,7 +224,7 @@ def mac_setup_localization(glocale):
|
|||||||
|
|
||||||
if not glocale.lang:
|
if not glocale.lang:
|
||||||
LOG.debug("Setting from the environment didn't work out, checking defaults")
|
LOG.debug("Setting from the environment didn't work out, checking defaults")
|
||||||
(glocale.lang, glocale.currency, glocale.calendar) = _mac_get_locale()
|
(glocale.lang, glocale.calendar) = _mac_get_locale()
|
||||||
|
|
||||||
glocale.coll_qualifier = None
|
glocale.coll_qualifier = None
|
||||||
glocale.collation = _mac_get_collation()
|
glocale.collation = _mac_get_collation()
|
||||||
@ -294,7 +289,4 @@ def mac_setup_localization(glocale):
|
|||||||
else:
|
else:
|
||||||
glocale.calendar = glocale.lang[:5]
|
glocale.calendar = glocale.lang[:5]
|
||||||
|
|
||||||
if not glocale.currency:
|
|
||||||
glocale.currency = locale.getlocale(locale.LC_MONETARY)[0] or glocale.lang
|
|
||||||
|
|
||||||
glocale.numeric = locale.getlocale(locale.LC_NUMERIC)[0] or glocale.lang
|
glocale.numeric = locale.getlocale(locale.LC_NUMERIC)[0] or glocale.lang
|
||||||
|
@ -581,7 +581,6 @@ def run():
|
|||||||
LOG.debug("Translating Gramps to %s", glocale.language[0])
|
LOG.debug("Translating Gramps to %s", glocale.language[0])
|
||||||
LOG.debug("Collation Locale: %s", glocale.collation)
|
LOG.debug("Collation Locale: %s", glocale.collation)
|
||||||
LOG.debug("Date/Time Locale: %s", glocale.calendar)
|
LOG.debug("Date/Time Locale: %s", glocale.calendar)
|
||||||
LOG.debug("Currency Locale: %s", glocale.currency)
|
|
||||||
LOG.debug("Number-format Locale: %s", glocale.numeric)
|
LOG.debug("Number-format Locale: %s", glocale.numeric)
|
||||||
|
|
||||||
if 'LANG' in os.environ:
|
if 'LANG' in os.environ:
|
||||||
|
Loading…
Reference in New Issue
Block a user