1 defineReplace(prependAll) { |
1 qtPrepareTool(LCONVERT, lconvert) |
2 prepend = $$1 |
|
3 arglist = $$2 |
|
4 append = $$3 |
|
5 for(a,arglist) { |
|
6 result += $${prepend}$${a}$${append} |
|
7 } |
|
8 return ($$result) |
|
9 } |
|
10 |
|
11 qtPrepareTool(LUPDATE, lupdate) |
2 qtPrepareTool(LUPDATE, lupdate) |
12 LUPDATE += -locations relative -no-ui-lines |
3 LUPDATE += -locations relative -no-ui-lines |
13 |
4 |
14 ###### Qt Libraries |
5 TS_TARGETS = |
15 |
6 |
16 QT_TS = ar cs da de es fr he hu ja_JP pl pt ru sk sl sv uk zh_CN zh_TW |
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 } |
17 |
18 |
18 ts-qt.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ |
19 # target basename, lupdate base options |
19 -I../include -I../include/Qt \ |
20 defineTest(addTsTargets) { |
20 3rdparty/phonon \ |
21 files = $$files($$PWD/$${1}_??.ts) $$files($$PWD/$${1}_??_??.ts) |
21 3rdparty/webkit \ |
22 for(file, files) { |
22 activeqt \ |
23 lang = $$replace(file, .*_((.._)?..)\\.ts$, \\1) |
23 corelib \ |
24 addTsTarget(ts-$$lang, ts-$$1-$$lang, $$2, $$file) |
24 declarative \ |
25 } |
25 gui \ |
26 addTsTarget(ts-untranslated, ts-$$1-untranslated, $$2, $$PWD/$${1}_untranslated.ts) |
26 multimedia \ |
27 addTsTarget(ts-all, ts-$$1-all, $$2, $$PWD/$${1}_untranslated.ts $$files) |
27 network \ |
28 } |
28 opengl \ |
|
29 plugins \ |
|
30 qt3support \ |
|
31 script \ |
|
32 scripttools \ |
|
33 sql \ |
|
34 svg \ |
|
35 xml \ |
|
36 xmlpatterns \ |
|
37 -ts $$prependAll($$QT_SOURCE_TREE/translations/qt_,$$QT_TS,.ts)) |
|
38 ts-qt.depends = sub-tools |
|
39 |
29 |
40 ###### Designer |
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/linguist.pro) |
|
51 addTsTargets(assistant, ../tools/assistant/tools/assistant/assistant.pro) |
|
52 addTsTargets(qt_help, ../tools/assistant/lib/lib.pro) |
|
53 addTsTargets(qtconfig, ../tools/qtconfig/qtconfig.pro) |
|
54 addTsTargets(qvfb, ../tools/qvfb/qvfb.pro) |
41 |
55 |
42 ts-designer.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ |
56 check-ts.commands = (cd $$PWD && perl check-ts.pl) |
43 ../tools/designer/translations/translations.pro) |
57 check-ts.depends = ts-all |
44 ts-designer.depends = sub-tools |
|
45 |
58 |
46 ###### Linguist |
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 } |
47 |
74 |
48 ts-linguist.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ |
75 ts.commands = \ |
49 ../tools/linguist/linguist/linguist.pro) |
76 @echo \"The \'ts\' target has been removed in favor of more fine-grained targets.\" && \ |
50 ts-linguist.depends = sub-tools |
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\'.\" |
51 |
79 |
52 ###### Assistant |
80 QMAKE_EXTRA_TARGETS += $$unique(TS_TARGETS) ts commit-ts check-ts |
53 |
|
54 ts-assistant.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ |
|
55 ../tools/assistant/translations/translations.pro \ |
|
56 && $$LUPDATE \ |
|
57 ../tools/assistant/translations/qt_help.pro) |
|
58 ts-assistant.depends = sub-tools |
|
59 |
|
60 ###### Qtconfig |
|
61 |
|
62 ts-qtconfig.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ |
|
63 ../tools/qtconfig/translations/translations.pro) |
|
64 ts-qtconfig.depends = sub-tools |
|
65 |
|
66 ###### Qvfp |
|
67 |
|
68 ts-qvfb.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ |
|
69 ../tools/qvfb/translations/translations.pro) |
|
70 ts-qvfb.depends = sub-tools |
|
71 |
|
72 ###### Overall Rules |
|
73 |
|
74 ts.depends = ts-qt ts-designer ts-linguist ts-assistant ts-qtconfig ts-qvfb |
|
75 |
|
76 QMAKE_EXTRA_TARGETS += ts-qt ts-designer ts-linguist ts-assistant ts-qtconfig ts-qvfb \ |
|
77 ts |
|