← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/string-fixes into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/string-fixes into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1421942 in widelands: "Unified term for "Black" and "Wasteland""
  https://bugs.launchpad.net/widelands/+bug/1421942
  Bug #1487887 in widelands: "Translation missing in editor and in replay tooltip"
  https://bugs.launchpad.net/widelands/+bug/1487887

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/string-fixes/+merge/270159

1. Made some untranslatable strings localizable.

2. Fixed xgettext for Lua. Comments in .pot files need to be introduced by "#." rather than "#:" - "#:" is for occurrences.

3. Small string fixes for Tutorial 4 and ships.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/string-fixes into lp:widelands.
=== modified file 'campaigns/tutorial04_economy.wmf/scripting/texts.lua'
--- campaigns/tutorial04_economy.wmf/scripting/texts.lua	2015-06-10 16:50:57 +0000
+++ campaigns/tutorial04_economy.wmf/scripting/texts.lua	2015-09-04 10:55:44 +0000
@@ -82,7 +82,7 @@
       paragraphdivider() ..
       listitem_bullet(_[[‘2/1’ below the quarry: This means that you have two quarries, plus another one which is under construction.]]) ..
       listitem_bullet(_[[‘0%’: This indicates the average productivity of all buildings of that type. You have just started this game, therefore none of your buildings has done any work yet, but they are going to start working soon.]]) ..
-      listitem_bullet(_[[‘2/4’ below your sentry: For military buildings, the stationed soldiers are shown instead of a productivity. You want to have four soldiers in your sentries, but only two soldiers are stationed in this kind of building. This leaves two vacant positions — we really need more soldiers.]]) ..
+      listitem_bullet(_[[‘2/4’ below your sentry: For military buildings, the stationed soldiers are shown instead of a productivity. You want to have four soldiers in your sentries, but only two soldiers are stationed in this kind of building. This leaves two vacant positions – we really need more soldiers.]]) ..
       listitem_arrow(_[[In both cases, the color (green - yellow - red) signals you how good the value is.]]) ..
       listitem_bullet(_[[If you click on a building, you can scroll through the buildings of the selected type.]]) ..
       listitem_bullet(_[[If you don’t have any building of a particular building type, it will be shown greyed out.]])
@@ -392,7 +392,7 @@
    body = rt(
       p(_[[This window looks similar to the stock window, but it has additional buttons at the bottom.]]) ..
       p(_[[You first have to select one or more wares (you can also left-click and drag). Then you can set the desired target quantity for the selected wares.]]) ..
-      p(_[[Most buildings will only produce something when when the stock level in your warehouses falls below the target quantity, so you should indicate the reserve you want to stockpile.]]) ..
+      p(_[[Most buildings will only produce something when the stock level in your warehouses falls below the target quantity, so you should indicate the reserve you want to stockpile.]]) ..
       p(_[[An example: the default value for scythes is 1. If you build a farm, a carrier will take a scythe and become a farmer. Then there will be no scythes left, but the target quantity is 1, therefore your toolsmith will start producing another one.]]) ..
       p(_[[If you build two farms, only one of them will start working immediately. The second farm will have to wait for its worker, who will lack a scythe. If you had set the target quantity to 2 before, two scythes would have been available and both farms would have been able to start working right away.]])
    ),
@@ -425,7 +425,7 @@
    title = _"Warehouse Preferences",
    body = rt(
       h1(_[[Bring the marble columns to the front line]]) ..
-      p(_[[It is great that we are producing marble columns, but it would be great if they were stored where we need them.]]) ..
+      p(_[[The production of marble columns is working fine now, but it would be great if they were stored where we need them.]]) ..
       p(_[[Normally, produced wares are brought to the closest warehouse if they are not needed elsewhere. In this case, this means our headquarters. But we would like to have them in the warehouse near our fortresses.]]) ..
       p(_[[Every warehouse has four buttons to set the preference. If you move your mouse pointer over them, you will see tooltips that explain what the buttons do.]]) ..
       paragraphdivider() ..

=== modified file 'maps/MP Scenarios/Island Hopping.wmf/scripting/multiplayer_init.lua'
--- maps/MP Scenarios/Island Hopping.wmf/scripting/multiplayer_init.lua	2014-10-02 11:45:56 +0000
+++ maps/MP Scenarios/Island Hopping.wmf/scripting/multiplayer_init.lua	2015-09-04 10:55:44 +0000
@@ -131,7 +131,7 @@
       return ngettext("%s Gold Ore","%s Gold Ore",count):bformat(count)
    else
       -- TRANSLATORS: number + resource name, e.g. '1 stone'
-      return (_"%1$i %2$s"):bformat(count, resource)
+      return ("%1$i %2$s"):bformat(count, resource)
    end
 end
 

=== modified file 'src/editor/map_generator.cc'
--- src/editor/map_generator.cc	2015-01-31 16:03:59 +0000
+++ src/editor/map_generator.cc	2015-09-04 10:55:44 +0000
@@ -792,7 +792,7 @@
 
 	for (PlayerNumber n = 1; n <= map_info_.numPlayers; ++n) {
 		// Set scenario information - needed even if it's not a scenario
-		map_.set_scenario_player_name(n, "Random Player");
+		map_.set_scenario_player_name(n, _("Random Player"));
 		map_.set_scenario_player_tribe(n, tribe);
 		map_.set_scenario_player_ai(n, ai);
 		map_.set_scenario_player_closeable(n, false);

=== modified file 'src/editor/ui_menus/editor_player_menu.cc'
--- src/editor/ui_menus/editor_player_menu.cc	2015-09-04 06:16:58 +0000
+++ src/editor/ui_menus/editor_player_menu.cc	2015-09-04 10:55:44 +0000
@@ -31,6 +31,7 @@
 #include "logic/player.h"
 #include "logic/tribe.h"
 #include "logic/warehouse.h"
+#include "profile/profile.h"
 #include "ui_basic/editbox.h"
 #include "ui_basic/messagebox.h"
 #include "ui_basic/textarea.h"
@@ -70,7 +71,17 @@
 	int32_t const width   = 20;
 	int32_t       posy    = 0;
 
-	m_tribes = Widelands::TribeDescr::get_all_tribenames();
+	// Initializing the descnames for the tribes.
+	for (const std::string& tribename : Widelands::TribeDescr::get_all_tribenames()) {
+		std::string tribepath("tribes/" + tribename);
+		// get translated tribesname
+		Profile prof
+			((tribepath + "/conf").c_str(), nullptr, "tribe_" + tribename);
+		Section & global = prof.get_safe_section("tribe");
+		const char* descname = global.get_safe_string("name");
+		m_tribenames.push_back(tribename);
+		m_tribe_descnames.emplace(tribename, descname);
+	}
 
 	set_inner_size(375, 135);
 
@@ -162,13 +173,15 @@
 				(boost::bind(&EditorPlayerMenu::player_tribe_clicked, boost::ref(*this), p - 1));
 			posx += 140 + spacing;
 		}
-		if (map.get_scenario_player_tribe(p) != UNDEFINED_TRIBE_NAME)
-			m_plr_set_tribes_buts[p - 1]->set_title
-				(map.get_scenario_player_tribe(p).c_str());
-		else {
-			m_plr_set_tribes_buts[p - 1]->set_title(m_tribes[0].c_str());
-			map.set_scenario_player_tribe(p, m_tribes[0]);
+
+		// Get/Set (localized) tribe names
+		if (map.get_scenario_player_tribe(p) != UNDEFINED_TRIBE_NAME) {
+			m_selected_tribes[p] = map.get_scenario_player_tribe(p);
+		} else {
+			m_selected_tribes[p] = m_tribenames[0];
+			map.set_scenario_player_tribe(p, m_selected_tribes[p]);
 		}
+		m_plr_set_tribes_buts[p - 1]->set_title(m_tribe_descnames.find(m_selected_tribes[p])->second);
 
 		// Set default AI and closeable to false (always default - should be changed by hand)
 		map.set_scenario_player_ai(p, "");
@@ -206,7 +219,7 @@
 		const std::string name = (boost::format(_("Player %u")) % static_cast<unsigned int>(nr_players)).str();
 		map.set_scenario_player_name(nr_players, name);
 	}
-	map.set_scenario_player_tribe(nr_players, m_tribes[0]);
+	map.set_scenario_player_tribe(nr_players, m_tribenames[0]);
 	eia().set_need_save(true);
 	m_add_player        .set_enabled(nr_players < MAX_PLAYERS);
 	m_remove_last_player.set_enabled(true);
@@ -248,17 +261,16 @@
  */
 void EditorPlayerMenu::player_tribe_clicked(uint8_t n) {
 	EditorInteractive& menu = eia();
-		if (!menu.is_player_tribe_referenced(n + 1)) {
-		std::string t = m_plr_set_tribes_buts[n]->get_title();
-		if (!Widelands::TribeDescr::exists_tribe(t))
+	if (!menu.is_player_tribe_referenced(n + 1)) {
+		if (!Widelands::TribeDescr::exists_tribe(m_selected_tribes[n + 1]))
 			throw wexception
-				("Map defines tribe %s, but it does not exist!", t.c_str());
+				("Map defines tribe %s, but it does not exist!", m_selected_tribes[n + 1].c_str());
 		uint32_t i;
-		for (i = 0; i < m_tribes.size(); ++i)
-			if (m_tribes[i] == t)
+		for (i = 0; i < m_tribenames.size(); ++i)
+			if (m_tribenames[i] == m_selected_tribes[n + 1])
 				break;
-		t = i == m_tribes.size() - 1 ? m_tribes[0] : m_tribes[++i];
-		menu.egbase().map().set_scenario_player_tribe(n + 1, t);
+		m_selected_tribes[n + 1] = i == m_tribenames.size() - 1 ? m_tribenames[0] : m_tribenames[++i];
+		menu.egbase().map().set_scenario_player_tribe(n + 1, m_selected_tribes[n + 1]);
 		menu.set_need_save(true);
 	} else {
 		UI::WLMessageBox mmb
@@ -337,7 +349,7 @@
 		// so that this tribe can not be changed
 		egbase.add_player
 			(n, 0, // TODO(SirVer): initialization index makes no sense here
-			 m_plr_set_tribes_buts[n - 1]->get_title(),
+			 m_tribe_descnames.find(m_selected_tribes[n])->second,
 			 m_plr_names[n - 1]->text());
 
 		p = egbase.get_player(n);

=== modified file 'src/editor/ui_menus/editor_player_menu.h'
--- src/editor/ui_menus/editor_player_menu.h	2014-11-28 12:53:24 +0000
+++ src/editor/ui_menus/editor_player_menu.h	2015-09-04 10:55:44 +0000
@@ -21,6 +21,7 @@
 #define WL_EDITOR_UI_MENUS_EDITOR_PLAYER_MENU_H
 
 #include <cstring>
+#include <map>
 #include <string>
 #include <vector>
 
@@ -54,7 +55,14 @@
 		* m_plr_make_infrastructure_buts[MAX_PLAYERS],
 		* m_plr_set_pos_buts            [MAX_PLAYERS],
 		* m_plr_set_tribes_buts         [MAX_PLAYERS];
-	std::vector<std::string> m_tribes;
+
+	std::vector<std::string> m_tribenames;
+
+	/// tribename, descname
+	std::map<std::string, std::string> m_tribe_descnames;
+
+	/// List of the tribes currently selected for all players
+	std::string m_selected_tribes[MAX_PLAYERS];
 
 	int32_t m_posy;
 

=== modified file 'src/logic/productionsite.cc'
--- src/logic/productionsite.cc	2015-06-24 20:25:35 +0000
+++ src/logic/productionsite.cc	2015-09-04 10:55:44 +0000
@@ -317,7 +317,7 @@
 	else
 		color = UI_FONT_CLR_GOOD.hex_value();
 	const std::string perc_str =
-		(boost::format("<font color=%s>%i%%</font>") % color % percOk).str();
+		(boost::format("<font color=%s>%s</font>") % color % (boost::format(_("%i%%")) % percOk)).str();
 
 	std::string trend;
 	if (lastPercOk > percOk) {

=== modified file 'src/logic/ship.cc'
--- src/logic/ship.cc	2015-08-31 19:40:34 +0000
+++ src/logic/ship.cc	2015-09-04 10:55:44 +0000
@@ -661,7 +661,7 @@
 			}
 		} else {  // it seems that port constructionsite has dissapeared
 			// Send a message to the player, that a port constructionsite is gone
-			std::string msg_head = _("New port constructionsite is gone");
+			std::string msg_head = _("New port construction site is gone");
 			std::string msg_body = _("Unloading of wares failed, expedition is cancelled now.");
 			send_message(game, msg_head, msg_body, "port.png");
 			send_signal(game, "cancel_expedition");

=== modified file 'src/ui_fsmenu/loadgame.cc'
--- src/ui_fsmenu/loadgame.cc	2015-09-04 06:16:58 +0000
+++ src/ui_fsmenu/loadgame.cc	2015-09-04 10:55:44 +0000
@@ -182,14 +182,14 @@
 		if (m_is_replay) {
 			/** TRANSLATORS: Tooltip for the "Mode" column when choosing a game/replay to load. */
 			/** TRANSLATORS: Make sure that you keep consistency in your translation. */
-			modes.push_back("SP = Single Player");
+			modes.push_back(_("SP = Single Player"));
 		}
 		/** TRANSLATORS: Tooltip for the "Mode" column when choosing a game/replay to load. */
 		/** TRANSLATORS: Make sure that you keep consistency in your translation. */
-		modes.push_back("MP = Multiplayer");
+		modes.push_back(_("MP = Multiplayer"));
 		/** TRANSLATORS: Tooltip for the "Mode" column when choosing a game/replay to load. */
 		/** TRANSLATORS: Make sure that you keep consistency in your translation. */
-		modes.push_back("H = Multiplayer (Host)");
+		modes.push_back(_("H = Multiplayer (Host)"));
 		const std::string mode_tooltip_1 =
 				/** TRANSLATORS: Tooltip for the "Mode" column when choosing a game/replay to load. */
 				/** TRANSLATORS: %s is a list of game modes. */

=== modified file 'src/ui_fsmenu/options.cc'
--- src/ui_fsmenu/options.cc	2015-08-06 17:14:34 +0000
+++ src/ui_fsmenu/options.cc	2015-09-04 10:55:44 +0000
@@ -563,7 +563,7 @@
 		(this,
 		 m_hmargin + m_message_sound.get_w() + m_padding, m_message_sound.get_y(),
 		 get_w() - 2 * m_hmargin - m_message_sound.get_w() - m_padding, 40,
-		 _("Play a sound at message arrival."),
+		 _("Play a sound at message arrival"),
 		 UI::Align_VCenter),
 
 	m_nozip (this, Point(m_hmargin,
@@ -573,7 +573,7 @@
 		(this,
 		 m_hmargin + m_nozip.get_w() + m_padding, m_nozip.get_y(),
 		 get_w() - 2 * m_hmargin - m_nozip.get_w() - m_padding, 40,
-		 _("Do not zip widelands data files (maps, replays and savegames)."),
+		 _("Do not zip widelands data files (maps, replays and savegames)"),
 		 UI::Align_VCenter),
 
 	m_remove_syncstreams (this, Point(m_hmargin,

=== modified file 'src/wui/building_statistics_menu.cc'
--- src/wui/building_statistics_menu.cc	2015-09-04 06:16:58 +0000
+++ src/wui/building_statistics_menu.cc	2015-09-04 10:55:44 +0000
@@ -663,8 +663,14 @@
 				} else {
 					color = UI_FONT_CLR_GOOD;
 				}
+<<<<<<< TREE
 				/** TRANSLATORS: Percent in building statistics window, e.g. 85% */
 				const std::string perc_str = (boost::format(_("%i%%")) % percent).str();
+=======
+				/** TRANSLATORS: %i is a number, %% the percent sign.*/
+				/** TRANSLATORS: If you wish to add a space, translate as '%i %%' */
+				const std::string perc_str = (boost::format(_("%i%%")) % percent).str();
+>>>>>>> MERGE-SOURCE
 				set_labeltext_autosize(productivity_labels_[id], perc_str, color);
 			}
 			if (has_selection_ && id == current_building_type_) {

=== modified file 'tribes/atlanteans/horsebreeder/conf'
--- tribes/atlanteans/horsebreeder/conf	2015-08-02 07:09:49 +0000
+++ tribes/atlanteans/horsebreeder/conf	2015-09-04 10:55:44 +0000
@@ -1,4 +1,4 @@
-help=_"Breeds the strong Atlantean horses"
+help=_"Breeds the strong Atlantean horses."
 
 [buildcost]
 carrier=1

=== modified file 'utils/lua_xgettext.py'
--- utils/lua_xgettext.py	2015-07-27 10:38:23 +0000
+++ utils/lua_xgettext.py	2015-09-04 10:55:44 +0000
@@ -357,6 +357,7 @@
         for translatable_item in all_translatable_items:
             if translatable_item['msgid'] in considered_msgids:
                 continue
+<<<<<<< TREE
             considered_msgids.add(translatable_item['msgid'])
 
             occurences = self.translatable_items[translatable_item['msgid']]
@@ -365,6 +366,28 @@
                 emit_function = EMIT_FUNCTIONS[type]
                 emit_function(list(type_occurences), lines)
         return head + "\n".join(lines)
+=======
+            considered_msgids.add(finding.msgid)
+
+            occurences = self.findings[finding.msgid]
+            occurences.sort() # Sort by filename and lines
+            comments = sorted(set(f.translator_comment for f in occurences if f.translator_comment))
+            for comment in comments:
+                s += "#. %s\n" % (comment)
+
+            for occurence in occurences:
+                s += "#: %s:%i\n" % (os.path.normpath(occurence.filename), occurence.lineno)
+
+            if not occurence.msgid_plural:
+                s += _output_string("msgid", occurence.msgid)
+                s += 'msgstr ""\n\n'
+            else:
+                s += _output_string("msgid", occurence.msgid)
+                s += _output_string("msgid_plural", occurence.msgid_plural)
+                s += 'msgstr[0] ""\n'
+                s += 'msgstr[1] ""\n\n'
+        return s
+>>>>>>> MERGE-SOURCE
 
 
 def gettext(text, filename):


Follow ups