4
0
mirror of https://github.com/QuasarApp/installer-framework.git synced 2025-05-10 03:59:32 +00:00

move ts targets to a separate project file

that makes it possible to update the templates even if the ifw itself
cannot be built (e.g., due to using a -no-widgets qt build).

Change-Id: Ie170e6524dbed40f6c8b837e35af6b45a1c2d2dd
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
This commit is contained in:
Oswald Buddenhagen 2018-02-08 19:41:40 +01:00
parent 4f1e3f8e04
commit 5ec8531696
4 changed files with 43 additions and 35 deletions

@ -30,38 +30,6 @@ exists($$LRELEASE) {
IB_TRANSLATIONS = $$files($$PWD/translations/*_??.ts)
IB_TRANSLATIONS -= $$PWD/translations/ifw_en.ts
wd = $$toNativeSeparators($$IFW_SOURCE_TREE)
sources = src
lupdate_opts = -locations relative -no-ui-lines -no-sort
IB_ALL_TRANSLATIONS = $$IB_TRANSLATIONS $$PWD/translations/ifw_untranslated.ts
for(file, IB_ALL_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_ALL_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
empty_ts = "<TS></TS>"
write_file($$OUT_PWD/translations/ifw_en.ts, empty_ts)|error("Aborting.")
IB_TRANSLATIONS += $$OUT_PWD/translations/ifw_en.ts

@ -2,9 +2,9 @@ You need to have a Qt translation for your new language,
otherwise your language won't be loaded at runtime.
To add a new language:
1) Run 'cd src/sdk' (change to the parent directory of this file)
1) Run 'cd src/sdk/translations' (change to the parent directory of this file)
2) Run 'make ts-untranslated'
3) Rename translations/ifw_untranslated.ts to translations/ifw_<lang>.ts
3) Rename ifw_untranslated.ts to ifw_<lang>.ts
4) Run 'make qmake'
5) Do your translation. Just run 'make' whenever you want to test it.
6) Run 'make commit-ts'

@ -0,0 +1,40 @@
TEMPLATE = aux
include(../../../installerfw.pri)
!exists($$LUPDATE): return()
IB_TRANSLATIONS = $$files($$PWD/*_??.ts)
IB_TRANSLATIONS -= $$PWD/ifw_en.ts
wd = $$toNativeSeparators($$IFW_SOURCE_TREE)
sources = src
lupdate_opts = -locations relative -no-ui-lines -no-sort
IB_ALL_TRANSLATIONS = $$IB_TRANSLATIONS $$PWD/ifw_untranslated.ts
for(file, IB_ALL_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_ALL_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

@ -1,3 +1,3 @@
TEMPLATE = subdirs
SUBDIRS += libs sdk
SUBDIRS += libs sdk sdk/translations
sdk.depends = libs