twblue/src/mysc/localization.py

19 lines
586 B
Python
Raw Normal View History

2019-06-06 11:52:23 -05:00
from __future__ import unicode_literals
2015-01-08 08:01:45 -06:00
import os
import languageHandler
2015-01-18 17:19:39 -06:00
import logging
log = logging.getLogger("mysc.localization")
def get(rootFolder):
log.debug("Getting documentation folder. RootFolder: %s" % (rootFolder,))
defaultLocale = languageHandler.curLang
if len(defaultLocale) > 2:
defaultLocale = defaultLocale[:2]
log.debug("Locale: %s" % (defaultLocale,))
if os.path.exists(rootFolder+"/"+defaultLocale):
return defaultLocale
else:
log.debug("The folder does not exist, using the English folder...")
return "en"