summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/frontend_app.py
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-09-16 10:09:44 -0300
committerTomás Touceda <chiiph@leap.se>2014-09-16 10:09:44 -0300
commitc3b2345dcc715f02fdfe4ffc04446236e17105a8 (patch)
tree736bbdaf787e5c4cff9d43a9b616a55e736a2930 /src/leap/bitmask/frontend_app.py
parent600596f074b9605a3aa68ef48ac80f75e3d66779 (diff)
parent719c472f23490dfe039327743f4553f600c799a9 (diff)
Merge remote-tracking branch 'refs/remotes/ivan/feature/6033_support-for-RTL-languages' into develop
Diffstat (limited to 'src/leap/bitmask/frontend_app.py')
-rw-r--r--src/leap/bitmask/frontend_app.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/leap/bitmask/frontend_app.py b/src/leap/bitmask/frontend_app.py
index 5ea89fc9..909005f0 100644
--- a/src/leap/bitmask/frontend_app.py
+++ b/src/leap/bitmask/frontend_app.py
@@ -76,15 +76,24 @@ def run_frontend(options, flags_dict, backend_pid):
qApp = QtGui.QApplication(sys.argv)
- # To test:
- # $ LANG=es ./app.py
- locale = QtCore.QLocale.system().name()
- qtTranslator = QtCore.QTranslator()
- if qtTranslator.load("qt_%s" % locale, ":/translations"):
- qApp.installTranslator(qtTranslator)
- appTranslator = QtCore.QTranslator()
- if appTranslator.load("%s.qm" % locale[:2], ":/translations"):
- qApp.installTranslator(appTranslator)
+ # To test the app in other language you can do:
+ # shell> LANG=es bitmask
+ # or in some rare case if the code above didn't work:
+ # shell> LC_ALL=es LANG=es bitmask
+ locale = QtCore.QLocale.system().name() # en_US, es_AR, ar_SA, etc
+ locale_short = locale[:2] # en, es, ar, etc
+ rtl_languages = ('ar', ) # right now tested on 'arabic' only.
+
+ systemQtTranslator = QtCore.QTranslator()
+ if systemQtTranslator.load("qt_%s" % locale, ":/translations"):
+ qApp.installTranslator(systemQtTranslator)
+
+ bitmaskQtTranslator = QtCore.QTranslator()
+ if bitmaskQtTranslator.load("%s.qm" % locale_short, ":/translations"):
+ qApp.installTranslator(bitmaskQtTranslator)
+
+ if locale_short in rtl_languages:
+ qApp.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft)
# Needed for initializing qsettings it will write
# .config/leap/leap.conf top level app settings in a platform