2018-01-24 17:43:35 -06:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import os
|
|
|
|
import gettext
|
|
|
|
import locale
|
2018-03-12 09:27:03 -06:00
|
|
|
import sys
|
2018-03-12 10:02:18 -06:00
|
|
|
import logging
|
2018-07-15 09:15:05 -05:00
|
|
|
import paths
|
2018-01-24 17:43:35 -06:00
|
|
|
|
2018-03-12 10:02:18 -06:00
|
|
|
log = logging.getLogger("i18n")
|
|
|
|
|
2018-01-24 17:43:35 -06:00
|
|
|
def setup():
|
2018-02-27 13:41:18 -06:00
|
|
|
lang = locale.getdefaultlocale()[0]
|
|
|
|
os.environ["lang"] = lang
|
2018-03-12 10:02:18 -06:00
|
|
|
log.debug("System detected language: {0}".format(lang,))
|
2018-03-12 09:27:03 -06:00
|
|
|
if sys.version[0] == "3":
|
|
|
|
gettext.install("musicdl", localedir=os.path.join(paths.app_path(), "locales"))
|
|
|
|
else:
|
|
|
|
gettext.install("musicdl", localedir=os.path.join(paths.app_path(), "locales"), unicode=True)
|