diff options
author | kali <kali@leap.se> | 2012-11-16 22:59:16 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2012-12-20 02:51:18 +0900 |
commit | d04c93134ad3daaee0ca280824ab3288bfc5029c (patch) | |
tree | f00606c24c2efc7fcc15ec327d50a35a2a585572 /src/leap/app.py | |
parent | e98c3cc5fad75bea038dc67238e5ce85d701b1e1 (diff) |
initial translation example.
Diffstat (limited to 'src/leap/app.py')
-rw-r--r-- | src/leap/app.py | 16 |
1 files changed, 14 insertions, 2 deletions
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) |