summaryrefslogtreecommitdiff
path: root/packaging/windows/make-translations.vbs
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-01-29 20:01:04 +0100
committerIra Rice <irarice@gmail.com>2009-01-29 13:27:39 -0700
commit50a9e6619f6ffd9215f81d28d6bdd617c52947c1 (patch)
treec090710ebd73de05c2cbda3c4092fecca8621bb7 /packaging/windows/make-translations.vbs
parent33b92ad00cacf5d035a571edb9ff82aa5cd49d4a (diff)
downloadmana-50a9e6619f6ffd9215f81d28d6bdd617c52947c1.tar.gz
mana-50a9e6619f6ffd9215f81d28d6bdd617c52947c1.tar.bz2
mana-50a9e6619f6ffd9215f81d28d6bdd617c52947c1.tar.xz
mana-50a9e6619f6ffd9215f81d28d6bdd617c52947c1.zip
Converted CRLF newlines to LF
Diffstat (limited to 'packaging/windows/make-translations.vbs')
-rw-r--r--packaging/windows/make-translations.vbs42
1 files changed, 42 insertions, 0 deletions
diff --git a/packaging/windows/make-translations.vbs b/packaging/windows/make-translations.vbs
new file mode 100644
index 00000000..dee9f2bb
--- /dev/null
+++ b/packaging/windows/make-translations.vbs
@@ -0,0 +1,42 @@
+Set fso = CreateObject("Scripting.FileSystemObject")
+Set WshShell = CreateObject("WScript.Shell")
+Dim s, infile, outfile, command
+
+Function CreateFolderIfNonexistent(folder)
+ if not fso.FolderExists(folder) then
+ fso.CreateFolder(folder)
+ end if
+end Function
+
+'check for existence of msgfmt
+if not fso.FileExists("msgfmt.exe") then
+ WScript.echo "msgfmt.exe not found. Please get gettext for windows from http://gnuwin32.sourceforge.net/packages/gettext.htm and copy the files msgfmt.exe and all dll files from the gettext/bin directory into this directory and run this script again."
+ WScript.Quit(1)
+end if
+
+CreateFolderIfNonexistent("..\..\translations\")
+
+'open translation list
+Set stream = fso.GetFile("..\..\po\LINGUAS").OpenAsTextStream(1, 0)
+
+'iterate contents of translations file
+translations = 0
+do while not stream.AtEndOfStream
+ s = stream.ReadLine()
+ if inStr(s, "#") = false then
+ 'create the output directory
+ CreateFolderIfNonexistent("..\..\translations\" + s)
+ CreateFolderIfNonexistent("..\..\translations\" + s + "\LC_MESSAGES")
+ 'build the translate command
+ infile = "../../po/" + s + ".po"
+ outfile = "../../translations/" + s +"/LC_MESSAGES/aethyra.mo"
+ command = "msgfmt -c -o " + outfile + " " + infile
+ 'execute translate command
+ errval = WshShell.run(command, 0, true)
+ if errval = 0 then
+ translations = translations + 1
+ end if
+ end if
+loop
+
+WScript.echo translations, " translations compiled."