← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~qcumber-some/widelands/bugfix-657404 into lp:widelands

 

Jens Beyer (Qcumber-some) has proposed merging lp:~qcumber-some/widelands/bugfix-657404 into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #657404 in widelands: "When loading a savegame, the original map name is shown instead of the translated one"
  https://bugs.launchpad.net/widelands/+bug/657404

For more details, see:
https://code.launchpad.net/~qcumber-some/widelands/bugfix-657404/+merge/95272

As already mentioned by sirver and hjd in the bug comments, regular games have the English name saved; campaign games have the localized name saved.
The patch enables translation of the map game names while not crashing but doing nothing for campaign games. Problems might arise with custom maps and campains which share names with official maps; and it will not work for saving campaign games and switching locales afterwards.

This patch does NOT fix saving localized map names in campaigns to unlocalized ones, because I don't know if that's regarded an error or not.
-- 
https://code.launchpad.net/~qcumber-some/widelands/bugfix-657404/+merge/95272
Your team Widelands Developers is requested to review the proposed merge of lp:~qcumber-some/widelands/bugfix-657404 into lp:widelands.
=== modified file 'src/ui_fsmenu/loadgame.cc'
--- src/ui_fsmenu/loadgame.cc	2012-02-15 21:25:34 +0000
+++ src/ui_fsmenu/loadgame.cc	2012-02-29 22:12:20 +0000
@@ -181,7 +181,15 @@
 
 		m_ok.set_enabled(true);
 		m_delete.set_enabled(true);
-		m_tamapname.set_text(gpdp.get_mapname());
+		
+		//Try to translate the map name.
+		//This will work on every official map as expected
+		//and 'fail silently' (not find a translation) for already translated campaign map names.
+		//It will also translate 'false-positively' on any user-made map which shares a name with
+		//the official maps, but this should not be a problem to worry about.
+		i18n::grab_textdomain("maps");
+		m_tamapname.set_text(_(gpdp.get_mapname()));
+		i18n::release_textdomain();
 
 		char buf[200];
 		uint32_t gametime = gpdp.get_gametime();


Follow ups