summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-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"] :