xulrunner应用程序中的自动区域设置检测

时间:2013-04-08 03:49:51

标签: xulrunner

我有一个xulrunner应用程序,它有日语和英语语言环境。使用-UILocale <locale>切换语言环境可以正常工作,因此实际的语言环境文件或代码没有问题,但是在日语计算机上运行应用程序时,它仍然以英语显示。显然"normally the application locale is inherited from the OS environment of the host system",但在Windows或OS X上似乎没有发生。

我添加了默认pref("intl.locale.matchOS", "true")只是为了确定,但仍然没有骰子。我也尝试了xulrunner的每个版本。

xulrunner应该如何检测系统区域设置,我该怎样才能这样做?

1 个答案:

答案 0 :(得分:-1)

请参阅此

https://developer.mozilla.org/en-US/docs/Make_your_xulrunner_app_match_the_system_locale

from xpcom import components
ps_cls = components.classes["@mozilla.org/preferences-service;1"]
ps = ps_cls.getService(components.interfaces.nsIPrefService)
branch = ps.getBranch("general.useragent.")
branch.setCharPref("locale", lang)

os.environ["LANGUAGE"] = lang

根据区域设置设置lang。