3325: Gramps (from trunc) chrashes without an environment definition for LANG

svn: r13460
This commit is contained in:
Benny Malengier 2009-10-29 22:12:11 +00:00
parent ab302b4673
commit 750331b8bd

View File

@ -1760,10 +1760,17 @@ 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 = ' '
try:
lang = os.environ["LANG"]
except:
import locale
lang = locale.getlocale()[0]
__RELCALC_CLASS = RelationshipCalculator __RELCALC_CLASS = RelationshipCalculator
# set correct relationship calculator based on LANG # set correct relationship calculator based on LANG
for plugin in PluginRegister.get_instance().relcalc_plugins(): for plugin in PluginRegister.get_instance().relcalc_plugins():
if os.environ["LANG"] in plugin.lang_list: if lang in plugin.lang_list:
pmgr = BasePluginManager.get_instance() pmgr = BasePluginManager.get_instance()
# the loaded module is put in variable mod # the loaded module is put in variable mod
mod = pmgr.load_plugin(plugin) mod = pmgr.load_plugin(plugin)