diff --git a/gramps/gen/relationship.py b/gramps/gen/relationship.py index 0d68dd035..88e432d8b 100644 --- a/gramps/gen/relationship.py +++ b/gramps/gen/relationship.py @@ -1794,7 +1794,7 @@ def get_relationship_calculator(reinit=False): global __RELCALC_CLASS if __RELCALC_CLASS is None or reinit: - lang = glocale.get_translation().language() + lang = glocale.language[0] __RELCALC_CLASS = RelationshipCalculator # If lang not set default to English relationship calulator # See if lang begins with en_, English_ or english_ diff --git a/gramps/gui/display.py b/gramps/gui/display.py index f4ae0e964..ebe6fdd11 100644 --- a/gramps/gui/display.py +++ b/gramps/gui/display.py @@ -40,7 +40,7 @@ MANUALS = { } #first, determine language code, so nl_BE --> wiki /nl -lang = glocale.get_translation().language() +lang = glocale.language[0] if lang in MANUALS: EXTENSION = MANUALS[lang] else: diff --git a/gramps/plugins/export/exportgedcom.py b/gramps/plugins/export/exportgedcom.py index 795773108..c9caaa6aa 100644 --- a/gramps/plugins/export/exportgedcom.py +++ b/gramps/plugins/export/exportgedcom.py @@ -337,7 +337,7 @@ class GedcomWriter(UpdateCallback): # write the language string if the current LANG variable # matches something we know about. - lang = os.getenv('LANG') + lang = glocale.language[0] if lang and len(lang) >= 2: lang_code = LANGUAGES.get(lang[0:2]) if lang_code: diff --git a/gramps/plugins/lib/libhtml.py b/gramps/plugins/lib/libhtml.py index fe8a333a0..0021c825d 100644 --- a/gramps/plugins/lib/libhtml.py +++ b/gramps/plugins/lib/libhtml.py @@ -34,7 +34,6 @@ from __future__ import print_function # Python modules #------------------------------------------------------------------------ import re -import locale from gramps.gen.constfunc import STRTYPE, cuni """ @@ -51,7 +50,7 @@ __all__ = ['Html'] # GRAMPS modules # #------------------------------------------------------------------------ - +from gramps.gen.const import GRAMPS_LOCALE as glocale #------------------------------------------------------------------------ # # Constants @@ -581,11 +580,7 @@ class Html(list): # #------------------------------------------------------------------------ def xml_lang(): - loc = locale.getlocale() - if loc[0] is None: - return "" - else: - return loc[0].replace('_', '-') + return glocale.lang[:5].replace('_', '-') #------------------------------------------- # diff --git a/gramps/plugins/view/htmlrenderer.py b/gramps/plugins/view/htmlrenderer.py index 902be9bd6..ae11c09ed 100644 --- a/gramps/plugins/view/htmlrenderer.py +++ b/gramps/plugins/view/htmlrenderer.py @@ -32,11 +32,8 @@ Can use the Webkit or Gecko ( Mozilla ) library # Python modules # #------------------------------------------------------------------------- -from gramps.gen.const import GRAMPS_LOCALE as glocale -_ = glocale.get_translation().gettext import os import sys -import locale if sys.version_info[0] < 3: from urlparse import urlunsplit else: @@ -68,6 +65,8 @@ from gramps.gen.utils.file import get_empty_tempdir from gramps.gen.constfunc import lin, mac, win from gramps.gen.config import config from gramps.gen.const import TEMP_DIR +from gramps.gen.const import GRAMPS_LOCALE as glocale +_ = glocale.get_translation().gettext #------------------------------------------------------------------------- # @@ -84,9 +83,7 @@ def get_identity(): platform = "Macintosh" else: platform = "Unknown" - (lang_country, modifier ) = locale.getlocale() - lang = lang_country.replace('_','-') - #lang += ", " + lang_country.split('_')[0] + lang = glocale.lang[:5].replace('_','-') return "Mozilla/5.0 (%s; U; %s) Gramps/3.2" % ( platform, lang) #-------------------------------------------------------------------------