py3: Draft: python3 translate

This commit is contained in:
looooo
2017-01-28 22:27:45 +01:00
committed by wmayer
parent 2deaf4f2f2
commit 8165b2ab85

View File

@@ -78,11 +78,17 @@ try:
_encoding = QtGui.QApplication.UnicodeUTF8
def translate(context, text):
"convenience function for Qt translator"
return QtGui.QApplication.translate(context, text, None, _encoding).encode("utf8")
if sys.version_info.major >= 3:
return QtGui.QApplication.translate(context, text, None, _encoding)
else:
return QtGui.QApplication.translate(context, text, None, _encoding).encode("utf8")
except AttributeError:
def translate(context, text):
"convenience function for Qt translator"
return QtGui.QApplication.translate(context, text, None).encode("utf8")
if sys.version >= 3:
return QtGui.QApplication.translate(context, text, None)
else:
return QtGui.QApplication.translate(context, text, None).encode("utf8")
def msg(text=None,mode=None):
"prints the given message on the FreeCAD status bar"