1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-22 15:00:18 +01:00

Fix more translation strings (#2487)

This commit is contained in:
sfan5 2019-09-18 20:38:27 +02:00 committed by GitHub
parent c42a525ce8
commit b4c7522248
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 56 additions and 34 deletions

View File

@ -359,6 +359,8 @@ The farming API allows you to easily register plants and hoes.
{ {
description = "", -- Description of seed item 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 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 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) -- ^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber)

View File

@ -5,6 +5,9 @@ if enable_respawn == nil then
enable_respawn = true enable_respawn = true
end end
-- support for MT game translation.
local S = beds.get_translator
-- Helper functions -- Helper functions
local function get_look_yaw(pos) local function get_look_yaw(pos)
@ -108,17 +111,19 @@ end
local function update_formspecs(finished) local function update_formspecs(finished)
local ges = #minetest.get_connected_players() local ges = #minetest.get_connected_players()
local form_n
local player_in_bed = get_player_in_bed_count() local player_in_bed = get_player_in_bed_count()
local is_majority = (ges / 2) < player_in_bed local is_majority = (ges / 2) < player_in_bed
local form_n
local esc = minetest.formspec_escape
if finished then 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 else
form_n = beds.formspec .. "label[2.2,9;" .. tostring(player_in_bed) .. form_n = beds.formspec .. "label[2.2,9;" ..
" of " .. tostring(ges) .. " players are in bed]" esc(S("@1 of @2 players are in bed", player_in_bed, ges)) .. "]"
if is_majority and is_night_skip_enabled() then 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
end end
@ -150,7 +155,7 @@ function beds.on_rightclick(pos, player)
if beds.player[name] then if beds.player[name] then
lay_down(player, nil, nil, false) lay_down(player, nil, nil, false)
end 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 return
end end

View File

@ -108,6 +108,7 @@ function creative.register_tab(name, title, items)
local start_i = inv.start_i or 0 local start_i = inv.start_i or 0
local pagenum = math.floor(start_i / (3*8) + 1) local pagenum = math.floor(start_i / (3*8) + 1)
local pagemax = math.ceil(inv.size / (3*8)) local pagemax = math.ceil(inv.size / (3*8))
local esc = minetest.formspec_escape
return sfinv.make_formspec(player, context, return sfinv.make_formspec(player, context,
"label[6.2,3.35;" .. minetest.colorize("#FFFF00", tostring(pagenum)) .. " / " .. tostring(pagemax) .. "]" .. "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[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.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;] 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]" .. "listring[detached:creative_" .. player_name .. ";main]" ..
"list[detached:creative_" .. player_name .. ";main;0,0;8,3;" .. tostring(start_i) .. "]" .. "list[detached:creative_" .. player_name .. ";main;0,0;8,3;" .. tostring(start_i) .. "]" ..
creative.formspec_add, true) creative.formspec_add, true)

View File

@ -52,23 +52,24 @@ local function book_on_use(itemstack, user)
end end
local formspec local formspec
local esc = minetest.formspec_escape
if owner == player_name then if owner == player_name then
formspec = "size[8,8]" .. formspec = "size[8,8]" ..
"field[0.5,1;7.5,0;title;Title:;" .. "field[0.5,1;7.5,0;title;" .. esc(S("Title:")) .. ";" ..
minetest.formspec_escape(title) .. "]" .. esc(title) .. "]" ..
"textarea[0.5,1.5;7.5,7;text;Contents:;" .. "textarea[0.5,1.5;7.5,7;text;" .. esc(S("Contents:")) .. ";" ..
minetest.formspec_escape(text) .. "]" .. esc(text) .. "]" ..
"button_exit[2.5,7.5;3,1;save;Save]" "button_exit[2.5,7.5;3,1;save;" .. esc(S("Save")) .. "]"
else else
formspec = "size[8,8]" .. formspec = "size[8,8]" ..
"label[0.5,0.5;by " .. owner .. "]" .. "label[0.5,0.5;" .. esc(S("by @1", owner)) .. "]" ..
"tablecolumns[color;text]" .. "tablecolumns[color;text]" ..
"tableoptions[background=#00000000;highlight=#00000000;border=false]" .. "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;;" .. "textarea[0.5,1.5;7.5,7;;" ..
minetest.formspec_escape(string ~= "" and string or text) .. ";]" .. minetest.formspec_escape(string ~= "" and string or text) .. ";]" ..
"button[2.4,7.6;0.8,0.8;book_prev;<]" .. "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;>]" "button[4.9,7.6;0.8,0.8;book_next;>]"
end end

View File

@ -2604,7 +2604,7 @@ local function register_sign(material, desc, def)
meta:set_string("text", text) meta:set_string("text", text)
if #text > 0 then if #text > 0 then
meta:set_string("infotext", '"' .. text .. '"') meta:set_string("infotext", S('"@1"', text))
else else
meta:set_string("infotext", '') meta:set_string("infotext", '')
end end

View File

@ -257,6 +257,9 @@ farming.register_plant = function(name, def)
if not def.description then if not def.description then
def.description = S("Seed") def.description = S("Seed")
end end
if not def.harvest_description then
def.harvest_description = pname:gsub("^%l", string.upper)
end
if not def.inventory_image then if not def.inventory_image then
def.inventory_image = "unknown_item.png" def.inventory_image = "unknown_item.png"
end end
@ -325,7 +328,7 @@ farming.register_plant = function(name, def)
-- Register harvest -- Register harvest
minetest.register_craftitem(":" .. mname .. ":" .. pname, { minetest.register_craftitem(":" .. mname .. ":" .. pname, {
description = pname:gsub("^%l", string.upper), description = def.harvest_description,
inventory_image = mname .. "_" .. pname .. ".png", inventory_image = mname .. "_" .. pname .. ".png",
groups = def.groups or {flammable = 2}, groups = def.groups or {flammable = 2},
}) })

View File

@ -20,6 +20,7 @@ dofile(farming.path .. "/hoes.lua")
farming.register_plant("farming:wheat", { farming.register_plant("farming:wheat", {
description = S("Wheat Seed"), description = S("Wheat Seed"),
harvest_description = S("Wheat"),
paramtype2 = "meshoptions", paramtype2 = "meshoptions",
inventory_image = "farming_wheat_seed.png", inventory_image = "farming_wheat_seed.png",
steps = 8, steps = 8,
@ -61,6 +62,7 @@ minetest.register_craft({
farming.register_plant("farming:cotton", { farming.register_plant("farming:cotton", {
description = S("Cotton Seed"), description = S("Cotton Seed"),
harvest_description = S("Cotton"),
inventory_image = "farming_cotton_seed.png", inventory_image = "farming_cotton_seed.png",
steps = 8, steps = 8,
minlight = 13, minlight = 13,

View File

@ -153,16 +153,21 @@ minetest.register_node("farming:straw", {
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
stairs.register_stair_and_slab( do
"straw", local recipe = "farming:straw"
"farming:straw", local groups = {snappy = 3, flammable = 4}
{snappy = 3, flammable = 4}, local images = {"farming_straw.png"}
{"farming_straw.png"}, local sounds = default.node_sound_leaves_defaults()
S("Straw Stair"),
S("Straw Slab"), stairs.register_stair("straw", recipe, groups, images, S("Straw Stair"),
default.node_sound_leaves_defaults(), sounds, true)
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({ minetest.register_abm({
label = "Farming soil", label = "Farming soil",

View File

@ -2,8 +2,11 @@
dofile(minetest.get_modpath("sfinv") .. "/api.lua") dofile(minetest.get_modpath("sfinv") .. "/api.lua")
-- Load support for MT game translation.
local S = minetest.get_translator("sfinv")
sfinv.register_page("sfinv:crafting", { sfinv.register_page("sfinv:crafting", {
title = "Crafting", title = S("Crafting"),
get = function(self, player, context) get = function(self, player, context)
return sfinv.make_formspec(player, context, [[ return sfinv.make_formspec(player, context, [[
list[current_player;craft;1.75,0.5;3,3;] list[current_player;craft;1.75,0.5;3,3;]