From d04c93134ad3daaee0ca280824ab3288bfc5029c Mon Sep 17 00:00:00 2001 From: kali Date: Fri, 16 Nov 2012 22:59:16 +0900 Subject: initial translation example. --- src/leap/app.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/leap/app.py') diff --git a/src/leap/app.py b/src/leap/app.py index d594c7cd..334b58c8 100644 --- a/src/leap/app.py +++ b/src/leap/app.py @@ -8,10 +8,11 @@ import sip sip.setapi('QVariant', 2) sip.setapi('QString', 2) from PyQt4.QtGui import (QApplication, QSystemTrayIcon, QMessageBox) -from PyQt4.QtCore import QTimer +from PyQt4 import QtCore from leap import __version__ as VERSION from leap.baseapp.mainwindow import LeapWindow +from leap.gui import locale_rc def sigint_handler(*args, **kwargs): @@ -62,6 +63,17 @@ def main(): logger.info('Starting app') app = QApplication(sys.argv) + # To test: + # $ LANG=es ./app.py + locale = QtCore.QLocale.system().name() + print locale + qtTranslator = QtCore.QTranslator() + if qtTranslator.load("qt_%s" % locale, ":/translations"): + app.installTranslator(qtTranslator) + appTranslator = QtCore.QTranslator() + if appTranslator.load("leap_client_%s" % locale, ":/translations"): + app.installTranslator(appTranslator) + # needed for initializing qsettings # it will write .config/leap/leap.conf # top level app settings @@ -83,7 +95,7 @@ def main(): # this dummy timer ensures that # control is given to the outside loop, so we # can hook our sigint handler. - timer = QTimer() + timer = QtCore.QTimer() timer.start(500) timer.timeout.connect(lambda: None) -- cgit v1.2.3