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

Proposed by GunChleoc
Status: Merged
Merged at revision: 7523
Proposed branch: lp:~widelands-dev/widelands/string-fixes
Merge into: lp:widelands
Diff against target: 285 lines (+53/-32)
12 files modified
campaigns/tutorial04_economy.wmf/scripting/texts.lua (+3/-3)
maps/MP Scenarios/Island Hopping.wmf/scripting/multiplayer_init.lua (+1/-1)
src/editor/map_generator.cc (+1/-1)
src/editor/ui_menus/editor_player_menu.cc (+29/-17)
src/editor/ui_menus/editor_player_menu.h (+9/-1)
src/logic/productionsite.cc (+1/-1)
src/logic/ship.cc (+1/-1)
src/ui_fsmenu/loadgame.cc (+3/-3)
src/ui_fsmenu/options.cc (+2/-2)
src/wui/building_statistics_menu.cc (+1/-0)
tribes/atlanteans/horsebreeder/conf (+1/-1)
utils/lua_xgettext.py (+1/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/string-fixes
Reviewer Review Type Date Requested Status
SirVer Approve
Review via email: mp+270159@code.launchpad.net

Description of the change

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.

To post a comment you must log in.
Revision history for this message
SirVer (sirver) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'campaigns/tutorial04_economy.wmf/scripting/texts.lua'
2--- campaigns/tutorial04_economy.wmf/scripting/texts.lua 2015-06-10 16:50:57 +0000
3+++ campaigns/tutorial04_economy.wmf/scripting/texts.lua 2015-09-04 11:07:32 +0000
4@@ -82,7 +82,7 @@
5 paragraphdivider() ..
6 listitem_bullet(_[[‘2/1’ below the quarry: This means that you have two quarries, plus another one which is under construction.]]) ..
7 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.]]) ..
8- 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.]]) ..
9+ 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.]]) ..
10 listitem_arrow(_[[In both cases, the color (green - yellow - red) signals you how good the value is.]]) ..
11 listitem_bullet(_[[If you click on a building, you can scroll through the buildings of the selected type.]]) ..
12 listitem_bullet(_[[If you don’t have any building of a particular building type, it will be shown greyed out.]])
13@@ -392,7 +392,7 @@
14 body = rt(
15 p(_[[This window looks similar to the stock window, but it has additional buttons at the bottom.]]) ..
16 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.]]) ..
17- 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.]]) ..
18+ 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.]]) ..
19 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.]]) ..
20 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.]])
21 ),
22@@ -425,7 +425,7 @@
23 title = _"Warehouse Preferences",
24 body = rt(
25 h1(_[[Bring the marble columns to the front line]]) ..
26- p(_[[It is great that we are producing marble columns, but it would be great if they were stored where we need them.]]) ..
27+ p(_[[The production of marble columns is working fine now, but it would be great if they were stored where we need them.]]) ..
28 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.]]) ..
29 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.]]) ..
30 paragraphdivider() ..
31
32=== modified file 'maps/MP Scenarios/Island Hopping.wmf/scripting/multiplayer_init.lua'
33--- maps/MP Scenarios/Island Hopping.wmf/scripting/multiplayer_init.lua 2014-10-02 11:45:56 +0000
34+++ maps/MP Scenarios/Island Hopping.wmf/scripting/multiplayer_init.lua 2015-09-04 11:07:32 +0000
35@@ -131,7 +131,7 @@
36 return ngettext("%s Gold Ore","%s Gold Ore",count):bformat(count)
37 else
38 -- TRANSLATORS: number + resource name, e.g. '1 stone'
39- return (_"%1$i %2$s"):bformat(count, resource)
40+ return ("%1$i %2$s"):bformat(count, resource)
41 end
42 end
43
44
45=== modified file 'src/editor/map_generator.cc'
46--- src/editor/map_generator.cc 2015-01-31 16:03:59 +0000
47+++ src/editor/map_generator.cc 2015-09-04 11:07:32 +0000
48@@ -792,7 +792,7 @@
49
50 for (PlayerNumber n = 1; n <= map_info_.numPlayers; ++n) {
51 // Set scenario information - needed even if it's not a scenario
52- map_.set_scenario_player_name(n, "Random Player");
53+ map_.set_scenario_player_name(n, _("Random Player"));
54 map_.set_scenario_player_tribe(n, tribe);
55 map_.set_scenario_player_ai(n, ai);
56 map_.set_scenario_player_closeable(n, false);
57
58=== modified file 'src/editor/ui_menus/editor_player_menu.cc'
59--- src/editor/ui_menus/editor_player_menu.cc 2015-09-04 06:16:58 +0000
60+++ src/editor/ui_menus/editor_player_menu.cc 2015-09-04 11:07:32 +0000
61@@ -31,6 +31,7 @@
62 #include "logic/player.h"
63 #include "logic/tribe.h"
64 #include "logic/warehouse.h"
65+#include "profile/profile.h"
66 #include "ui_basic/editbox.h"
67 #include "ui_basic/messagebox.h"
68 #include "ui_basic/textarea.h"
69@@ -70,7 +71,17 @@
70 int32_t const width = 20;
71 int32_t posy = 0;
72
73- m_tribes = Widelands::TribeDescr::get_all_tribenames();
74+ // Initializing the descnames for the tribes.
75+ for (const std::string& tribename : Widelands::TribeDescr::get_all_tribenames()) {
76+ std::string tribepath("tribes/" + tribename);
77+ // get translated tribesname
78+ Profile prof
79+ ((tribepath + "/conf").c_str(), nullptr, "tribe_" + tribename);
80+ Section & global = prof.get_safe_section("tribe");
81+ const char* descname = global.get_safe_string("name");
82+ m_tribenames.push_back(tribename);
83+ m_tribe_descnames.emplace(tribename, descname);
84+ }
85
86 set_inner_size(375, 135);
87
88@@ -162,13 +173,15 @@
89 (boost::bind(&EditorPlayerMenu::player_tribe_clicked, boost::ref(*this), p - 1));
90 posx += 140 + spacing;
91 }
92- if (map.get_scenario_player_tribe(p) != UNDEFINED_TRIBE_NAME)
93- m_plr_set_tribes_buts[p - 1]->set_title
94- (map.get_scenario_player_tribe(p).c_str());
95- else {
96- m_plr_set_tribes_buts[p - 1]->set_title(m_tribes[0].c_str());
97- map.set_scenario_player_tribe(p, m_tribes[0]);
98+
99+ // Get/Set (localized) tribe names
100+ if (map.get_scenario_player_tribe(p) != UNDEFINED_TRIBE_NAME) {
101+ m_selected_tribes[p] = map.get_scenario_player_tribe(p);
102+ } else {
103+ m_selected_tribes[p] = m_tribenames[0];
104+ map.set_scenario_player_tribe(p, m_selected_tribes[p]);
105 }
106+ m_plr_set_tribes_buts[p - 1]->set_title(m_tribe_descnames.find(m_selected_tribes[p])->second);
107
108 // Set default AI and closeable to false (always default - should be changed by hand)
109 map.set_scenario_player_ai(p, "");
110@@ -206,7 +219,7 @@
111 const std::string name = (boost::format(_("Player %u")) % static_cast<unsigned int>(nr_players)).str();
112 map.set_scenario_player_name(nr_players, name);
113 }
114- map.set_scenario_player_tribe(nr_players, m_tribes[0]);
115+ map.set_scenario_player_tribe(nr_players, m_tribenames[0]);
116 eia().set_need_save(true);
117 m_add_player .set_enabled(nr_players < MAX_PLAYERS);
118 m_remove_last_player.set_enabled(true);
119@@ -248,17 +261,16 @@
120 */
121 void EditorPlayerMenu::player_tribe_clicked(uint8_t n) {
122 EditorInteractive& menu = eia();
123- if (!menu.is_player_tribe_referenced(n + 1)) {
124- std::string t = m_plr_set_tribes_buts[n]->get_title();
125- if (!Widelands::TribeDescr::exists_tribe(t))
126+ if (!menu.is_player_tribe_referenced(n + 1)) {
127+ if (!Widelands::TribeDescr::exists_tribe(m_selected_tribes[n + 1]))
128 throw wexception
129- ("Map defines tribe %s, but it does not exist!", t.c_str());
130+ ("Map defines tribe %s, but it does not exist!", m_selected_tribes[n + 1].c_str());
131 uint32_t i;
132- for (i = 0; i < m_tribes.size(); ++i)
133- if (m_tribes[i] == t)
134+ for (i = 0; i < m_tribenames.size(); ++i)
135+ if (m_tribenames[i] == m_selected_tribes[n + 1])
136 break;
137- t = i == m_tribes.size() - 1 ? m_tribes[0] : m_tribes[++i];
138- menu.egbase().map().set_scenario_player_tribe(n + 1, t);
139+ m_selected_tribes[n + 1] = i == m_tribenames.size() - 1 ? m_tribenames[0] : m_tribenames[++i];
140+ menu.egbase().map().set_scenario_player_tribe(n + 1, m_selected_tribes[n + 1]);
141 menu.set_need_save(true);
142 } else {
143 UI::WLMessageBox mmb
144@@ -337,7 +349,7 @@
145 // so that this tribe can not be changed
146 egbase.add_player
147 (n, 0, // TODO(SirVer): initialization index makes no sense here
148- m_plr_set_tribes_buts[n - 1]->get_title(),
149+ m_tribe_descnames.find(m_selected_tribes[n])->second,
150 m_plr_names[n - 1]->text());
151
152 p = egbase.get_player(n);
153
154=== modified file 'src/editor/ui_menus/editor_player_menu.h'
155--- src/editor/ui_menus/editor_player_menu.h 2014-11-28 12:53:24 +0000
156+++ src/editor/ui_menus/editor_player_menu.h 2015-09-04 11:07:32 +0000
157@@ -21,6 +21,7 @@
158 #define WL_EDITOR_UI_MENUS_EDITOR_PLAYER_MENU_H
159
160 #include <cstring>
161+#include <map>
162 #include <string>
163 #include <vector>
164
165@@ -54,7 +55,14 @@
166 * m_plr_make_infrastructure_buts[MAX_PLAYERS],
167 * m_plr_set_pos_buts [MAX_PLAYERS],
168 * m_plr_set_tribes_buts [MAX_PLAYERS];
169- std::vector<std::string> m_tribes;
170+
171+ std::vector<std::string> m_tribenames;
172+
173+ /// tribename, descname
174+ std::map<std::string, std::string> m_tribe_descnames;
175+
176+ /// List of the tribes currently selected for all players
177+ std::string m_selected_tribes[MAX_PLAYERS];
178
179 int32_t m_posy;
180
181
182=== modified file 'src/logic/productionsite.cc'
183--- src/logic/productionsite.cc 2015-06-24 20:25:35 +0000
184+++ src/logic/productionsite.cc 2015-09-04 11:07:32 +0000
185@@ -317,7 +317,7 @@
186 else
187 color = UI_FONT_CLR_GOOD.hex_value();
188 const std::string perc_str =
189- (boost::format("<font color=%s>%i%%</font>") % color % percOk).str();
190+ (boost::format("<font color=%s>%s</font>") % color % (boost::format(_("%i%%")) % percOk)).str();
191
192 std::string trend;
193 if (lastPercOk > percOk) {
194
195=== modified file 'src/logic/ship.cc'
196--- src/logic/ship.cc 2015-08-31 19:40:34 +0000
197+++ src/logic/ship.cc 2015-09-04 11:07:32 +0000
198@@ -661,7 +661,7 @@
199 }
200 } else { // it seems that port constructionsite has dissapeared
201 // Send a message to the player, that a port constructionsite is gone
202- std::string msg_head = _("New port constructionsite is gone");
203+ std::string msg_head = _("New port construction site is gone");
204 std::string msg_body = _("Unloading of wares failed, expedition is cancelled now.");
205 send_message(game, msg_head, msg_body, "port.png");
206 send_signal(game, "cancel_expedition");
207
208=== modified file 'src/ui_fsmenu/loadgame.cc'
209--- src/ui_fsmenu/loadgame.cc 2015-09-04 06:16:58 +0000
210+++ src/ui_fsmenu/loadgame.cc 2015-09-04 11:07:32 +0000
211@@ -182,14 +182,14 @@
212 if (m_is_replay) {
213 /** TRANSLATORS: Tooltip for the "Mode" column when choosing a game/replay to load. */
214 /** TRANSLATORS: Make sure that you keep consistency in your translation. */
215- modes.push_back("SP = Single Player");
216+ modes.push_back(_("SP = Single Player"));
217 }
218 /** TRANSLATORS: Tooltip for the "Mode" column when choosing a game/replay to load. */
219 /** TRANSLATORS: Make sure that you keep consistency in your translation. */
220- modes.push_back("MP = Multiplayer");
221+ modes.push_back(_("MP = Multiplayer"));
222 /** TRANSLATORS: Tooltip for the "Mode" column when choosing a game/replay to load. */
223 /** TRANSLATORS: Make sure that you keep consistency in your translation. */
224- modes.push_back("H = Multiplayer (Host)");
225+ modes.push_back(_("H = Multiplayer (Host)"));
226 const std::string mode_tooltip_1 =
227 /** TRANSLATORS: Tooltip for the "Mode" column when choosing a game/replay to load. */
228 /** TRANSLATORS: %s is a list of game modes. */
229
230=== modified file 'src/ui_fsmenu/options.cc'
231--- src/ui_fsmenu/options.cc 2015-08-06 17:14:34 +0000
232+++ src/ui_fsmenu/options.cc 2015-09-04 11:07:32 +0000
233@@ -563,7 +563,7 @@
234 (this,
235 m_hmargin + m_message_sound.get_w() + m_padding, m_message_sound.get_y(),
236 get_w() - 2 * m_hmargin - m_message_sound.get_w() - m_padding, 40,
237- _("Play a sound at message arrival."),
238+ _("Play a sound at message arrival"),
239 UI::Align_VCenter),
240
241 m_nozip (this, Point(m_hmargin,
242@@ -573,7 +573,7 @@
243 (this,
244 m_hmargin + m_nozip.get_w() + m_padding, m_nozip.get_y(),
245 get_w() - 2 * m_hmargin - m_nozip.get_w() - m_padding, 40,
246- _("Do not zip widelands data files (maps, replays and savegames)."),
247+ _("Do not zip widelands data files (maps, replays and savegames)"),
248 UI::Align_VCenter),
249
250 m_remove_syncstreams (this, Point(m_hmargin,
251
252=== modified file 'src/wui/building_statistics_menu.cc'
253--- src/wui/building_statistics_menu.cc 2015-09-04 06:16:58 +0000
254+++ src/wui/building_statistics_menu.cc 2015-09-04 11:07:32 +0000
255@@ -664,6 +664,7 @@
256 color = UI_FONT_CLR_GOOD;
257 }
258 /** TRANSLATORS: Percent in building statistics window, e.g. 85% */
259+ /** TRANSLATORS: If you wish to add a space, translate as '%i %%' */
260 const std::string perc_str = (boost::format(_("%i%%")) % percent).str();
261 set_labeltext_autosize(productivity_labels_[id], perc_str, color);
262 }
263
264=== modified file 'tribes/atlanteans/horsebreeder/conf'
265--- tribes/atlanteans/horsebreeder/conf 2015-08-02 07:09:49 +0000
266+++ tribes/atlanteans/horsebreeder/conf 2015-09-04 11:07:32 +0000
267@@ -1,4 +1,4 @@
268-help=_"Breeds the strong Atlantean horses"
269+help=_"Breeds the strong Atlantean horses."
270
271 [buildcost]
272 carrier=1
273
274=== modified file 'utils/lua_xgettext.py'
275--- utils/lua_xgettext.py 2015-07-27 10:38:23 +0000
276+++ utils/lua_xgettext.py 2015-09-04 11:07:32 +0000
277@@ -277,7 +277,7 @@
278 comments = sorted(
279 set(f['translator_comment'] for f in occurences if 'translator_comment' in f))
280 for comment in comments:
281- lines.append('#: %s' % (comment))
282+ lines.append('#. %s' % (comment))
283 for occurence in occurences:
284 lines.append('#: %s:%i' % (os.path.normpath(occurence['filename']),
285 occurence['line']))

Subscribers

People subscribed via source and target branches

to status/vote changes: