Browse Source

translation handling improvements

- automatically build binary translation files in qmake/make
- roll translations into resource file and executable, to simply installation
pull/1/head
Wladimir J. van der Laan 11 years ago
parent
commit
5902040874
  1. 15
      bitcoin-qt.pro
  2. 2
      src/qt/bitcoin.cpp
  3. 5
      src/qt/bitcoin.qrc

15
bitcoin-qt.pro

@ -168,10 +168,25 @@ FORMS += \ @@ -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

2
src/qt/bitcoin.cpp

@ -120,7 +120,7 @@ int main(int argc, char *argv[]) @@ -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);

5
src/qt/bitcoin.qrc

@ -45,4 +45,9 @@ @@ -45,4 +45,9 @@
<qresource prefix="/movies">
<file alias="update_spinner">res/movies/update_spinner.mng</file>
</qresource>
<qresource prefix="/translations">
<file alias="de_DE">locale/bitcoin_de.qm</file>
<file alias="nl_NL">locale/bitcoin_nl.qm</file>
<file alias="ru_RU">locale/bitcoin_ru.qm</file>
</qresource>
</RCC>

Loading…
Cancel
Save