Merge lp:~widelands-dev/widelands/bug-1505723 into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 7634
Proposed branch: lp:~widelands-dev/widelands/bug-1505723
Merge into: lp:widelands
Diff against target: 177 lines (+60/-20)
11 files modified
tribes/buildings/productionsites/atlanteans/blackroot_farm/helptexts.lua (+2/-2)
tribes/buildings/productionsites/atlanteans/farm/helptexts.lua (+2/-2)
tribes/buildings/productionsites/barbarians/farm/helptexts.lua (+2/-2)
tribes/buildings/productionsites/empire/bakery/helptexts.lua (+2/-2)
tribes/buildings/productionsites/empire/brewery/helptexts.lua (+2/-2)
tribes/buildings/productionsites/empire/farm/helptexts.lua (+2/-2)
tribes/buildings/productionsites/empire/inn/helptexts.lua (+2/-2)
tribes/buildings/productionsites/empire/mill/helptexts.lua (+2/-2)
tribes/buildings/productionsites/empire/piggery/helptexts.lua (+2/-2)
tribes/buildings/productionsites/empire/tavern/helptexts.lua (+2/-2)
tribes/scripting/help/global_helptexts.lua (+40/-0)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1505723
Reviewer Review Type Date Requested Status
TiborB Approve
GunChleoc Needs Resubmitting
Review via email: mp+278174@code.launchpad.net

Description of the change

Added new performance calculations to help files.

To post a comment you must log in.
Revision history for this message
GunChleoc (gunchleoc) wrote :

Removed some crud from the diff.

review: Needs Resubmitting
Revision history for this message
TiborB (tiborb95) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tribes/buildings/productionsites/atlanteans/blackroot_farm/helptexts.lua'
2--- tribes/buildings/productionsites/atlanteans/blackroot_farm/helptexts.lua 2015-11-07 08:45:50 +0000
3+++ tribes/buildings/productionsites/atlanteans/blackroot_farm/helptexts.lua 2015-11-21 10:36:05 +0000
4@@ -22,6 +22,6 @@
5 end
6
7 function building_helptext_performance()
8- -- #TRANSLATORS: Performance helptext for a building
9- return no_performance_text_yet()
10+ -- TRANSLATORS: Performance helptext for a building
11+ return pgettext("atlanteans_building", "The blackroot farmer needs %1% on average to sow and harvest a bundle of blackroot."):bformat(format_minutes_seconds(1, 20))
12 end
13
14=== modified file 'tribes/buildings/productionsites/atlanteans/farm/helptexts.lua'
15--- tribes/buildings/productionsites/atlanteans/farm/helptexts.lua 2015-11-08 13:59:37 +0000
16+++ tribes/buildings/productionsites/atlanteans/farm/helptexts.lua 2015-11-21 10:36:05 +0000
17@@ -22,6 +22,6 @@
18 end
19
20 function building_helptext_performance()
21- -- #TRANSLATORS: Performance helptext for a building
22- return no_performance_text_yet()
23+ -- TRANSLATORS: Performance helptext for a building
24+ return pgettext("atlanteans_building", "The farmer needs %1% on average to sow and harvest a sheaf of corn."):bformat(format_minutes_seconds(1, 20))
25 end
26
27=== modified file 'tribes/buildings/productionsites/barbarians/farm/helptexts.lua'
28--- tribes/buildings/productionsites/barbarians/farm/helptexts.lua 2015-11-08 11:49:22 +0000
29+++ tribes/buildings/productionsites/barbarians/farm/helptexts.lua 2015-11-21 10:36:05 +0000
30@@ -22,6 +22,6 @@
31 end
32
33 function building_helptext_performance()
34- -- #TRANSLATORS: Performance helptext for a building
35- return no_performance_text_yet()
36+ -- TRANSLATORS: Performance helptext for a building
37+ return pgettext("barbarians_building", "The farmer needs %1% on average to sow and harvest a sheaf of wheat."):bformat(format_minutes_seconds(1, 40))
38 end
39
40=== modified file 'tribes/buildings/productionsites/empire/bakery/helptexts.lua'
41--- tribes/buildings/productionsites/empire/bakery/helptexts.lua 2015-11-08 11:35:51 +0000
42+++ tribes/buildings/productionsites/empire/bakery/helptexts.lua 2015-11-21 10:36:05 +0000
43@@ -22,6 +22,6 @@
44 end
45
46 function building_helptext_performance()
47- -- #TRANSLATORS: Performance helptext for a building
48- return no_performance_text_yet()
49+ -- TRANSLATORS: Performance helptext for a building
50+ return pgettext("empire_building", "The baker needs %1% on average to bake a loaf of bread."):bformat(format_seconds(34))
51 end
52
53=== modified file 'tribes/buildings/productionsites/empire/brewery/helptexts.lua'
54--- tribes/buildings/productionsites/empire/brewery/helptexts.lua 2015-11-08 11:49:22 +0000
55+++ tribes/buildings/productionsites/empire/brewery/helptexts.lua 2015-11-21 10:36:05 +0000
56@@ -22,6 +22,6 @@
57 end
58
59 function building_helptext_performance()
60- -- #TRANSLATORS: Performance helptext for a building
61- return no_performance_text_yet()
62+ -- TRANSLATORS: Performance helptext for a building
63+ return pgettext("empire_building", "The brewer needs %1% on average to brew a vat of beer."):bformat(format_minutes_seconds(1, 5))
64 end
65
66=== modified file 'tribes/buildings/productionsites/empire/farm/helptexts.lua'
67--- tribes/buildings/productionsites/empire/farm/helptexts.lua 2015-11-08 11:49:22 +0000
68+++ tribes/buildings/productionsites/empire/farm/helptexts.lua 2015-11-21 10:36:05 +0000
69@@ -22,6 +22,6 @@
70 end
71
72 function building_helptext_performance()
73- -- #TRANSLATORS: Performance helptext for a building
74- return no_performance_text_yet()
75+ -- TRANSLATORS: Performance helptext for a building
76+ return pgettext("empire_building", "The farmer needs %1% on average to sow and harvest a sheaf of wheat."):bformat(format_minutes_seconds(1, 20))
77 end
78
79=== modified file 'tribes/buildings/productionsites/empire/inn/helptexts.lua'
80--- tribes/buildings/productionsites/empire/inn/helptexts.lua 2015-11-08 11:35:51 +0000
81+++ tribes/buildings/productionsites/empire/inn/helptexts.lua 2015-11-21 10:36:05 +0000
82@@ -22,6 +22,6 @@
83 end
84
85 function building_helptext_performance()
86- -- #TRANSLATORS: Performance helptext for a building
87- return no_performance_text_yet()
88+ -- TRANSLATORS: Performance helptext for a building
89+ return pgettext("empire_building", "The innkeeper needs %1% on average to prepare a ration and a meal. If the economy doesn’t need both, the innkeeper needs %2% on average to prepare one ration or one meal."):bformat(format_minutes_seconds(1, 25), format_seconds(48))
90 end
91
92=== modified file 'tribes/buildings/productionsites/empire/mill/helptexts.lua'
93--- tribes/buildings/productionsites/empire/mill/helptexts.lua 2015-11-08 11:49:22 +0000
94+++ tribes/buildings/productionsites/empire/mill/helptexts.lua 2015-11-21 10:36:05 +0000
95@@ -22,6 +22,6 @@
96 end
97
98 function building_helptext_performance()
99- -- #TRANSLATORS: Performance helptext for a building
100- return no_performance_text_yet()
101+ -- TRANSLATORS: Performance helptext for a building
102+ return pgettext("empire_building", "The miller needs %1% on average to grind wheat into a sack of corn."):bformat(format_seconds(19))
103 end
104
105=== modified file 'tribes/buildings/productionsites/empire/piggery/helptexts.lua'
106--- tribes/buildings/productionsites/empire/piggery/helptexts.lua 2015-11-08 11:35:51 +0000
107+++ tribes/buildings/productionsites/empire/piggery/helptexts.lua 2015-11-21 10:36:05 +0000
108@@ -22,6 +22,6 @@
109 end
110
111 function building_helptext_performance()
112- -- #TRANSLATORS: Performance helptext for a building
113- return no_performance_text_yet()
114+ -- TRANSLATORS: Performance helptext for a building
115+ return pgettext("empire_building", "The pig breeder needs %1% on average to raise and slaughter a pig."):bformat(format_minutes(1))
116 end
117
118=== modified file 'tribes/buildings/productionsites/empire/tavern/helptexts.lua'
119--- tribes/buildings/productionsites/empire/tavern/helptexts.lua 2015-11-08 11:35:51 +0000
120+++ tribes/buildings/productionsites/empire/tavern/helptexts.lua 2015-11-21 10:36:05 +0000
121@@ -22,6 +22,6 @@
122 end
123
124 function building_helptext_performance()
125- -- #TRANSLATORS: Performance helptext for a building
126- return no_performance_text_yet()
127+ -- TRANSLATORS: Performance helptext for a building
128+ return pgettext("empire_building", "The innkeeper needs %1% on average to prepare a ration."):bformat(format_seconds(36))
129 end
130
131=== modified file 'tribes/scripting/help/global_helptexts.lua'
132--- tribes/scripting/help/global_helptexts.lua 2015-10-31 12:11:44 +0000
133+++ tribes/scripting/help/global_helptexts.lua 2015-11-21 10:36:05 +0000
134@@ -45,3 +45,43 @@
135 -- TRANSLATORS: Performance helptext for a building - it hasn't been written yet.
136 return _"Calculation needed"
137 end
138+
139+-- RST
140+-- .. function:: format_seconds(seconds)
141+--
142+-- :arg seconds: number of seconds
143+--
144+-- Returns a localized string to tell the time in seconds with the proper plural form.
145+-- :returns: "1 second", or "20 seconds" etc.
146+--
147+function format_seconds(seconds)
148+ return ngettext("%d second", "%d seconds", seconds):bformat(seconds)
149+end
150+
151+-- RST
152+-- .. function:: format_minutes(minutes)
153+--
154+-- :arg minutes: number of minutes
155+--
156+-- Returns a localized string to tell the time in minutes with the proper plural form.
157+-- :returns: "1 minute", or "20 minutes" etc.
158+--
159+function format_minutes(minutes)
160+ return ngettext("%d minute", "%d minutes", minutes):bformat(minutes)
161+end
162+
163+-- RST
164+-- .. function:: format_minutes_seconds(minutes, seconds)
165+--
166+-- :arg minutes: number of minutes
167+-- :arg seconds: number of seconds
168+--
169+-- Returns a localized string to tell the time in minutes and seconds with the proper plural form.
170+-- :returns: "1 minute and 20 seconds" etc.
171+--
172+function format_minutes_seconds(minutes, seconds)
173+ return _("%1% and %2%"):bformat(
174+ ngettext("%d minute", "%d minutes", minutes):bformat(minutes),
175+ ngettext("%d second", "%d seconds", seconds):bformat(seconds)
176+ )
177+end

Subscribers

People subscribed via source and target branches

to status/vote changes: