translations.pro 4.89 KB
Newer Older
1
2
include(../../../qtcreator.pri)

3
LANGUAGES = cs de fr ja pl ru sl zh_CN zh_TW
4
5
# *don't* re-enable these without a prior rework
BAD_LANGUAGES = hu
6
7
8
9
10
11
12

# var, prepend, append
defineReplace(prependAll) {
    for(a,$$1):result += $$2$${a}$$3
    return($$result)
}

13
XMLPATTERNS = $$targetPath($$[QT_INSTALL_BINS]/xmlpatterns)
14
LUPDATE = $$targetPath($$[QT_INSTALL_BINS]/lupdate) -locations relative -no-ui-lines -no-sort
15
LRELEASE = $$targetPath($$[QT_INSTALL_BINS]/lrelease)
16
LCONVERT = $$targetPath($$[QT_INSTALL_BINS]/lconvert)
17

18
19
wd = $$replace(IDE_SOURCE_TREE, /, $$QMAKE_DIR_SEP)

20
TRANSLATIONS = $$prependAll(LANGUAGES, $$PWD/qtcreator_,.ts)
21

22
23
MIME_TR_H = $$OUT_PWD/mime_tr.h
CUSTOMWIZARD_TR_H = $$OUT_PWD/customwizard_tr.h
24
EXTERNALTOOLS_TR_H = $$OUT_PWD/externaltools_tr.h
25

26
for(dir, $$list($$files($$IDE_SOURCE_TREE/src/plugins/*))):MIMETYPES_FILES += $$files($$dir/*.mimetypes.xml)
27
MIMETYPES_FILES = \"$$join(MIMETYPES_FILES, |)\"
28
29

for(dir, $$list($$files($$IDE_SOURCE_TREE/share/qtcreator/templates/wizards/*))):CUSTOMWIZARD_FILES += $$files($$dir/wizard.xml)
30
CUSTOMWIZARD_FILES = \"$$join(CUSTOMWIZARD_FILES, |)\"
31

32
33
34
for(file, $$list($$files($$IDE_SOURCE_TREE/src/share/qtcreator/externaltools/*))):EXTERNALTOOLS_FILES += $$files($$file)
EXTERNALTOOLS_FILES = \"$$join(EXTERNALTOOLS_FILES, |)\"

35
extract.commands += \
36
    $$XMLPATTERNS -output $$MIME_TR_H -param files=$$MIMETYPES_FILES $$PWD/extract-mimetypes.xq $$escape_expand(\\n\\t) \
37
38
    $$XMLPATTERNS -output $$CUSTOMWIZARD_TR_H -param files=$$CUSTOMWIZARD_FILES $$PWD/extract-customwizards.xq $$escape_expand(\\n\\t) \
    $$XMLPATTERNS -output $$EXTERNALTOOLS_TR_H -param files=$$EXTERNALTOOLS_FILES $$PWD/extract-externaltools.xq
39
40
QMAKE_EXTRA_TARGETS += extract

41
plugin_sources = $$files($$IDE_SOURCE_TREE/src/plugins/*)
42
43
win32:plugin_sources ~= s,\\\\,/,g
plugin_sources ~= s,^$$re_escape($$IDE_SOURCE_TREE/),,g$$i_flag
44
45
46
47
48
49
plugin_sources -= src/plugins/plugins.pro \
    src/plugins/helloworld \ # just an example
    # the following ones are dead
    src/plugins/qtestlib \
    src/plugins/snippets \
    src/plugins/regexp
Daniel Molkentin's avatar
Daniel Molkentin committed
50
51
sources = src/app src/libs $$plugin_sources src/shared share/qtcreator/qmldesigner \
          share/qtcreator/welcomescreen share/qtcreator/welcomescreen/widgets
52

53
files = $$files($$PWD/*_??.ts) $$PWD/qtcreator_untranslated.ts
54
for(file, files) {
55
    lang = $$replace(file, .*_([^/]*)\\.ts, \\1)
56
    v = ts-$${lang}.commands
57
    $$v = cd $$wd && $$LUPDATE $$sources $$MIME_TR_H $$CUSTOMWIZARD_TR_H $$EXTERNALTOOLS_TR_H -ts $$file
58
59
60
61
    v = ts-$${lang}.depends
    $$v = extract
    QMAKE_EXTRA_TARGETS += ts-$$lang
}
62
ts-all.commands = cd $$wd && $$LUPDATE $$sources $$MIME_TR_H $$CUSTOMWIZARD_TR_H $$EXTERNALTOOLS_TR_H -ts $$files
63
64
65
ts-all.depends = extract
QMAKE_EXTRA_TARGETS += ts-all

66
check-ts.commands = (cd $$replace(PWD, /, $$QMAKE_DIR_SEP) && perl check-ts.pl)
67
68
69
check-ts.depends = ts-all
QMAKE_EXTRA_TARGETS += check-ts

70
71
isEqual(QMAKE_DIR_SEP, /) {
    commit-ts.commands = \
72
        cd $$wd; \
73
        git add -N share/qtcreator/translations/*_??.ts && \
74
75
76
77
78
79
80
        for f in `git diff-files --name-only share/qtcreator/translations/*_??.ts`; do \
            $$LCONVERT -locations none -i \$\$f -o \$\$f; \
        done; \
        git add share/qtcreator/translations/*_??.ts && git commit
} else {
    commit-ts.commands = \
        cd $$wd && \
81
        git add -N share/qtcreator/translations/*_??.ts && \
82
83
84
85
86
87
        for /f usebackq %%f in (`git diff-files --name-only share/qtcreator/translations/*_??.ts`) do \
            $$LCONVERT -locations none -i %%f -o %%f $$escape_expand(\\n\\t) \
        cd $$wd && git add share/qtcreator/translations/*_??.ts && git commit
}
QMAKE_EXTRA_TARGETS += commit-ts

88
89
ts.commands = \
    @echo \"The \'ts\' target has been removed in favor of more fine-grained targets.\" && \
90
91
    echo \"Use \'ts-<lang>\' instead. To add a language, use \'ts-untranslated\',\" && \
    echo \"rename the file and re-run \'qmake\'.\"
92
93
94
95
QMAKE_EXTRA_TARGETS += ts

TEMPLATE = app
TARGET = phony_target2
96
CONFIG -= qt separate_debug_info gdb_dwarf_index
97
98
QT =
LIBS =
99

100
updateqm.input = TRANSLATIONS
101
updateqm.output = $$IDE_DATA_PATH/translations/${QMAKE_FILE_BASE}.qm
102
103
104
105
106
107
108
isEmpty(vcproj):updateqm.variable_out = PRE_TARGETDEPS
updateqm.commands = $$LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT}
updateqm.name = LRELEASE ${QMAKE_FILE_IN}
updateqm.CONFIG += no_link
QMAKE_EXTRA_COMPILERS += updateqm

isEmpty(vcproj) {
109
    QMAKE_LINK = @: IGNORE THIS LINE
110
111
112
    OBJECTS_DIR =
    win32:CONFIG -= embed_manifest_exe
} else {
113
    CONFIG += console
114
115
116
    PHONY_DEPS = .
    phony_src.input = PHONY_DEPS
    phony_src.output = phony.c
117
    phony_src.variable_out = GENERATED_SOURCES
118
    phony_src.commands = echo int main() { return 0; } > phony.c
119
    phony_src.name = CREATE phony.c
120
121
122
123
    phony_src.CONFIG += combine
    QMAKE_EXTRA_COMPILERS += phony_src
}

124
qmfiles.files = $$prependAll(LANGUAGES, $$OUT_PWD/qtcreator_,.qm)
Daniel Molkentin's avatar
Daniel Molkentin committed
125
qmfiles.path = $$QTC_PREFIX/share/qtcreator/translations
126
qmfiles.CONFIG += no_check_exist
127
INSTALLS += qmfiles