aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator/translations/jsonwizard_tr.pro
blob: 4bc9f6da91b1075b8ea40e235c1f3b5f0aebfa15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
TEMPLATE = subdirs

isEmpty(JSONWIZARD_TR_H): JSONWIZARD_TR_H = $$OUT_PWD/jsonwizard_tr.h
isEmpty(TOP_LEVEL): TOP_LEVEL = "."

for(dir, $$list($$files($$TOP_LEVEL/*, true))): \
    JSONWIZARD_FILES += $$files($$dir/wizard.json)

defineReplace(findToTranslate) {
    ROOTKEY = $$1
    OUTPUT = ""
    for (KEY, $${ROOTKEY}._KEYS_) {
        SUBKEY = $${ROOTKEY}.$${KEY}
        MATCHED = $$find(KEY, ^tr[A-Z])
        !isEmpty(MATCHED) {
            VALUE = $$eval($${SUBKEY})
            OUTPUT += "QCoreApplication(\"ProjectExplorer::JsonWizard\", \"$${VALUE}\");"
        }
        OUTPUT += $$findToTranslate($${SUBKEY})
    }
    return($$OUTPUT)
}

WIZ_TRANS_FILE_CONT= \
    "// This file is autogenerated by qmake." \
    "$${LITERAL_HASH}include <QCoreApplication>"

for (FILE, JSONWIZARD_FILES) {
    exists($$FILE) {
        JSON = $$cat($$FILE, blob)
        parseJson(JSON, WIZ)
        WIZ_TRANS_FILE_CONT += $$findToTranslate(WIZ)
    }
}

write_file($$JSONWIZARD_TR_H, WIZ_TRANS_FILE_CONT)|error("Aborting")