From be2f30a1a2f5b6c2aae7fd4cf8231aec2da0844d Mon Sep 17 00:00:00 2001
From: ShadowNinja <noreply@gmail.com>
Date: Wed, 30 Oct 2013 18:48:39 +0100
Subject: [PATCH] Add support for translations via intllib

---
 technic/machines/register/alloy_furnace.lua |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/technic/machines/register/alloy_furnace.lua b/technic/machines/register/alloy_furnace.lua
index bbae151..a3da4fe 100644
--- a/technic/machines/register/alloy_furnace.lua
+++ b/technic/machines/register/alloy_furnace.lua
@@ -1,3 +1,6 @@
+
+local S = technic.getter
+
 -- Register alloy recipes
 technic.alloy_recipes = {}
 
@@ -79,7 +82,7 @@
 
 	local formspec =
 		"invsize[8,10;]"..
-		"label[0,0;"..tier.." Alloy Furnace]"..
+		"label[0,0;"..S("%s Alloy Furnace"):format(tier).."]"..
 		"list[current_name;src;3,1;1,2;]"..
 		"list[current_name;dst;5,1;2,2;]"..
 		"list[current_player;main;0,6;8,4;]"
@@ -107,7 +110,7 @@
 	}
 
 	minetest.register_node("technic:"..ltier.."_alloy_furnace", {
-		description = tier.." Alloy Furnace",
+		description = S("%s Alloy Furnace"):format(tier),
 		tiles = {"technic_"..ltier.."_alloy_furnace_top.png",
 		         "technic_"..ltier.."_alloy_furnace_bottom.png",
 			 tube_side_texture,
@@ -126,7 +129,7 @@
 			local data = minetest.registered_nodes[name].technic
 
 
-			meta:set_string("infotext", data.tier.." Alloy furnace")
+			meta:set_string("infotext", S("%s Alloy Furnace"):format(data.tier))
 			meta:set_string("formspec", data.formspec)
 			meta:set_int("tube_time",  0)
 			local inv = meta:get_inventory()
@@ -141,7 +144,7 @@
 			if not inv:is_empty("src") or not inv:is_empty("dst") or
 			   not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
 				minetest.chat_send_player(player:get_player_name(),
-					"Machine cannot be removed because it is not empty");
+					S("Machine cannot be removed because it is not empty"))
 				return false
 			else
 				return true
@@ -150,7 +153,7 @@
 	})
 
 	minetest.register_node("technic:"..ltier.."_alloy_furnace_active",{
-		description = tier.." Alloy Furnace",
+		description = S(tier.." Alloy Furnace"),
 		tiles = {"technic_"..ltier.."_alloy_furnace_top.png",
 		         "technic_"..ltier.."_alloy_furnace_bottom.png",
 			 tube_side_texture,
@@ -171,7 +174,7 @@
 			if not inv:is_empty("src") or not inv:is_empty("dst") or
 			   not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
 				minetest.chat_send_player(player:get_player_name(),
-					"Machine cannot be removed because it is not empty");
+					S("Machine cannot be removed because it is not empty"))
 				return false
 			else
 				return true
@@ -208,7 +211,7 @@
 			local eu_input     = meta:get_int(data.tier.."_EU_input")
 
 			-- Machine information
-			local machine_name   = data.tier.." Alloy Furnace"
+			local machine_name   = S("%s Alloy Furnace"):format(data.tier)
 			local machine_node   = "technic:"..string.lower(data.tier).."_alloy_furnace"
 			local machine_demand = data.demand
 
@@ -243,7 +246,7 @@
 			if not result or
 			   not inv:room_for_item("dst", result) then
 				hacky_swap_node(pos, machine_node)
-				meta:set_string("infotext", machine_name.." Idle")
+				meta:set_string("infotext", S("%s Idle"):format(machine_name))
 				meta:set_int(data.tier.."_EU_demand", 0)
 				return
 			end
@@ -251,11 +254,11 @@
 			if eu_input < machine_demand[EU_upgrade+1] then
 				-- Unpowered - go idle
 				hacky_swap_node(pos, machine_node)
-				meta:set_string("infotext", machine_name.." Unpowered")
+				meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
 			elseif eu_input >= machine_demand[EU_upgrade+1] then
 				-- Powered
 				hacky_swap_node(pos, machine_node.."_active")
-				meta:set_string("infotext", machine_name.." Active")
+				meta:set_string("infotext", S("%s Active"):format(machine_name))
 				meta:set_int("src_time", meta:get_int("src_time") + 1)
 				if meta:get_int("src_time") == data.cook_time then
 					meta:set_int("src_time", 0)

--
Gitblit v1.8.0