[Uludag-commits] r16275 - in branches: yali-qt4 yali4

uludag-commits at pardus.org.tr uludag-commits at pardus.org.tr
10 Ara 2007 Pzt 11:59:49 EET


Author: gokmen.goksel
Date: Mon Dec 10 11:59:48 2007
New Revision: 16275

Added:
   branches/yali-qt4/convertGetText.py   (contents, props changed)
Modified:
   branches/yali4/setup.py
Log:
Better than ..

Modified: branches/yali4/setup.py
=================================================================
--- branches/yali4/setup.py	(original)
+++ branches/yali4/setup.py	Mon Dec 10 11:59:48 2007
@@ -75,21 +75,22 @@
 
         py_file = py_file_name(ui_file)
         # lines in reverse order
-        lines =  ["_ = __trans.ugettext",
-                 "__trans = gettext.translation('yali4', fallback=True)\n",
-                 "import gettext\n"]
+        lines =  ["\n_ = __trans.ugettext\n",
+                  "\n__trans = gettext.translation('yali4', fallback=True)",
+                  "\nimport gettext"]
         f = open(py_file, "r").readlines()
         for l in lines:
             f.insert(1, l)
         x = open(py_file, "w")
-        keyword = "QtGui.QApplication.translate"
-        # FIXME its not suitable..
+        keyStart = "QtGui.QApplication.translate"
+        keyEnd = ", None, QtGui.QApplication.UnicodeUTF8)"
         for l in f:
-            if not l.find(keyword)==-1:
-                core = l[l.find(keyword):-1]
-                text = core.split(',')[1].strip()
-                l = l.replace(core,"_(%s)" % text)
-            x.write(l)
+            if not l.find(keyStart)==-1:
+                z = "%s(_(" % l.split("(")[0]
+                y = l.split(",")[0]+', '
+                l = l.replace(y,z)
+            l = l.replace(keyEnd,")")
+        x.write(l)
 
     def compile_ui(self, ui_file):
         pyqt_configuration = pyqtconfig.Configuration()


Uludag-commits mesaj listesiyle ilgili daha fazla bilgi