From: sfan5 Date: Wed, 18 Sep 2019 18:38:27 +0000 (+0200) Subject: Fix more translation strings (#2487) X-Git-Tag: 5.1.0~18 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b4c752224833b3ef69c2f1f8ecb3001bf9221324;p=oweals%2Fminetest_game.git Fix more translation strings (#2487) --- diff --git a/game_api.txt b/game_api.txt index 6ddeb980..a066a087 100644 --- a/game_api.txt +++ b/game_api.txt @@ -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) diff --git a/mods/beds/functions.lua b/mods/beds/functions.lua index ae632a98..0b79bfb5 100644 --- a/mods/beds/functions.lua +++ b/mods/beds/functions.lua @@ -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 diff --git a/mods/creative/inventory.lua b/mods/creative/inventory.lua index 08402046..27dee782 100644 --- a/mods/creative/inventory.lua +++ b/mods/creative/inventory.lua @@ -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) diff --git a/mods/default/craftitems.lua b/mods/default/craftitems.lua index dd76d1e5..e2e92bf2 100644 --- a/mods/default/craftitems.lua +++ b/mods/default/craftitems.lua @@ -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 diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index 5dbee7d0..cee1242a 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -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 diff --git a/mods/farming/api.lua b/mods/farming/api.lua index 6c13b11b..c2c549e4 100644 --- a/mods/farming/api.lua +++ b/mods/farming/api.lua @@ -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}, }) diff --git a/mods/farming/init.lua b/mods/farming/init.lua index 2344d45e..e6dfd579 100644 --- a/mods/farming/init.lua +++ b/mods/farming/init.lua @@ -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, diff --git a/mods/farming/nodes.lua b/mods/farming/nodes.lua index 806f46d4..22dd51c8 100644 --- a/mods/farming/nodes.lua +++ b/mods/farming/nodes.lua @@ -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", diff --git a/mods/sfinv/init.lua b/mods/sfinv/init.lua index e9021396..71e9ee70 100644 --- a/mods/sfinv/init.lua +++ b/mods/sfinv/init.lua @@ -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;]