translations.pro 6.22 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)
}

Christian Kandeler's avatar
Christian Kandeler committed
13 14 15 16
XMLPATTERNS = $$shell_path($$[QT_INSTALL_BINS]/xmlpatterns)
LUPDATE = $$shell_path($$[QT_INSTALL_BINS]/lupdate) -locations relative -no-ui-lines -no-sort
LRELEASE = $$shell_path($$[QT_INSTALL_BINS]/lrelease)
LCONVERT = $$shell_path($$[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
JSONWIZARD_TR_H = $$OUT_PWD/jsonwizard_tr.h
25
QMLWIZARD_TR_H = $$OUT_PWD/qmlwizard_tr.h
26
QTQUICKWIZARD_TR_H = $$OUT_PWD/qtquickwizard_tr.h
27
EXTERNALTOOLS_TR_H = $$OUT_PWD/externaltools_tr.h
28

29 30 31 32 33
win32: \
    PREFIX = "file:///"
else: \
    PREFIX = "file://"

34
for(dir, $$list($$files($$IDE_SOURCE_TREE/src/plugins/*))):MIMETYPES_FILES += $$files($$dir/*.mimetypes.xml)
35
MIMETYPES_FILES = \"$$join(MIMETYPES_FILES, "|$$PREFIX", "$$PREFIX")\"
36

37
for(dir, $$list($$files($$IDE_SOURCE_TREE/share/qtcreator/templates/wizards/*, true))):CUSTOMWIZARD_FILES += $$files($$dir/wizard.xml)
38
CUSTOMWIZARD_FILES = \"$$join(CUSTOMWIZARD_FILES, "|$$PREFIX", "$$PREFIX")\"
39

40
for(dir, $$list($$files($$IDE_SOURCE_TREE/share/qtcreator/templates/qml/*))):QMLWIZARD_FILES += $$files($$dir/template.xml)
41
QMLWIZARD_FILES = \"$$join(QMLWIZARD_FILES, "|$$PREFIX", "$$PREFIX")\"
42

43
for(dir, $$list($$files($$IDE_SOURCE_TREE/share/qtcreator/templates/qtquick/*))):QTQUICKWIZARD_FILES += $$files($$dir/template.xml)
44
QTQUICKWIZARD_FILES = \"$$join(QTQUICKWIZARD_FILES, "|$$PREFIX", "$$PREFIX")\"
45

46
for(file, $$list($$files($$IDE_SOURCE_TREE/src/share/qtcreator/externaltools/*))):EXTERNALTOOLS_FILES += $$files($$file)
47
EXTERNALTOOLS_FILES = \"$$join(EXTERNALTOOLS_FILES, "|$$PREFIX", "$$PREFIX")\"
48

49
extract.commands += \
50
    $$XMLPATTERNS -output $$MIME_TR_H -param files=$$MIMETYPES_FILES $$PWD/extract-mimetypes.xq $$escape_expand(\\n\\t) \
51
    $$XMLPATTERNS -output $$CUSTOMWIZARD_TR_H -param files=$$CUSTOMWIZARD_FILES $$PWD/extract-customwizards.xq $$escape_expand(\\n\\t) \
52
    $$XMLPATTERNS -output $$QMLWIZARD_TR_H -param files=$$QMLWIZARD_FILES $$PWD/extract-qmlwizards.xq $$escape_expand(\\n\\t) \
53
    $$XMLPATTERNS -output $$QTQUICKWIZARD_TR_H -param files=$$QTQUICKWIZARD_FILES $$PWD/extract-qtquickwizards.xq $$escape_expand(\\n\\t) \
54 55
    $$XMLPATTERNS -output $$EXTERNALTOOLS_TR_H -param files=$$EXTERNALTOOLS_FILES $$PWD/extract-externaltools.xq $$escape_expand(\\n\\t) \
    $(QMAKE) -o Makefile.jsonwizard JSONWIZARD_TR_H=\"$$JSONWIZARD_TR_H\" TOP_LEVEL=\"$$IDE_SOURCE_TREE/share/qtcreator/templates/wizards\" $$PWD/jsonwizard_tr.pro
56 57
QMAKE_EXTRA_TARGETS += extract

58
plugin_sources = $$files($$IDE_SOURCE_TREE/src/plugins/*)
59
plugin_sources ~= s,^$$re_escape($$IDE_SOURCE_TREE/),,g$$i_flag
60 61 62 63 64 65
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
66 67 68 69 70
shared_sources = $$files($$IDE_SOURCE_TREE/src/shared/*)
shared_sources ~= s,^$$re_escape($$IDE_SOURCE_TREE/),,g$$i_flag
shared_sources -= \
    src/shared/qbs
sources = src/app src/libs $$plugin_sources $$shared_sources share/qtcreator/qmldesigner \
Daniel Molkentin's avatar
Daniel Molkentin committed
71
          share/qtcreator/welcomescreen share/qtcreator/welcomescreen/widgets
72

73
files = $$files($$PWD/*_??.ts) $$PWD/qtcreator_untranslated.ts
74
for(file, files) {
75
    lang = $$replace(file, .*_([^/]*)\\.ts, \\1)
76
    v = ts-$${lang}.commands
77
    $$v = cd $$wd && $$LUPDATE $$sources $$MIME_TR_H $$CUSTOMWIZARD_TR_H $$JSONWIZARD_TR_H $$QMLWIZARD_TR_H $$QTQUICKWIZARD_TR_H $$EXTERNALTOOLS_TR_H -ts $$file
78 79 80 81
    v = ts-$${lang}.depends
    $$v = extract
    QMAKE_EXTRA_TARGETS += ts-$$lang
}
Jarek Kobus's avatar
Jarek Kobus committed
82
ts-all.commands = cd $$wd && $$LUPDATE $$sources $$MIME_TR_H $$CUSTOMWIZARD_TR_H $$QMLWIZARD_TR_H $$QTQUICKWIZARD_TR_H $$EXTERNALTOOLS_TR_H -ts $$files
83 84 85
ts-all.depends = extract
QMAKE_EXTRA_TARGETS += ts-all

86
check-ts.commands = (cd $$replace(PWD, /, $$QMAKE_DIR_SEP) && perl check-ts.pl)
87 88 89
check-ts.depends = ts-all
QMAKE_EXTRA_TARGETS += check-ts

90 91
isEqual(QMAKE_DIR_SEP, /) {
    commit-ts.commands = \
92
        cd $$wd; \
93
        git add -N share/qtcreator/translations/*_??.ts && \
94 95 96 97 98 99 100
        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 && \
101
        git add -N share/qtcreator/translations/*_??.ts && \
102 103 104 105 106 107
        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

108 109
ts.commands = \
    @echo \"The \'ts\' target has been removed in favor of more fine-grained targets.\" && \
110 111
    echo \"Use \'ts-<lang>\' instead. To add a language, use \'ts-untranslated\',\" && \
    echo \"rename the file and re-run \'qmake\'.\"
112 113 114 115
QMAKE_EXTRA_TARGETS += ts

TEMPLATE = app
TARGET = phony_target2
116
CONFIG -= qt sdk separate_debug_info gdb_dwarf_index
117 118
QT =
LIBS =
119

120
updateqm.input = TRANSLATIONS
121
updateqm.output = $$IDE_DATA_PATH/translations/${QMAKE_FILE_BASE}.qm
122 123 124 125 126 127 128
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) {
129
    QMAKE_LINK = @: IGNORE THIS LINE
130 131 132
    OBJECTS_DIR =
    win32:CONFIG -= embed_manifest_exe
} else {
133
    CONFIG += console
134 135 136
    PHONY_DEPS = .
    phony_src.input = PHONY_DEPS
    phony_src.output = phony.c
137
    phony_src.variable_out = GENERATED_SOURCES
138
    phony_src.commands = echo int main() { return 0; } > phony.c
139
    phony_src.name = CREATE phony.c
140 141 142 143
    phony_src.CONFIG += combine
    QMAKE_EXTRA_COMPILERS += phony_src
}

144
qmfiles.files = $$prependAll(LANGUAGES, $$OUT_PWD/qtcreator_,.qm)
145
qmfiles.path = $$INSTALL_DATA_PATH/translations
146
qmfiles.CONFIG += no_check_exist
147
INSTALLS += qmfiles