http://www.crushnet.org/tmw/tmw-0.0.28- ... ations.exe
The supported languages are: ar, ca, cs, da, de, en_GB, eo, es, fi, fr, he, hr, id, it, ja, nl, pl, pt, pt_BR, ru, sk, sv, th. Note that some translations are incomplete.
Sourcecode changes:
Code: Select all
iff --git a/packaging/windows/setup.nsi b/packaging/windows/setup.nsi
index ec57051..55b3bd4 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 0291fd8..13bf147 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -670,11 +670,14 @@ int main(int argc, char *argv[])
}
#if ENABLE_NLS
+ setlocale(LC_MESSAGES, "");
#ifdef WIN32
putenv(("LANG=" + std::string(_nl_locale_name_default())).c_str());
-#endif
- setlocale(LC_MESSAGES, "");
+ // mingw doesn't like LOCALEDIR to be defined for some reason
+ bindtextdomain("tmw", "translations/");
+#else
bindtextdomain("tmw", LOCALEDIR);
+#endif
bind_textdomain_codeset("tmw", "UTF-8");
textdomain("tmw");
#endif
Code: Select all
# run this perl script in /packaging/windows
# read translations
open(LANGFILE, "../../po/LINGUAS");
while (defined(my $i = <LANGFILE>))
{
# ignore comments
if ($i =~ m/#/) { next };
# remove linebreaks
$i =~ s/\n//;
$i =~ s/\r//;
#create the output directory
system("md ..\\..\\translations\\".$i."\\LC_MESSAGES");
# build the translate command
my $in = "../../po/" .$i.".po";
my $out = "../../translations/".$i."/LC_MESSAGES/tmw.mo";
my $command = "msgfmt -c -o ".$out." ".$in;
# execute translate command
system($command);
}