diff --git a/gui/app.py b/gui/app.py index 1d31ccc1b..424c74963 100644 --- a/gui/app.py +++ b/gui/app.py @@ -3,6 +3,7 @@ import config import os from logbook import Logger pyfalog = Logger(__name__) +from service.settings import LocaleSettings class PyfaApp(wx.App): def OnInit(self): @@ -37,7 +38,7 @@ class PyfaApp(wx.App): #----------------------------------------------------------------------- - def UpdateLanguage(self, lang = "en_US"): + def UpdateLanguage(self, lang_override = None): """ Update the language to the requested one. @@ -52,13 +53,10 @@ class PyfaApp(wx.App): # Language domain. langDomain = "lang" + lang = lang_override or LocaleSettings.getInstance().get('locale') # Languages you want to support. - supLang = { - "en_US": wx.LANGUAGE_ENGLISH, - "zh_CN": wx.LANGUAGE_CHINESE_SIMPLIFIED, - "de": wx.LANGUAGE_GERMAN - } + supLang = LocaleSettings.supported_langauges # If an unsupported language is requested default to English. if lang in supLang: diff --git a/pyfa.py b/pyfa.py index 7b7252452..ea895a03f 100755 --- a/pyfa.py +++ b/pyfa.py @@ -74,7 +74,7 @@ parser.add_option("-s", "--savepath", action="store", dest="savepath", help="Set parser.add_option("-l", "--logginglevel", action="store", dest="logginglevel", help="Set desired logging level [Critical|Error|Warning|Info|Debug]", default="Error") parser.add_option("-p", "--profile", action="store", dest="profile_path", help="Set location to save profileing.", default=None) -parser.add_option("-i", "--language", action="store", dest="language", help="Set the language for pyfa", default="en_US") +parser.add_option("-i", "--language", action="store", dest="language", help="Set the language for pyfa", default=None) (options, args) = parser.parse_args() diff --git a/service/settings.py b/service/settings.py index 9f9d043bf..c6e498973 100644 --- a/service/settings.py +++ b/service/settings.py @@ -539,6 +539,12 @@ class GraphSettings: class LocaleSettings: _instance = None + supported_langauges = { + "en_US": wx.LANGUAGE_ENGLISH, + "zh_CN": wx.LANGUAGE_CHINESE_SIMPLIFIED, + # todo: add the others that EVE supports + } + @classmethod def getInstance(cls): if cls._instance is None: @@ -548,7 +554,7 @@ class LocaleSettings: def __init__(self): defaults = { - 'locale': wx.LANGUAGE_DEFAULT + 'locale': "en_US" } self.settings = SettingsProvider.getInstance().getSettings('localeSettings', defaults)