summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packaging/windows/make-translations.vbs42
-rw-r--r--packaging/windows/setup.nsi3
-rw-r--r--src/main.cpp7
-rw-r--r--tmw.cbp2
4 files changed, 52 insertions, 2 deletions
diff --git a/packaging/windows/make-translations.vbs b/packaging/windows/make-translations.vbs
new file mode 100644
index 00000000..48246188
--- /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/tmw.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." \ No newline at end of file
diff --git a/packaging/windows/setup.nsi b/packaging/windows/setup.nsi
index ec57051c..55b3bd45 100644
--- a/packaging/windows/setup.nsi
+++ b/packaging/windows/setup.nsi
@@ -156,6 +156,7 @@ Section "Core files (required)" SecCore
CreateDirectory "$INSTDIR\data\graphics\gui"
CreateDirectory "$INSTDIR\data\graphics\images"
CreateDirectory "$INSTDIR\docs"
+ CreateDirectory "$INSTDIR\translations"
SetOverwrite ifnewer
SetOutPath "$INSTDIR"
@@ -180,6 +181,8 @@ Section "Core files (required)" SecCore
File /nonfatal "${SRCDIR}\data\music\*.ogg"
SetOutPath "$INSTDIR\docs"
File "${SRCDIR}\docs\FAQ.txt"
+ SetOutPath "$INSTDIR\"
+ File /nonfatal /r "${SRCDIR}\translations"
SectionEnd
Section -AdditionalIcons
diff --git a/src/main.cpp b/src/main.cpp
index 0291fd86..051840f1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -219,7 +219,7 @@ void init_engine(const Options &options)
GetLastError() != ERROR_ALREADY_EXISTS)
#elif defined __APPLE__
// Use Application Directory instead of .tmw
- homeDir = std::string(PHYSFS_getUserDir()) +
+ homeDir = std::string(PHYSFS_getUserDir()) +
"/Library/Application Support/The Mana World";
if ((mkdir(homeDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) &&
(errno != EEXIST))
@@ -672,9 +672,12 @@ int main(int argc, char *argv[])
#if ENABLE_NLS
#ifdef WIN32
putenv(("LANG=" + std::string(_nl_locale_name_default())).c_str());
+ // mingw doesn't like LOCALEDIR to be defined for some reason
+ bindtextdomain("tmw", "translations/");
+#else
+ bindtextdomain("tmw", LOCALEDIR);
#endif
setlocale(LC_MESSAGES, "");
- bindtextdomain("tmw", LOCALEDIR);
bind_textdomain_codeset("tmw", "UTF-8");
textdomain("tmw");
#endif
diff --git a/tmw.cbp b/tmw.cbp
index db698175..21874d50 100644
--- a/tmw.cbp
+++ b/tmw.cbp
@@ -16,6 +16,7 @@
<Add option="-Wall" />
<Add option="-DUSE_OPENGL" />
<Add option="-DNOGDI" />
+ <Add option="-DENABLE_NLS" />
</Compiler>
<Linker>
<Add library="guichan" />
@@ -35,6 +36,7 @@
<Add library="z.dll" />
<Add library="physfs" />
<Add library="curl.dll" />
+ <Add library="intl" />
</Linker>
</Target>
<Target title="unix">