[r21694]GrampsLocale: Use glocale.lang or glocale.language[0]
To get the default localization instead of locale.getlocale() or glocale.get_translation().language(). svn: r21698
This commit is contained in:
parent
38cc711bde
commit
1f38fd43f5
@ -1794,7 +1794,7 @@ def get_relationship_calculator(reinit=False):
|
|||||||
global __RELCALC_CLASS
|
global __RELCALC_CLASS
|
||||||
|
|
||||||
if __RELCALC_CLASS is None or reinit:
|
if __RELCALC_CLASS is None or reinit:
|
||||||
lang = glocale.get_translation().language()
|
lang = glocale.language[0]
|
||||||
__RELCALC_CLASS = RelationshipCalculator
|
__RELCALC_CLASS = RelationshipCalculator
|
||||||
# If lang not set default to English relationship calulator
|
# If lang not set default to English relationship calulator
|
||||||
# See if lang begins with en_, English_ or english_
|
# See if lang begins with en_, English_ or english_
|
||||||
|
@ -40,7 +40,7 @@ MANUALS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#first, determine language code, so nl_BE --> wiki /nl
|
#first, determine language code, so nl_BE --> wiki /nl
|
||||||
lang = glocale.get_translation().language()
|
lang = glocale.language[0]
|
||||||
if lang in MANUALS:
|
if lang in MANUALS:
|
||||||
EXTENSION = MANUALS[lang]
|
EXTENSION = MANUALS[lang]
|
||||||
else:
|
else:
|
||||||
|
@ -337,7 +337,7 @@ class GedcomWriter(UpdateCallback):
|
|||||||
# write the language string if the current LANG variable
|
# write the language string if the current LANG variable
|
||||||
# matches something we know about.
|
# matches something we know about.
|
||||||
|
|
||||||
lang = os.getenv('LANG')
|
lang = glocale.language[0]
|
||||||
if lang and len(lang) >= 2:
|
if lang and len(lang) >= 2:
|
||||||
lang_code = LANGUAGES.get(lang[0:2])
|
lang_code = LANGUAGES.get(lang[0:2])
|
||||||
if lang_code:
|
if lang_code:
|
||||||
|
@ -34,7 +34,6 @@ from __future__ import print_function
|
|||||||
# Python modules
|
# Python modules
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import re
|
import re
|
||||||
import locale
|
|
||||||
|
|
||||||
from gramps.gen.constfunc import STRTYPE, cuni
|
from gramps.gen.constfunc import STRTYPE, cuni
|
||||||
"""
|
"""
|
||||||
@ -51,7 +50,7 @@ __all__ = ['Html']
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Constants
|
# Constants
|
||||||
@ -581,11 +580,7 @@ class Html(list):
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
def xml_lang():
|
def xml_lang():
|
||||||
loc = locale.getlocale()
|
return glocale.lang[:5].replace('_', '-')
|
||||||
if loc[0] is None:
|
|
||||||
return ""
|
|
||||||
else:
|
|
||||||
return loc[0].replace('_', '-')
|
|
||||||
|
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
#
|
#
|
||||||
|
@ -32,11 +32,8 @@ Can use the Webkit or Gecko ( Mozilla ) library
|
|||||||
# Python modules
|
# Python modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
|
||||||
_ = glocale.get_translation().gettext
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import locale
|
|
||||||
if sys.version_info[0] < 3:
|
if sys.version_info[0] < 3:
|
||||||
from urlparse import urlunsplit
|
from urlparse import urlunsplit
|
||||||
else:
|
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.constfunc import lin, mac, win
|
||||||
from gramps.gen.config import config
|
from gramps.gen.config import config
|
||||||
from gramps.gen.const import TEMP_DIR
|
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"
|
platform = "Macintosh"
|
||||||
else:
|
else:
|
||||||
platform = "Unknown"
|
platform = "Unknown"
|
||||||
(lang_country, modifier ) = locale.getlocale()
|
lang = glocale.lang[:5].replace('_','-')
|
||||||
lang = lang_country.replace('_','-')
|
|
||||||
#lang += ", " + lang_country.split('_')[0]
|
|
||||||
return "Mozilla/5.0 (%s; U; %s) Gramps/3.2" % ( platform, lang)
|
return "Mozilla/5.0 (%s; U; %s) Gramps/3.2" % ( platform, lang)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user