Commit e8c9a52f authored by Wolfgang Rohdewald's avatar Wolfgang Rohdewald
Browse files

move currentLanguages() from KGlobal to MLocale

parent 4830f6ed
......@@ -212,7 +212,7 @@ class KApplication(QApplication):
def initQtTranslator(self):
"""load translators using Qt .qm files"""
for language in reversed(list(MLocale.extendRegionLanguages(KGlobal.currentLanguages()))):
for language in reversed(list(MLocale.extendRegionLanguages(MLocale.currentLanguages()))):
self.installTranslatorFile(os.path.join(
QLibraryInfo.location(QLibraryInfo.TranslationsPath), 'qtbase_{}.qm'.format(language)))
self.installTranslatorFile('/usr/share/locale/{}/LC_MESSAGES/kwidgetsaddons5_qt.qm'.format(language))
......@@ -723,22 +723,11 @@ class KGlobal:
"""stub"""
@classmethod
def currentLanguages(cls):
"""the currently used languages, primary first"""
languages = Internal.kajonggrc.group('Locale').readEntry('Language')
if not languages:
return list()
languages = languages.split(':')
if 'en_US' in languages:
languages.remove('en_US')
return languages
@classmethod
def initStatic(cls):
"""init class members"""
Internal.kajonggrc = KConfig()
MLocale.installTranslations(cls.currentLanguages())
MLocale.installTranslations(MLocale.currentLanguages())
class KConfig(ConfigParser):
......
......@@ -218,6 +218,16 @@ class MLocale:
result.insert(0, LOCALEPATH)
return result
@classmethod
def currentLanguages(cls):
"""the currently used languages, primary first"""
languages = Internal.kajonggrc.group('Locale').readEntry('Language')
if not languages:
return list()
languages = languages.split(':')
if 'en_US' in languages:
languages.remove('en_US')
return languages
@staticmethod
def extendRegionLanguages(languages):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment