1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import division, print_function
# Python 2.7
from PyQt4 import QtCore, QtGui
# pour envelopper les chaines à traduire par tr() et trUtf8()
#############################################################################
class Traduc(QtCore.QObject):
def __init__(self): QtCore.QObject.__init__(self)
def __call__(self, texte, disambig=None, n=-1):
return QtGui.QApplication.translate("@default", texte, disambig,
QtGui.QApplication.CodecForTr, n)
tr = Traduc()
#############################################################################
class TraducUtf8(QtCore.QObject):
def __init__(self): QtCore.QObject.__init__(self)
def __call__(self, texte, disambig=None, n=-1):
return QtGui.QApplication.translate("@default", texte, disambig,
QtGui.QApplication.UnicodeUTF8, n)
trUtf8 = TraducUtf8() |
Partager