Locale for non-QT UI strings

Some parts of strings did not use the proper locale. For example, date
and time strings was always output with the US locale. This fixes it.
There are still some cases where localisation is not implemented, and
could be changed from str(string) to locale.str(string).
This commit is contained in:
Peter Šurda 2016-04-25 18:14:42 +02:00
parent 0507411696
commit af098e4805

View File

@ -44,6 +44,7 @@ from about import *
from help import * from help import *
from iconglossary import * from iconglossary import *
from connect import * from connect import *
import locale as pythonlocale
import sys import sys
from time import strftime, localtime, gmtime from time import strftime, localtime, gmtime
import time import time
@ -99,6 +100,17 @@ def change_translation(locale):
qsystranslator.load(translationpath) qsystranslator.load(translationpath)
QtGui.QApplication.installTranslator(qsystranslator) QtGui.QApplication.installTranslator(qsystranslator)
lang = l10n.getTranslationLanguage()
if "_" not in lang:
lang += "_" + lang.upper()
if ".utf8" not in lang.lower():
lang += ".utf8"
try:
pythonlocale.setlocale(pythonlocale.LC_ALL, lang)
except:
logger.error("Failed to set locale to %s", lang)
pass
class MyForm(settingsmixin.SMainWindow): class MyForm(settingsmixin.SMainWindow):
# sound type constants # sound type constants