music-dl/src/i18n.py
Andre Polykanine 593ae5c925 Added paths resolver to the repository
Modified requirements file
2018-07-15 17:18:44 +03:00

18 lines
482 B
Python

# -*- coding: utf-8 -*-
import os
import gettext
import locale
import sys
import logging
import paths
log = logging.getLogger("i18n")
def setup():
lang = locale.getdefaultlocale()[0]
os.environ["lang"] = lang
log.debug("System detected language: {0}".format(lang,))
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)