PySide/PyQt : loading Chinese language translator file (zh_CN.ts) ?
-
Hi All,
Can any one tell me how to load Chinese language translator file (zh_CN.ts) with an exmple code .Please tell me what's wrong with this code and what needs to be done to get it work?
would appreciate if any one could help meto slove this problem,thanks in advance.
@
from PySide import QtCore, QtGui
import sysclass MainWindow(QtGui.QMainWindow):
def init(self,app,parent=None):
QtGui.QMainWindow.init(self,parent)
filelbl = QtGui.QLabel(self)
filelbl.setText(self.tr("&File"))
self.setCentralWidget(filelbl)
self.setWindowTitle(self.tr("&File"))def main(args):
app = QtGui.QApplication(args)
translator = QtCore.QTranslator()
translator.load("zh_CN.ts")
app.installTranslator(translator)win=MainWindow(app) win.show() return app.exec_()
if name=="main":
main(sys.argv)zh_CN.ts file:
<!DOCTYPE TS>
<TS version="2.0" language="zh_CN">
<context>
<name>MainWindow</name>
<message>
<source>&File</source>
<translation>文件(F)</translation>
</message>
</context>
</TS>
@
thanks in advance.