因为是做测试的,所以窗口里只有一个标签,如图

window.open('http://www.qtcn.org/bbs/attachment/Mon_1101/50_87144_c8048c3a17ace89.png?3');" style="max-width:700px;max-height:700px;" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" >然后,我生成了ts文件, testLocale_zh_CN.ts内容如下:复制代码<?xml version="1.0" encoding="utf-8"?><!DOCTYPE TS><TS version="2.0" language="zh_CN"><context> <name>MainWindow</name> <message> <location filename="mainwindow.ui" line="14"/> <source>MainWindow</source> <translation>主窗口</translation> </message> <message> <location filename="mainwindow.ui" line="27"/> <source>hello, world</source> <translation>你好,世界</translation> </message></context></TS>然后用lrelease生成qm文件,main.cpp的代码如下:复制代码#include <QtGui/QApplication>#include <QTranslator>#include <QLocale>#include "mainwindow.h"int main(int argc, char *argv[]){ QApplication a(argc, argv); //QString locale = QLocale::system().name(); QTranslator translator; //translator.load(QString("testLocale_") + locale, "."); translator.load("testLocale_zh_CN.qm", "."); a.installTranslator(&translator); MainWindow w;#if defined(Q_WS_S60) w.showMaximized();#else w.show();#endif return a.exec();}程序运行之后,还是英文的没有变成中文=.=pro文件代码testLocale.pro复制代码#-------------------------------------------------## Project created by QtCreator 2011-01-11T17:53:16##-------------------------------------------------QT += core guiTARGET = testLocaleTEMPLATE = appSOURCES += main.cpp\ mainwindow.cppHEADERS += mainwindow.hTRANSLATIONS += testLocale_en.ts testLocale_zh_CN.tsFORMS += mainwindow.uiCONFIG += mobilityMOBILITY = symbian { TARGET.UID3 = 0xe7826dd9 # TARGET.CAPABILITY += TARGET.EPOCSTACKSIZE = 0x14000 TARGET.EPOCHEAPSIZE = 0x020000 0x800000}