From 3af3878ace09fedb98c495f9bda550f7aa0df39c Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 26 Sep 2014 13:55:14 +0200 Subject: JsonWizard: Make wizards translatable Change-Id: Ia496829dd3070ef65b2cec31ecaf30955b2900c8 Reviewed-by: Oswald Buddenhagen --- share/qtcreator/translations/jsonwizard_tr.pro | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 share/qtcreator/translations/jsonwizard_tr.pro (limited to 'share/qtcreator/translations/jsonwizard_tr.pro') diff --git a/share/qtcreator/translations/jsonwizard_tr.pro b/share/qtcreator/translations/jsonwizard_tr.pro new file mode 100644 index 00000000000..4bc9f6da91b --- /dev/null +++ b/share/qtcreator/translations/jsonwizard_tr.pro @@ -0,0 +1,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 " + +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") -- cgit v1.2.3