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/LV/cnc.lua | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-) diff --git a/technic/machines/LV/cnc.lua b/technic/machines/LV/cnc.lua index f58f9df..8ade480 100644 --- a/technic/machines/LV/cnc.lua +++ b/technic/machines/LV/cnc.lua @@ -7,6 +7,7 @@ -- I could imagine some form of API allowing modders to come with their own node -- box definitions and easily stuff it in the this machine for production. +local S = technic.getter local shape = {} local onesize_products = { @@ -126,7 +127,7 @@ -- The actual block inactive state minetest.register_node("technic:cnc", { - description = "CNC Milling Machine", + description = S("CNC Machine"), tiles = {"technic_cnc_top.png", "technic_cnc_bottom.png", "technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front.png"}, drawtype = "nodebox", @@ -142,7 +143,7 @@ legacy_facedir_simple = true, on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("infotext", "CNC Machine") + meta:set_string("infotext", S("CNC Machine")) meta:set_float("technic_power_machine", 1) meta:set_string("formspec", cnc_formspec) local inv = meta:get_inventory() @@ -154,7 +155,7 @@ local inv = meta:get_inventory() if not inv:is_empty("src") or not inv:is_empty("dst") 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 @@ -165,7 +166,7 @@ -- Active state block minetest.register_node("technic:cnc_active", { - description = "CNC Machine", + description = S("CNC Machine"), tiles = {"technic_cnc_top_active.png", "technic_cnc_bottom.png", "technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front_active.png"}, paramtype2 = "facedir", @@ -176,7 +177,7 @@ local inv = meta:get_inventory() if not inv:is_empty("src") or not inv:is_empty("dst") then minetest.chat_send_player(player:get_player_name(), - "CNC machine cannot be removed because it is not empty"); + S("Machine cannot be removed because it is not empty")) return false end return true @@ -193,7 +194,7 @@ local meta = minetest.get_meta(pos) local inv = meta:get_inventory() local eu_input = meta:get_int("LV_EU_input") - local machine_name = "CNC" + local machine_name = S("CNC Machine") local machine_node = "technic:cnc" local demand = 450 @@ -213,17 +214,17 @@ (not minetest.registered_nodes[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_string("cnc_product", "") return end if eu_input < demand then 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 >= demand then 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") >= 3 then -- 3 ticks per output meta:set_int("src_time", 0) -- Gitblit v1.8.0