summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-02-20 17:39:58 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-02-20 17:39:58 (GMT)
commitd706c52bf29e97b61ab843b295f1b53e50879a01 (patch)
treec11955e4aa796c50ac05916a6bcbdfac92266c83
parentf7b43132e3602b4f15000191ea5f8e4aefbb8245 (diff)
downloadswift-contrib-d706c52bf29e97b61ab843b295f1b53e50879a01.zip
swift-contrib-d706c52bf29e97b61ab843b295f1b53e50879a01.tar.bz2
Auto-generate NSIS translation script.
-rw-r--r--Swift/Packaging/nsis/translations-install.nsh1
-rw-r--r--Swift/Packaging/nsis/translations-uninstall.nsh1
-rw-r--r--Swift/QtUI/SConscript40
3 files changed, 33 insertions, 9 deletions
diff --git a/Swift/Packaging/nsis/translations-install.nsh b/Swift/Packaging/nsis/translations-install.nsh
deleted file mode 100644
index 7e6a085..0000000
--- a/Swift/Packaging/nsis/translations-install.nsh
+++ /dev/null
@@ -1 +0,0 @@
-File "..\..\QtUI\Swift\translations\swift_nl.qm"
diff --git a/Swift/Packaging/nsis/translations-uninstall.nsh b/Swift/Packaging/nsis/translations-uninstall.nsh
deleted file mode 100644
index bfb0388..0000000
--- a/Swift/Packaging/nsis/translations-uninstall.nsh
+++ /dev/null
@@ -1 +0,0 @@
-delete $INSTDIR\translations\swift_nl.qm
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index 2255808..093b708 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -160,21 +160,47 @@ commonResources = {
"": ["../resources/sounds"]
}
+################################################################################
# Translation
-translation_sources = [env.File("../Translations/swift.ts").abspath]
+################################################################################
+
+# Collect available languages
+translation_languages = []
for file in os.listdir(Dir("../Translations").abspath) :
if file.startswith("swift_") and file.endswith(".ts") :
- lang = file[6:-3]
- translation_resource = "../resources/translations/swift_" + lang + ".qm"
- translation_source = "../Translations/swift_" + lang + ".ts"
- translation_sources.append(env.File(translation_source).abspath)
- myenv.Qm(translation_resource, translation_source)
- commonResources["translations"] = commonResources.get("translations", []) + [translation_resource]
+ translation_languages.append(file[6:-3])
+
+# Generate translation modules
+translation_sources = [env.File("../Translations/swift.ts").abspath]
+translation_modules = []
+for lang in translation_languages :
+ lang = file[6:-3]
+ translation_resource = "../resources/translations/swift_" + lang + ".qm"
+ translation_source = "../Translations/swift_" + lang + ".ts"
+ translation_sources.append(env.File(translation_source).abspath)
+ translation_modules.append(env.File(translation_resource).abspath)
+ myenv.Qm(translation_resource, translation_source)
+ commonResources["translations"] = commonResources.get("translations", []) + [translation_resource]
+
+# LUpdate translation (if requested)
if ARGUMENTS.get("update_translations", False) :
myenv.Precious(translation_sources)
t = myenv.Command(translation_sources, [], [myenv.Action("$QT4_LUPDATE -I " + env.Dir("#").abspath + " -silent -no-ui-lines -codecfortr utf-8 -recursive Swift -ts " + " ".join(translation_sources), cmdstr = "$QT4_LUPDATECOMSTR")])
myenv.AlwaysBuild(t)
+# NSIS installation script
+if env["PLATFORM"] == "win32" :
+ nsis_translation_install_script = ""
+ nsis_translation_uninstall_script = ""
+ for lang in translation_languages :
+ nsis_translation_install_script += "File \"..\\..\\QtUI\\Swift\\translations\\swift_" + lang + ".qm\""
+ nsis_translation_uninstall_script += "delete $INSTDIR\\translations\\swift_" + lang + ".qm"
+ myenv.WriteVal("../Packaging/nsis/translations-install.nsh", myenv.Value(nsis_translation_install_script))
+ myenv.WriteVal("../Packaging/nsis/translations-uninstall.nsh", myenv.Value(nsis_translation_uninstall_script))
+
+
+################################################################################
+
if env["PLATFORM"] == "darwin" :
frameworks = []
if env["HAVE_SPARKLE"] :