2018-11-20 01:49:09 +08:00
|
|
|
#Python3
|
2018-11-29 04:56:33 +08:00
|
|
|
#Language code by sTiKyt
|
|
|
|
import sys
|
2018-11-20 01:49:09 +08:00
|
|
|
import gettext
|
|
|
|
from Defs.Configurations import readConfig
|
|
|
|
|
2018-11-30 07:20:52 +08:00
|
|
|
def installGetText():
|
|
|
|
gettext.install('hiddeneye', './locale')
|
|
|
|
|
2018-11-20 01:49:09 +08:00
|
|
|
def langRussian():
|
|
|
|
ru = gettext.translation('hiddeneye',localedir='./locale', languages=['ru'])
|
|
|
|
ru.install()
|
|
|
|
|
|
|
|
def langUkrainian():
|
|
|
|
uk = gettext.translation('hiddeneye',localedir='./locale', languages=['uk'])
|
|
|
|
uk.install()
|
|
|
|
|
2019-03-16 06:34:42 +08:00
|
|
|
def langSpanish():
|
2019-03-17 06:43:44 +08:00
|
|
|
"""Install Spanish Language."""
|
2019-03-16 06:34:42 +08:00
|
|
|
es = gettext.translation('hiddeneye',localedir='./locale', languages=['es'])
|
|
|
|
es.install()
|
|
|
|
|
2018-11-20 01:49:09 +08:00
|
|
|
def langEnglish():
|
|
|
|
en = gettext.translation('hiddeneye',localedir='./locale', languages=['en'])
|
|
|
|
en.install()
|
|
|
|
|
2019-10-25 21:32:42 +08:00
|
|
|
def langItalian():
|
|
|
|
it = gettext.translation('hiddeneye',localedir='./locale', languages=['it'])
|
2018-11-20 01:49:09 +08:00
|
|
|
|
|
|
|
def checkAndSetLanguage():
|
|
|
|
language = readConfig().get("Settings", "Language")
|
|
|
|
|
|
|
|
if language == "en":
|
|
|
|
langEnglish()
|
|
|
|
elif language == "ru":
|
|
|
|
langRussian()
|
|
|
|
elif language == "uk":
|
|
|
|
langUkrainian()
|
2019-03-16 06:34:42 +08:00
|
|
|
elif language == "es":
|
|
|
|
langSpanish()
|
2019-10-25 21:32:42 +08:00
|
|
|
elif language == "it":
|
|
|
|
langItalian()
|
2018-11-20 01:49:09 +08:00
|
|
|
else:
|
|
|
|
langEnglish()
|
2018-11-29 04:56:33 +08:00
|
|
|
|
|
|
|
|
|
|
|
def languageSelector():
|
|
|
|
for arg in sys.argv:
|
|
|
|
if arg in ["--language", "--lang"]:
|
|
|
|
for arg in sys.argv:
|
|
|
|
if arg in ["ru", "russian", "ru_RU"]:
|
|
|
|
langRussian()
|
|
|
|
elif arg in["en", "eng", "english", "en_UK", "en_US"]:
|
|
|
|
langEnglish()
|
|
|
|
elif arg in["uk", "ukraine", "ukrainian", "uk_UA"]:
|
|
|
|
langUkrainian()
|
2019-03-16 06:34:42 +08:00
|
|
|
elif arg in["es", "spain", "spanish", "es_ES"]:
|
|
|
|
langSpanish()
|
2019-10-25 21:32:42 +08:00
|
|
|
elif arg in["it", "italia", "italiano", "it_IT"]:
|
|
|
|
langItalian()
|
2018-11-29 04:56:33 +08:00
|
|
|
else:
|
|
|
|
exit
|