Created
May 4, 2011 21:33
-
-
Save xenophy/956082 to your computer and use it in GitHub Desktop.
MacOS X translator in resource file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QtGui> | |
#include "mainwindow.h" | |
int main(int argc, char *argv[]) | |
{ | |
// コーデック設定 | |
QTextCodec::setCodecForTr(QTextCodec::codecForLocale()); | |
// アプリケーションオブジェクト生成 | |
QApplication app(argc, argv); | |
// 翻訳ファイル読み込み&インストール | |
QString displayLanguage = QLocale::system().name(); | |
QTranslator *translator = new QTranslator(&app); | |
translator->load(":/translations/yourapp_ja.pm"); | |
app.installTranslator(translator); | |
// メインウィンドウ生成 | |
MainWindow win; | |
// メインウィンドウ表示 | |
win.show(); | |
// アプリケーション実行 | |
return app.exec(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment