Globals/__init__.py

changeset 4828
b313794f46a2
parent 4724
682f009d086d
child 5070
4e4651e88674
diff -r bbd2cc223fc7 -r b313794f46a2 Globals/__init__.py
--- a/Globals/__init__.py	Sun Feb 14 13:19:05 2016 +0100
+++ b/Globals/__init__.py	Wed Feb 17 22:11:12 2016 +0100
@@ -16,7 +16,8 @@
 import sys
 import os
 
-from PyQt5.QtCore import QDir, QLibraryInfo, QByteArray
+from PyQt5.QtCore import (QDir, QLibraryInfo, QByteArray,
+                          QCoreApplication, QT_VERSION_STR)
 
 # names of the various settings objects
 settingsNameOrganization = "Eric6"
@@ -204,6 +205,20 @@
     return QDir.toNativeSeparators(path)
 
 
+def translate(*args):
+    """
+    Module function to handle different PyQt 4/5 QCoreApplication.translate
+    parameter.
+    
+    @param args tuple of arguments from QCoreApplication.translate (tuple)
+    @return translated string (string)
+    """
+    if QT_VERSION_STR.startswith('4'):
+        args = list(args)
+        args.insert(3, QCoreApplication.CodecForTr)
+    return QCoreApplication.translate(*args)
+
+
 ###############################################################################
 ## functions for searching a Python2/3 interpreter
 ###############################################################################

eric ide

mercurial