v0.1.0
authorv13 <v13>
Sun, 28 Feb 2010 18:35:36 +0000 (18:35 +0000)
committerv13 <v13>
Sun, 28 Feb 2010 18:35:36 +0000 (18:35 +0000)
Use environment's locale instead of QT's

trunk/setup.py
trunk/src/config.py
trunk/src/win.py

index 425d633..c04d36f 100755 (executable)
@@ -26,7 +26,7 @@ i18n_qm_files=["i18n/maegirls_el.qm"]
 
 setup(
     name='maegirls',
-    version='0.1.0',
+    version='0.1.1',
     description="MaeGirls",
     author="Stefanos Harhalakis",
     author_email="v13@v13.gr",
index d835ae9..af11dad 100755 (executable)
@@ -28,7 +28,7 @@ import pickle
 import time
 import algo
 
-version="0.1.0"
+version="0.1.1"
 
 try:
     home=os.environ['HOME']
index 56a45be..c453dd4 100755 (executable)
@@ -27,6 +27,7 @@ from PyQt4.QtCore import *
 
 import sys
 import time
+import locale
 
 from graph import DaysGraph
 import config
@@ -443,14 +444,24 @@ def init(algo):
     # Create the application
     app=QApplication(sys.argv)
 
+    # This returns the country and *NOT* the required locale
+    # This means that if you have'set language==en_GB and countr==Greece
+    # it will return el_GR.
+    # IOW: If you want english messages this will not work
+    #loc=QLocale.system().name()
+
+    loc=locale.setlocale(locale.LC_MESSAGES, '')
+
+    print "loc:", loc
+
     # Load translations
     qttr=QTranslator()
-    qttr.load("qt_" + QLocale.system().name(),
+    qttr.load("qt_" + loc,
        QLibraryInfo.location(QLibraryInfo.TranslationsPath))
     app.installTranslator(qttr)
 
     maetr=QTranslator()
-    maetr.load("maegirls_" + QLocale.system().name(),
+    maetr.load("maegirls_" + loc,
        "/usr/share/maegirls/translations")
 
     # Install the translation