Commit 86d9b94b authored by Wolfgang Rohdewald's avatar Wolfgang Rohdewald
Browse files

cache result of MLocale.availableLanguages

parent 360ea4fb
......@@ -171,6 +171,8 @@ class KDETranslator(QTranslator):
class MLocale:
"""xxxx"""
__cached_availableLanguages = None
@classmethod
def initStatic(cls):
"""init class attributes"""
......@@ -252,6 +254,8 @@ class MLocale:
@classmethod
def availableLanguages(cls):
"""see python lib, getdefaultlocale (which only returns the first one)"""
if cls.__cached_availableLanguages:
return cls.__cached_availableLanguages
localenames = cls.get_localenames()
languages = list()
for _ in localenames:
......@@ -274,7 +278,8 @@ class MLocale:
languages.extend(['en_US', 'en'])
if Debug.i18n:
Internal.logger.debug('languages available: %s', ':'.join(languages) if languages else None)
return ':'.join(languages)
cls.__cached_availableLanguages = ':'.join(languages)
return cls.__cached_availableLanguages
@classmethod
def availableLanguages_(cls):
......
Markdown is supported
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