Page 1 of 1

Release candidate for 0.0.28 translations

Posted: 27 Jan 2009, 01:17
by Crush
This is a windows installer for 0.0.28 with translations enabled. Please try it out and report if the translation into your language works.

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
Perl script used to create the translations:

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);
}

Re: Release candidate for 0.0.28 translations

Posted: 28 Jan 2009, 16:42
by Crush
According to my webserver logs only one person has completely downloaded this file so far.

Can someone take a look at it, please?

I won't push the modifications before someone confirmed that it works with at least one other language besides German.

Re: Release candidate for 0.0.28 translations

Posted: 28 Jan 2009, 17:48
by EJlol
Seems to work with dutch. BTW, is it also possible to play in english again? dutch games just sucks.

Re: Release candidate for 0.0.28 translations

Posted: 28 Jan 2009, 19:11
by Crush
Yes, rename or delete the "translations" folder.

I tried a few things to make gettext select a different language but whatever I tried gettext still used my system language.

I think I should make the translations an optional component when installing TMW so that the user can opt to use tmw without.

Re: Release candidate for 0.0.28 translations

Posted: 31 Jan 2009, 16:36
by Habari
IN Spanish it works brilliantly well :lol: , 10 points
however only some bits are translated , i do remember , translating everything in launchpad :roll:
by the way how does the PC know im Spanish , i feel spied :shock: :lol:
Anyway IMHO it is pretty weird to play TMW in a language different from english , even if the translation is correct it just feels strange :roll:

Re: Release candidate for 0.0.28 translations

Posted: 31 Jan 2009, 17:17
by Crush
The client gets your language setting from windows.