Translation even if LANG missing or set wrong.

svn: r14207
This commit is contained in:
Peter Landgren 2010-02-04 12:38:57 +00:00
parent beeac2153f
commit 8aedb01608

View File

@ -1788,13 +1788,19 @@ def get_relationship_calculator(reinit=False):
lang = ' ' lang = ' '
try: try:
lang = os.environ["LANG"] lang = os.environ["LANG"]
_LANG_SET = True
except: except:
import locale import locale
lang = locale.getlocale()[0] lang = locale.getlocale()[0]
_LANG_SET = False
__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 not lang in plugin.lang_list and _LANG_SET:
# LANG set but with non recognizable language info. Try getlocale
import locale
lang = locale.getlocale()[0]
if 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