aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator/translations/jsonwizard_tr.pro
blob: e8000637582c56624a1f96863bd8a24eaa081b9f (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 = $$replace($${SUBKEY}, "\\n", "\\n")
            VALUE ~= s,\",\\\",
            OUTPUT += "QT_TRANSLATE_NOOP(\"ProjectExplorer::JsonWizard\", \"$${VALUE}\");"
        }
        OUTPUT += $$findToTranslate($${SUBKEY})
    }
    return($$OUTPUT)
}

WIZ_TRANS_FILE_CONT= \
    "// This file is autogenerated by qmake."

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")