Fix more translation strings (#2487)
authorsfan5 <sfan5@live.de>
Wed, 18 Sep 2019 18:38:27 +0000 (20:38 +0200)
committerGitHub <noreply@github.com>
Wed, 18 Sep 2019 18:38:27 +0000 (20:38 +0200)
game_api.txt
mods/beds/functions.lua
mods/creative/inventory.lua
mods/default/craftitems.lua
mods/default/nodes.lua
mods/farming/api.lua
mods/farming/init.lua
mods/farming/nodes.lua
mods/sfinv/init.lua

index 6ddeb9806bc851f7a94b09a44b08d67651c18652..a066a087c1677a3e91e02afda870ece50b434603 100644 (file)
@@ -359,6 +359,8 @@ The farming API allows you to easily register plants and hoes.
 
        {
                description = "",                      -- Description of seed item
+               harvest_description = "",              -- Description of harvest item
+                                                      -- (optional, derived automatically if not provided)
                inventory_image = "unknown_item.png",  -- Image to be used as seed's wield- and inventory image
                steps = 8,                             -- How many steps the plant has to grow, until it can be harvested
                -- ^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber)
index ae632a989d4267c4ddd92fdced0eea19f3d09751..0b79bfb512041c0a58b60bb39529ba178d31ae29 100644 (file)
@@ -5,6 +5,9 @@ if enable_respawn == nil then
        enable_respawn = true
 end
 
+-- support for MT game translation.
+local S = beds.get_translator
+
 -- Helper functions
 
 local function get_look_yaw(pos)
@@ -108,17 +111,19 @@ end
 
 local function update_formspecs(finished)
        local ges = #minetest.get_connected_players()
-       local form_n
        local player_in_bed = get_player_in_bed_count()
        local is_majority = (ges / 2) < player_in_bed
 
+       local form_n
+       local esc = minetest.formspec_escape
        if finished then
-               form_n = beds.formspec .. "label[2.7,9; Good morning.]"
+               form_n = beds.formspec .. "label[2.7,9;" .. esc(S("Good morning.")) .. "]"
        else
-               form_n = beds.formspec .. "label[2.2,9;" .. tostring(player_in_bed) ..
-                       " of " .. tostring(ges) .. " players are in bed]"
+               form_n = beds.formspec .. "label[2.2,9;" ..
+                       esc(S("@1 of @2 players are in bed", player_in_bed, ges)) .. "]"
                if is_majority and is_night_skip_enabled() then
-                       form_n = form_n .. "button_exit[2,6;4,0.75;force;Force night skip]"
+                       form_n = form_n .. "button_exit[2,6;4,0.75;force;" ..
+                               esc(S("Force night skip")) .. "]"
                end
        end
 
@@ -150,7 +155,7 @@ function beds.on_rightclick(pos, player)
                if beds.player[name] then
                        lay_down(player, nil, nil, false)
                end
-               minetest.chat_send_player(name, "You can only sleep at night.")
+               minetest.chat_send_player(name, S("You can only sleep at night."))
                return
        end
 
index 08402046952edfbca2dc5f9307ca68c802f21e0e..27dee782db69b8e64f741b333795cdd397fa7381 100644 (file)
@@ -108,6 +108,7 @@ function creative.register_tab(name, title, items)
                        local start_i = inv.start_i or 0
                        local pagenum = math.floor(start_i / (3*8) + 1)
                        local pagemax = math.ceil(inv.size / (3*8))
+                       local esc = minetest.formspec_escape
                        return sfinv.make_formspec(player, context,
                                "label[6.2,3.35;" .. minetest.colorize("#FFFF00", tostring(pagenum)) .. " / " .. tostring(pagemax) .. "]" ..
                                [[
@@ -119,14 +120,14 @@ function creative.register_tab(name, title, items)
                                        image_button[7.2,3.25;0.8,0.8;creative_next_icon.png;creative_next;]
                                        image_button[2.1,3.25;0.8,0.8;creative_search_icon.png;creative_search;]
                                        image_button[2.75,3.25;0.8,0.8;creative_clear_icon.png;creative_clear;]
-                                       tooltip[creative_search;S("Search")]
-                                       tooltip[creative_clear;S("Reset")]
-                                       tooltip[creative_prev;S("Previous page")]
-                                       tooltip[creative_next;S("Next page")]
-                                       listring[current_player;main]
-                                       field_close_on_enter[creative_filter;false]
                                ]] ..
-                               "field[0.3,3.5;2.2,1;creative_filter;;" .. minetest.formspec_escape(inv.filter) .. "]" ..
+                               "tooltip[creative_search;" .. esc(S("Search")) .. "]" ..
+                               "tooltip[creative_clear;" .. esc(S("Reset")) .. "]" ..
+                               "tooltip[creative_prev;" .. esc(S("Previous page")) .. "]" ..
+                               "tooltip[creative_next;" .. esc(S("Next page")) .. "]" ..
+                               "listring[current_player;main]" ..
+                               "field_close_on_enter[creative_filter;false]" ..
+                               "field[0.3,3.5;2.2,1;creative_filter;;" .. esc(inv.filter) .. "]" ..
                                "listring[detached:creative_" .. player_name .. ";main]" ..
                                "list[detached:creative_" .. player_name .. ";main;0,0;8,3;" .. tostring(start_i) .. "]" ..
                                creative.formspec_add, true)
index dd76d1e57b4d207221460b907d1958cdf3602668..e2e92bf2509a58176dd3f08c952fc2f0fb81cedf 100644 (file)
@@ -52,23 +52,24 @@ local function book_on_use(itemstack, user)
        end
 
        local formspec
+       local esc = minetest.formspec_escape
        if owner == player_name then
                formspec = "size[8,8]" ..
-                       "field[0.5,1;7.5,0;title;Title:;" ..
-                               minetest.formspec_escape(title) .. "]" ..
-                       "textarea[0.5,1.5;7.5,7;text;Contents:;" ..
-                               minetest.formspec_escape(text) .. "]" ..
-                       "button_exit[2.5,7.5;3,1;save;Save]"
+                       "field[0.5,1;7.5,0;title;" .. esc(S("Title:")) .. ";" ..
+                               esc(title) .. "]" ..
+                       "textarea[0.5,1.5;7.5,7;text;" .. esc(S("Contents:")) .. ";" ..
+                               esc(text) .. "]" ..
+                       "button_exit[2.5,7.5;3,1;save;" .. esc(S("Save")) .. "]"
        else
                formspec = "size[8,8]" ..
-                       "label[0.5,0.5;by " .. owner .. "]" ..
+                       "label[0.5,0.5;" .. esc(S("by @1", owner)) .. "]" ..
                        "tablecolumns[color;text]" ..
                        "tableoptions[background=#00000000;highlight=#00000000;border=false]" ..
-                       "table[0.4,0;7,0.5;title;#FFFF00," .. minetest.formspec_escape(title) .. "]" ..
+                       "table[0.4,0;7,0.5;title;#FFFF00," .. esc(title) .. "]" ..
                        "textarea[0.5,1.5;7.5,7;;" ..
                                minetest.formspec_escape(string ~= "" and string or text) .. ";]" ..
                        "button[2.4,7.6;0.8,0.8;book_prev;<]" ..
-                       "label[3.2,7.7;Page " .. page .. " of " .. page_max .. "]" ..
+                       "label[3.2,7.7;" .. esc(S("Page @1 of @2", page, page_max)) .. "]" ..
                        "button[4.9,7.6;0.8,0.8;book_next;>]"
        end
 
index 5dbee7d030fc194c876bb489031088dd3601b739..cee1242a6e2d5cfa0cebb289efe1bcd4bd4ecdd8 100644 (file)
@@ -2604,7 +2604,7 @@ local function register_sign(material, desc, def)
                        meta:set_string("text", text)
 
                        if #text > 0 then
-                               meta:set_string("infotext", '"' .. text .. '"')
+                               meta:set_string("infotext", S('"@1"', text))
                        else
                                meta:set_string("infotext", '')
                        end
index 6c13b11b66acb03ef0ae10906a83e9fd0be84a5b..c2c549e432fd1a826822d3059b1f880ff1e156cf 100644 (file)
@@ -257,6 +257,9 @@ farming.register_plant = function(name, def)
        if not def.description then
                def.description = S("Seed")
        end
+       if not def.harvest_description then
+               def.harvest_description = pname:gsub("^%l", string.upper)
+       end
        if not def.inventory_image then
                def.inventory_image = "unknown_item.png"
        end
@@ -325,7 +328,7 @@ farming.register_plant = function(name, def)
 
        -- Register harvest
        minetest.register_craftitem(":" .. mname .. ":" .. pname, {
-               description = pname:gsub("^%l", string.upper),
+               description = def.harvest_description,
                inventory_image = mname .. "_" .. pname .. ".png",
                groups = def.groups or {flammable = 2},
        })
index 2344d45ee6c719d167752a28eef4d28253e1dd86..e6dfd579f5a5ddd7344ed50b672e4f108b25d25b 100644 (file)
@@ -20,6 +20,7 @@ dofile(farming.path .. "/hoes.lua")
 
 farming.register_plant("farming:wheat", {
        description = S("Wheat Seed"),
+       harvest_description = S("Wheat"),
        paramtype2 = "meshoptions",
        inventory_image = "farming_wheat_seed.png",
        steps = 8,
@@ -61,6 +62,7 @@ minetest.register_craft({
 
 farming.register_plant("farming:cotton", {
        description = S("Cotton Seed"),
+       harvest_description = S("Cotton"),
        inventory_image = "farming_cotton_seed.png",
        steps = 8,
        minlight = 13,
index 806f46d4a7307485204961348074879d093542e6..22dd51c82ccb3f531f01e97ecd0a0bcb33e2bc81 100644 (file)
@@ -153,16 +153,21 @@ minetest.register_node("farming:straw", {
        sounds = default.node_sound_leaves_defaults(),
 })
 
-stairs.register_stair_and_slab(
-       "straw",
-       "farming:straw",
-       {snappy = 3, flammable = 4},
-       {"farming_straw.png"},
-       S("Straw Stair"),
-       S("Straw Slab"),
-       default.node_sound_leaves_defaults(),
-       true
-)
+do
+       local recipe = "farming:straw"
+       local groups = {snappy = 3, flammable = 4}
+       local images = {"farming_straw.png"}
+       local sounds = default.node_sound_leaves_defaults()
+
+       stairs.register_stair("straw", recipe, groups, images, S("Straw Stair"),
+               sounds, true)
+       stairs.register_stair_inner("straw", recipe, groups, images, "",
+               sounds, true, S("Inner Straw Stair"))
+       stairs.register_stair_outer("straw", recipe, groups, images, "",
+               sounds, true, S("Outer Straw Stair"))
+       stairs.register_slab("straw", recipe, groups, images, S("Straw Slab"),
+               sounds, true)
+end
 
 minetest.register_abm({
        label = "Farming soil",
index e9021396250c4ec13b8866ad99b479bb03de0be8..71e9ee705cb447a2f4226e3ddb26aabc03da830c 100644 (file)
@@ -2,8 +2,11 @@
 
 dofile(minetest.get_modpath("sfinv") .. "/api.lua")
 
+-- Load support for MT game translation.
+local S = minetest.get_translator("sfinv")
+
 sfinv.register_page("sfinv:crafting", {
-       title = "Crafting",
+       title = S("Crafting"),
        get = function(self, player, context)
                return sfinv.make_formspec(player, context, [[
                                list[current_player;craft;1.75,0.5;3,3;]