| 1 | qtPrepareTool(LCONVERT, lconvert)
|
|---|
| 2 | qtPrepareTool(LUPDATE, lupdate)
|
|---|
| 3 | LUPDATE += -locations relative -no-ui-lines
|
|---|
| 4 |
|
|---|
| 5 | TS_TARGETS =
|
|---|
| 6 |
|
|---|
| 7 | # meta target name, target name, lupdate base options, files
|
|---|
| 8 | defineTest(addTsTarget) {
|
|---|
| 9 | cv = $${2}.commands
|
|---|
| 10 | $$cv = cd $$QT_SOURCE_TREE/src && $$LUPDATE $$3 -ts $$4
|
|---|
| 11 | export($$cv)
|
|---|
| 12 | dv = $${1}.depends
|
|---|
| 13 | $$dv += $$2
|
|---|
| 14 | export($$dv)
|
|---|
| 15 | TS_TARGETS += $$1 $$2
|
|---|
| 16 | export(TS_TARGETS)
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | # target basename, lupdate base options
|
|---|
| 20 | defineTest(addTsTargets) {
|
|---|
| 21 | files = $$files($$PWD/$${1}_??.ts) $$files($$PWD/$${1}_??_??.ts)
|
|---|
| 22 | for(file, files) {
|
|---|
| 23 | lang = $$replace(file, .*_((.._)?..)\\.ts$, \\1)
|
|---|
| 24 | addTsTarget(ts-$$lang, ts-$$1-$$lang, $$2, $$file)
|
|---|
| 25 | }
|
|---|
| 26 | addTsTarget(ts-untranslated, ts-$$1-untranslated, $$2, $$PWD/$${1}_untranslated.ts)
|
|---|
| 27 | addTsTarget(ts-all, ts-$$1-all, $$2, $$PWD/$${1}_untranslated.ts $$files)
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | addTsTargets(qt, -I../include -I../include/Qt \
|
|---|
| 31 | 3rdparty/phonon \
|
|---|
| 32 | 3rdparty/webkit \
|
|---|
| 33 | activeqt \
|
|---|
| 34 | corelib \
|
|---|
| 35 | declarative \
|
|---|
| 36 | gui \
|
|---|
| 37 | multimedia \
|
|---|
| 38 | network \
|
|---|
| 39 | opengl \
|
|---|
| 40 | plugins \
|
|---|
| 41 | qt3support \
|
|---|
| 42 | script \
|
|---|
| 43 | scripttools \
|
|---|
| 44 | sql \
|
|---|
| 45 | svg \
|
|---|
| 46 | xml \
|
|---|
| 47 | xmlpatterns \
|
|---|
| 48 | )
|
|---|
| 49 | addTsTargets(designer, ../tools/designer/designer.pro)
|
|---|
| 50 | addTsTargets(linguist, ../tools/linguist/linguist.pro)
|
|---|
| 51 | addTsTargets(assistant, ../tools/assistant/tools/tools.pro)
|
|---|
| 52 | addTsTargets(qt_help, ../tools/assistant/lib/lib.pro)
|
|---|
| 53 | addTsTargets(qtconfig, ../tools/qtconfig/qtconfig.pro)
|
|---|
| 54 | addTsTargets(qvfb, ../tools/qvfb/qvfb.pro)
|
|---|
| 55 |
|
|---|
| 56 | check-ts.commands = (cd $$PWD && perl check-ts.pl)
|
|---|
| 57 | check-ts.depends = ts-all
|
|---|
| 58 |
|
|---|
| 59 | isEqual(QMAKE_DIR_SEP, /) {
|
|---|
| 60 | commit-ts.commands = \
|
|---|
| 61 | cd $$PWD/..; \
|
|---|
| 62 | for f in `git diff-files --name-only translations/*_??.ts`; do \
|
|---|
| 63 | $$LCONVERT -locations none -i \$\$f -o \$\$f; \
|
|---|
| 64 | done; \
|
|---|
| 65 | git add translations/*_??.ts && git commit
|
|---|
| 66 | } else {
|
|---|
| 67 | wd = $$replace(PWD, /, \\)\\..
|
|---|
| 68 | commit-ts.commands = \
|
|---|
| 69 | cd $$wd && \
|
|---|
| 70 | for /f usebackq %%f in (`git diff-files --name-only translations/*_??.ts`) do \
|
|---|
| 71 | $$LCONVERT -locations none -i %%f -o %%f $$escape_expand(\\n\\t) \
|
|---|
| 72 | cd $$wd && git add translations/*_??.ts && git commit
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|
| 75 | ts.commands = \
|
|---|
| 76 | @echo \"The \'ts\' target has been removed in favor of more fine-grained targets.\" && \
|
|---|
| 77 | echo \"Use \'ts-<target>-<lang>\' or \'ts-<lang>\' instead. To add a language,\" && \
|
|---|
| 78 | echo \"use \'untranslated\' for <lang>, rename the files and re-run \'qmake\'.\"
|
|---|
| 79 |
|
|---|
| 80 | QMAKE_EXTRA_TARGETS += $$unique(TS_TARGETS) ts commit-ts check-ts
|
|---|