Commit 3af3878a authored by Tobias Hunger's avatar Tobias Hunger
Browse files

JsonWizard: Make wizards translatable



Change-Id: Ia496829dd3070ef65b2cec31ecaf30955b2900c8
Reviewed-by: default avatarOswald Buddenhagen <oswald.buddenhagen@digia.com>
parent f39a86f7
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")
......@@ -21,6 +21,7 @@ TRANSLATIONS = $$prependAll(LANGUAGES, $$PWD/qtcreator_,.ts)
MIME_TR_H = $$OUT_PWD/mime_tr.h
CUSTOMWIZARD_TR_H = $$OUT_PWD/customwizard_tr.h
JSONWIZARD_TR_H = $$OUT_PWD/jsonwizard_tr.h
QMLWIZARD_TR_H = $$OUT_PWD/qmlwizard_tr.h
QTQUICKWIZARD_TR_H = $$OUT_PWD/qtquickwizard_tr.h
EXTERNALTOOLS_TR_H = $$OUT_PWD/externaltools_tr.h
......@@ -45,7 +46,8 @@ extract.commands += \
$$XMLPATTERNS -output $$CUSTOMWIZARD_TR_H -param files=$$CUSTOMWIZARD_FILES $$PWD/extract-customwizards.xq $$escape_expand(\\n\\t) \
$$XMLPATTERNS -output $$QMLWIZARD_TR_H -param files=$$QMLWIZARD_FILES $$PWD/extract-qmlwizards.xq $$escape_expand(\\n\\t) \
$$XMLPATTERNS -output $$QTQUICKWIZARD_TR_H -param files=$$QTQUICKWIZARD_FILES $$PWD/extract-qtquickwizards.xq $$escape_expand(\\n\\t) \
$$XMLPATTERNS -output $$EXTERNALTOOLS_TR_H -param files=$$EXTERNALTOOLS_FILES $$PWD/extract-externaltools.xq
$$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
QMAKE_EXTRA_TARGETS += extract
plugin_sources = $$files($$IDE_SOURCE_TREE/src/plugins/*)
......@@ -64,7 +66,7 @@ files = $$files($$PWD/*_??.ts) $$PWD/qtcreator_untranslated.ts
for(file, files) {
lang = $$replace(file, .*_([^/]*)\\.ts, \\1)
v = ts-$${lang}.commands
$$v = cd $$wd && $$LUPDATE $$sources $$MIME_TR_H $$CUSTOMWIZARD_TR_H $$QMLWIZARD_TR_H $$QTQUICKWIZARD_TR_H $$EXTERNALTOOLS_TR_H -ts $$file
$$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
v = ts-$${lang}.depends
$$v = extract
QMAKE_EXTRA_TARGETS += ts-$$lang
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment