← Back to team overview

widelands-dev team mailing list archive

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

 

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

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #768854 in widelands: "Messages for win condition "Territorial Lord" is not translated, even though translations exist"
  https://bugs.launchpad.net/widelands/+bug/768854

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

Bugfix for bug768854

I hope I didn't miss a function. Problem seems to be that lua does not translate from within inner (local) functions if you don't set the textdomain again inside that function.

Please review and consider other lua scripts as well where this may be a problem.
-- 
https://code.launchpad.net/~qcumber-some/widelands/bugfix-768854/+merge/83341
Your team Widelands Developers is requested to review the proposed merge of lp:~qcumber-some/widelands/bugfix-768854 into lp:widelands.
=== modified file 'scripting/win_conditions/00_endless_game.lua'
--- scripting/win_conditions/00_endless_game.lua	2010-09-12 11:17:13 +0000
+++ scripting/win_conditions/00_endless_game.lua	2011-11-24 19:57:29 +0000
@@ -13,6 +13,8 @@
 	name = wc_name,
 	description = wc_desc,
 	func = function()
+		set_textdomain("win_conditions")
+
 		local plrs = wl.Game().players
 
 		broadcast(plrs, wc_name, wc_desc)

=== modified file 'scripting/win_conditions/01_defeat_all.lua'
--- scripting/win_conditions/01_defeat_all.lua	2010-09-12 11:17:13 +0000
+++ scripting/win_conditions/01_defeat_all.lua	2011-11-24 19:57:29 +0000
@@ -6,13 +6,14 @@
 use("aux", "win_condition_functions")
 
 set_textdomain("win_conditions")
-
 local wc_name = _ "Autocrat"
 local wc_desc = _ "The tribe or team that can defeat all others wins the game!"
 return {
 	name = wc_name,
 	description = wc_desc,
 	func = function()
+		set_textdomain("win_conditions")
+
 		local plrs = wl.Game().players
 
 		broadcast(plrs, wc_name, wc_desc)

=== modified file 'scripting/win_conditions/02_collectors.lua'
--- scripting/win_conditions/02_collectors.lua	2011-11-06 00:06:25 +0000
+++ scripting/win_conditions/02_collectors.lua	2011-11-24 19:57:29 +0000
@@ -107,6 +107,8 @@
 
 -- Send all players the momentary game state
 local function _send_state(remaining_time, plrs)
+	set_textdomain("win_conditions")
+
 	local h = math.floor(remaining_time / 60)
 	local m = remaining_time % 60
 	local time = ""
@@ -130,6 +132,8 @@
 end
 
 local function _game_over(plrs)
+	set_textdomain("win_conditions")
+
 	local points = {}
 	for idx,plr in ipairs(plrs) do
 		points[#points + 1] = { plr, _calc_points(plr) }

=== modified file 'scripting/win_conditions/03_territorial_lord.lua'
--- scripting/win_conditions/03_territorial_lord.lua	2010-11-12 14:16:36 +0000
+++ scripting/win_conditions/03_territorial_lord.lua	2011-11-24 19:57:29 +0000
@@ -142,6 +142,8 @@
 		end
 
 		function _send_state()
+			set_textdomain("win_conditions")
+
 			local msg1 = _("%s owns more than half of the maps area."):format(currentcandidate)
 			msg1 = msg1 .. "\n"
 			msg1 = msg1 .. _("You still got %i minutes to prevent a victory."):format(remaining_time / 60)
@@ -162,6 +164,8 @@
 
 		-- Start a new coroutine that checks for defeated players
 		run(function()
+			set_textdomain("win_conditions")
+
 			sleep(5000)
 			check_player_defeated(plrs, _ "You are defeated!",
 				_ ("You have nothing to command left. If you want, you may " ..

=== modified file 'scripting/win_conditions/04_wood_gnome.lua'
--- scripting/win_conditions/04_wood_gnome.lua	2011-11-06 00:06:25 +0000
+++ scripting/win_conditions/04_wood_gnome.lua	2011-11-24 19:57:29 +0000
@@ -75,6 +75,8 @@
 	end
 
 	local function _send_state()
+		set_textdomain("win_conditions")
+
 		local playerpoints = _calc_points()
 		local msg = _("The game will end in %i minutes."):format(remaining_time)
 		msg = msg .. "\n\n"
@@ -89,6 +91,8 @@
 
 	-- Start a new coroutine that checks for defeated players
 	run(function()
+		set_textdomain("win_conditions")
+
 		sleep(5000)
 		check_player_defeated(plrs, _ "You are defeated!",
 			_ ("You have nothing to command left. If you want, you may " ..

=== modified file 'scripting/win_conditions/05_endless_game_fogless.lua'
--- scripting/win_conditions/05_endless_game_fogless.lua	2011-08-21 12:02:42 +0000
+++ scripting/win_conditions/05_endless_game_fogless.lua	2011-11-24 19:57:29 +0000
@@ -13,6 +13,8 @@
 	name = wc_name,
 	description = wc_desc,
 	func = function()
+		set_textdomain("win_conditions")
+
 		local plrs = wl.Game().players
 
 		broadcast(plrs, wc_name, wc_desc)