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

Proposed by GunChleoc
Status: Merged
Merged at revision: 8655
Proposed branch: lp:~widelands-dev/widelands/string-fixes
Merge into: lp:widelands
Diff against target: 163 lines (+52/-46)
5 files modified
data/scripting/richtext.lua (+1/-1)
data/scripting/win_conditions/artifacts.lua (+3/-8)
data/tribes/scripting/help/building_help.lua (+3/-29)
data/tribes/scripting/help/format_help.lua (+44/-0)
data/tribes/scripting/help/immovable_help.lua (+1/-8)
To merge this branch: bzr merge lp:~widelands-dev/widelands/string-fixes
Reviewer Review Type Date Requested Status
Benedikt Straub Approve
Review via email: mp+342037@code.launchpad.net

Commit message

Fixed issues with trailing whitespaces in translatable strings, because they lead to translation mistakes
- Using localize_list in artifacts.lua.
- Got rid of trailing whitespace in _"Spare required: " string and added it back into the UI.

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

Continuous integration builds have changed state:

Travis build 3308. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/357809865.
Appveyor build 3115. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_string_fixes-3115.

Revision history for this message
Benedikt Straub (nordfriese) wrote :

Proofread the changes, everything looks good to me.
Tested the in-game help and played a quick artifacts game; it all works as it should.

review: Approve
Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks a lot for the review :)

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/scripting/richtext.lua'
2--- data/scripting/richtext.lua 2018-03-15 02:38:55 +0000
3+++ data/scripting/richtext.lua 2018-03-24 14:41:09 +0000
4@@ -516,7 +516,7 @@
5 --
6 -- :arg items: An array of strings
7 -- :arg listtype: The type of concatenation to use.
8--- Legal values are "&", "and", "or", and ";"
9+-- Legal values are "&", "and", "or", and ","
10 -- :arg former_textdomain: The textdomain to restore after running this function.
11 -- :returns: The concatenated list string, using localized concatenation operators.
12 --
13
14=== modified file 'data/scripting/win_conditions/artifacts.lua'
15--- data/scripting/win_conditions/artifacts.lua 2017-05-12 11:30:43 +0000
16+++ data/scripting/win_conditions/artifacts.lua 2018-03-24 14:41:09 +0000
17@@ -134,16 +134,11 @@
18 local max_artifacts = _max(artifacts_per_team)
19
20 local function _get_member_names(t)
21- local s = ""
22+ local membernames = {}
23 for idx, plr in ipairs(t) do
24- if s == "" then
25- s = plr.name
26- else
27- -- TRANSLATORS: This is used to seperate players’ names in a list, e.g. "Steve, Robert, David"
28- s = s .. _", " .. plr.name
29- end
30+ table.insert(membernames, plr.name)
31 end
32- return s
33+ return localize_list(membernames, ",", "win_conditions")
34 end
35
36 local teams = {}
37
38=== modified file 'data/tribes/scripting/help/building_help.lua'
39--- data/tribes/scripting/help/building_help.lua 2018-01-10 16:21:50 +0000
40+++ data/tribes/scripting/help/building_help.lua 2018-03-24 14:41:09 +0000
41@@ -15,24 +15,6 @@
42 -- =======================================================
43
44 -- RST
45--- .. function:: building_section_line(header, text, image)
46---
47--- Creates a line of h3 formatted text followed by normal text and an image.
48---
49--- :arg t1: header text.
50--- :arg t2: in-line paragraphs text.
51--- :arg image: image to be aligned right.
52--- :returns: header followed by normal text and image.
53---
54-function building_section_line(header, text, image)
55- return
56- div("width=100%",
57- div("width=50%", p_font("size=13 color=D1D1D1", vspace(6) .. text .. space(6))) ..
58- div("width=*", p("align=right", vspace(6) .. img(image) .. vspace(12)))
59- )
60-end
61-
62--- RST
63 -- .. function:: dependencies_basic(images[, text = nil])
64 --
65 -- Creates a dependencies line of any length.
66@@ -460,19 +442,11 @@
67
68 -- Space required
69 if (building_description.is_mine) then
70- result = result .. building_section_line(_"Space required:",_"Mine plot","images/wui/overlays/mine.png")
71+ result = result .. plot_size_line("mine")
72 elseif (building_description.is_port) then
73- result = result .. building_section_line(_"Space required:",_"Port plot","images/wui/overlays/port.png")
74+ result = result .. plot_size_line("port")
75 else
76- if (building_description.size == "small") then
77- result = result .. building_section_line(_"Space required:",_"Small plot","images/wui/overlays/small.png")
78- elseif (building_description.size == "medium") then
79- result = result .. building_section_line(_"Space required:",_"Medium plot","images/wui/overlays/medium.png")
80- elseif (building_description.size == "big") then
81- result = result .. building_section_line(_"Space required:",_"Big plot","images/wui/overlays/big.png")
82- else
83- result = result .. p(_"Space required:" .. _"Unknown")
84- end
85+ result = result .. plot_size_line(building_description.size)
86 end
87
88 -- Enhanced from
89
90=== modified file 'data/tribes/scripting/help/format_help.lua'
91--- data/tribes/scripting/help/format_help.lua 2018-02-25 11:29:14 +0000
92+++ data/tribes/scripting/help/format_help.lua 2018-03-24 14:41:09 +0000
93@@ -37,6 +37,50 @@
94 )
95 end
96
97+-- RST
98+-- .. function:: plot_size_line(size)
99+--
100+-- Creates a line describing space required on the map.
101+-- Consists of a header colored text, followed by normal text and an image.
102+--
103+-- :arg size: size key. Expected values are "mine", "port", "small, "medium", "big", "none".
104+-- :returns: header followed by normal text and image if a space is required, or empty string.
105+--
106+function plot_size_line(size)
107+ local text = ""
108+ local image = ""
109+ if (size == "mine") then
110+ -- TRANSLATORS: Space on the map required for building a building there
111+ text = _"Mine plot"
112+ image = "images/wui/overlays/mine.png"
113+ elseif (size == "port") then
114+ -- TRANSLATORS: Space on the map required for building a building there
115+ text = _"Port plot"
116+ image = "images/wui/overlays/port.png"
117+ elseif (size == "small") then
118+ -- TRANSLATORS: Space on the map required for building a building there
119+ text = _"Small plot"
120+ image = "images/wui/overlays/small.png"
121+ elseif (size == "medium") then
122+ -- TRANSLATORS: Space on the map required for building a building there
123+ text = _"Medium plot"
124+ image = "images/wui/overlays/medium.png"
125+ elseif (size == "big") then
126+ -- TRANSLATORS: Space on the map required for building a building there
127+ text = _"Big plot"
128+ image = "images/wui/overlays/big.png"
129+ else
130+ return ""
131+ end
132+
133+ return
134+ div("width=100%",
135+ div("float=right padding_l=6", p(img(image))) ..
136+ -- TRANSLATORS: Space on the map required for building a building there
137+ p(join_sentences(font("size=13 color=D1D1D1", _"Space required:"), text))
138+ )
139+end
140+
141
142 -- =======================================================
143 -- ********** Helper functions for dependencies **********
144
145=== modified file 'data/tribes/scripting/help/immovable_help.lua'
146--- data/tribes/scripting/help/immovable_help.lua 2018-01-29 16:38:16 +0000
147+++ data/tribes/scripting/help/immovable_help.lua 2018-03-24 14:41:09 +0000
148@@ -42,14 +42,7 @@
149 end
150
151 -- Space required
152- local space_required = ""
153- if (immovable_description.size == "small") then
154- space_required = space_required .. image_line("images/wui/overlays/small.png", 1, _"Space required: " .. _"Small plot")
155- elseif (immovable_description.size == "medium") then
156- space_required = space_required .. image_line("images/wui/overlays/medium.png", 1, _"Space required: " .. _"Medium plot")
157- elseif (immovable_description.size == "big") then
158- space_required = space_required .. image_line("images/wui/overlays/big.png", 1, _"Space required: " .. _"Big plot")
159- end
160+ local space_required = plot_size_line(immovable_description.size)
161
162 if (buildcost ~= "" or space_required ~= "") then
163 result = result .. h2(_"Requirements")

Subscribers

People subscribed via source and target branches

to status/vote changes: