From 038001bda0cf06e32678a7fb546b7789265c65de Mon Sep 17 00:00:00 2001 From: Takumi Asaki Date: Mon, 27 Jan 2014 15:02:13 +0900 Subject: Add ts-, ts-all, commit-ts rules for translations Add ts-, ts-all, commit-ts rules to src/sdk/sdk.pro for translator's convenience. Change-Id: Ie75641870e78b78f4db04ec9c7e4460b86d079c8 Reviewed-by: Oswald Buddenhagen --- installerfw.pri | 12 +++++++++--- src/sdk/sdk.pro | 31 +++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/installerfw.pri b/installerfw.pri index c71749db2..28caf4000 100644 --- a/installerfw.pri +++ b/installerfw.pri @@ -41,11 +41,17 @@ IFW_LIB_PATH = $$IFW_BUILD_TREE/lib RCC = $$toNativeSeparators($$cleanPath($$[QT_INSTALL_BINS]/rcc)) LRELEASE = $$toNativeSeparators($$cleanPath($$[QT_INSTALL_BINS]/lrelease)) +LUPDATE = $$toNativeSeparators($$cleanPath($$[QT_INSTALL_BINS]/lupdate)) +LCONVERT = $$toNativeSeparators($$cleanPath($$[QT_INSTALL_BINS]/lconvert)) QMAKE_BINARY = $$toNativeSeparators($$cleanPath($$[QT_INSTALL_BINS]/qmake)) -win32:RCC = $${RCC}.exe -win32:LRELEASE = $${LRELEASE}.exe -win32:QMAKE_BINARY = $${QMAKE_BINARY}.exe +win32 { + RCC = $${RCC}.exe + LRELEASE = $${LRELEASE}.exe + LUPDATE = $${LUPDATE}.exe + LCONVERT = $${LCONVERT}.exe + QMAKE_BINARY = $${QMAKE_BINARY}.exe +} win32-g++*:QMAKE_CXXFLAGS += -Wno-attributes INCLUDEPATH += \ diff --git a/src/sdk/sdk.pro b/src/sdk/sdk.pro index 2f57994f0..67fd77f2a 100644 --- a/src/sdk/sdk.pro +++ b/src/sdk/sdk.pro @@ -31,6 +31,37 @@ exists($$LRELEASE) { IB_TRANSLATIONS = $$prependAll(IB_LANGUAGES, $$PWD/translations/,.ts) QT_TRANSLATIONS = $$prependAll(QT_LANGUAGES, $$[QT_INSTALL_TRANSLATIONS]/,.ts) + wd = $$toNativeSeparators($$IFW_SOURCE_TREE) + sources = src + lupdate_opts = -locations relative -no-ui-lines -no-sort + + for(file, IB_TRANSLATIONS) { + lang = $$replace(file, .*/([^/]*)\\.ts, \\1) + v = ts-$${lang}.commands + $$v = cd $$wd && $$LUPDATE $$lupdate_opts $$sources -ts $$file + QMAKE_EXTRA_TARGETS += ts-$$lang + } + ts-all.commands = cd $$wd && $$LUPDATE $$lupdate_opts $$sources -ts $$IB_TRANSLATIONS + QMAKE_EXTRA_TARGETS += ts-all + + isEqual(QMAKE_DIR_SEP, /) { + commit-ts.commands = \ + cd $$wd; \ + git add -N src/sdk/translations/*_??.ts && \ + for f in `git diff-files --name-only src/sdk/translations/*_??.ts`; do \ + $$LCONVERT -locations none -i \$\$f -o \$\$f; \ + done; \ + git add src/sdk/translations/*_??.ts && git commit + } else { + commit-ts.commands = \ + cd $$wd && \ + git add -N src/sdk/translations/*_??.ts && \ + for /f usebackq %%f in (`git diff-files --name-only src/sdk/translations/*_??.ts`) do \ + $$LCONVERT -locations none -i %%f -o %%f $$escape_expand(\\n\\t) \ + cd $$wd && git add src/sdk/translations/*_??.ts && git commit + } + QMAKE_EXTRA_TARGETS += commit-ts + if (!testFiles(QT_TRANSLATIONS)) { QT_COMPILED_TRANSLATIONS = $$prependAll(QT_LANGUAGES, $$[QT_INSTALL_TRANSLATIONS]/,.qm) if (testFiles(QT_COMPILED_TRANSLATIONS)) { -- cgit v1.2.3