def __init__(self, locale_code):
"""
Initialize GetText
:param locale_code selected locale
"""
try:
filename = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'locale', '{}.mo'.format(locale_code))
trans = gettext.GNUTranslations(open(filename, "rb"))
logger.debug('{} Loaded'.format(filename))
except IOError:
logger.debug('Failed to found locale {}'.format(locale_code))
trans = gettext.NullTranslations()
trans.install()
评论列表
文章目录