Permalink
Browse files

add Qt framework translate zh_CN file and one build step for move qm …

…files to destDir
  • Loading branch information...
1 parent 89054a7 commit 2e48e099c261cffd65600490077387b492291f5f @iptton iptton committed May 29, 2012
Showing with 17 additions and 3 deletions.
  1. +3 −1 Rythem.pro
  2. +4 −0 deploy.txt
  3. +10 −2 main.cpp
  4. BIN qt_zh_CN.qm
View
@@ -140,7 +140,9 @@ OTHER_FILES += \
logo.rc \
remove.png \
rythem_zh_CN.ts \
- rythem_zh_CN.qm
+ rythem_zh_CN.qm \
+ deploy.txt \
+ qt_zh_CN.qm
CONFIG(release){
#DEFINES += DEBUGTOFILE
#message("debug")
View
@@ -0,0 +1,4 @@
+#!/bin/sh
+pwd
+cp $1/qt_zh_CN.qm $2/Rythem.app/Contents/MacOS/
+cp $1/rythem_zh_CN.qm $2/Rythem.app/Contents/MacOS/
View
@@ -55,12 +55,20 @@ int main(int argc, char *argv[])
a.setQuitOnLastWindowClosed(false);
appPath = qApp->applicationDirPath();
+ QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8"));
+
+ // load app translate file
QTranslator translator;
bool isLoadSuccess = translator.load(appPath+"/rythem_zh_CN");
- if(!isLoadSuccess)qDebug()<<"error";
- QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8"));
+ if(!isLoadSuccess)qDebug()<<" load language error";
a.installTranslator(&translator);
+ // load system translate file
+ QTranslator translator2;
+ translator2.load(appPath+"/qt_zh_CN");
+ a.installTranslator(&translator2);
+
+
#ifdef DEBUGTOFILE
qInstallMsgHandler(myMessageHandler);
#endif
View
Binary file not shown.

0 comments on commit 2e48e09

Please sign in to comment.