{
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)
enable_respawn = true
end
+-- support for MT game translation.
+local S = beds.get_translator
+
-- Helper functions
local function get_look_yaw(pos)
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
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
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) .. "]" ..
[[
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)
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
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
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
-- 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},
})
farming.register_plant("farming:wheat", {
description = S("Wheat Seed"),
+ harvest_description = S("Wheat"),
paramtype2 = "meshoptions",
inventory_image = "farming_wheat_seed.png",
steps = 8,
farming.register_plant("farming:cotton", {
description = S("Cotton Seed"),
+ harvest_description = S("Cotton"),
inventory_image = "farming_cotton_seed.png",
steps = 8,
minlight = 13,
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",
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;]