Move supported languages to the LocaleSettings class, and use the command parameter as an override

This commit is contained in:
blitzmann
2020-06-19 22:44:09 -04:00
parent d939b0e565
commit d9e5349edd
3 changed files with 12 additions and 8 deletions

View File

@@ -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: