From 59020408744664fde902406cf41de125859d461f Mon Sep 17 00:00:00 2001 From: Wladimir J. van der Laan Date: Tue, 27 Sep 2011 20:47:51 +0200 Subject: [PATCH] translation handling improvements - automatically build binary translation files in qmake/make - roll translations into resource file and executable, to simply installation --- bitcoin-qt.pro | 15 +++++++++++++++ src/qt/bitcoin.cpp | 2 +- src/qt/bitcoin.qrc | 5 +++++ 3 files changed, 21 insertions(+), 1 deletions(-) diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index 3fff9ac..eefef5a 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -168,10 +168,25 @@ FORMS += \ src/qt/forms/askpassphrasedialog.ui CODECFORTR = UTF-8 + # for lrelease/lupdate TRANSLATIONS = src/qt/locale/bitcoin_nl.ts src/qt/locale/bitcoin_de.ts \ src/qt/locale/bitcoin_ru.ts +isEmpty(QMAKE_LRELEASE) { + win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\lrelease.exe + else:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease +} +isEmpty(TS_DIR):TS_DIR = src/qt/locale +# automatically build translations, so they can be included in resource file +TSQM.name = lrelease ${QMAKE_FILE_IN} +TSQM.input = TRANSLATIONS +TSQM.output = $$TS_DIR/${QMAKE_FILE_BASE}.qm +TSQM.commands = $$QMAKE_LRELEASE ${QMAKE_FILE_IN} +TSQM.CONFIG = no_link +QMAKE_EXTRA_COMPILERS += TSQM +bPRE_TARGETDEPS += compiler_TSQM_make_all + OTHER_FILES += \ README.rst diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index daba512..60a9074 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) // Load language file for system locale QString locale = QLocale::system().name(); QTranslator translator; - translator.load("bitcoin_"+locale); + translator.load(":/translations/"+locale); app.installTranslator(&translator); QSplashScreen splash(QPixmap(":/images/splash"), 0); diff --git a/src/qt/bitcoin.qrc b/src/qt/bitcoin.qrc index be0e4dc..2985bb6 100644 --- a/src/qt/bitcoin.qrc +++ b/src/qt/bitcoin.qrc @@ -45,4 +45,9 @@ res/movies/update_spinner.mng + + locale/bitcoin_de.qm + locale/bitcoin_nl.qm + locale/bitcoin_ru.qm + -- 1.7.1