Skip to content

Commit

Permalink
Fix more translation strings (#2487)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 committed Sep 18, 2019
1 parent c42a525 commit b4c7522
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 34 deletions.
2 changes: 2 additions & 0 deletions game_api.txt
Expand Up @@ -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)
Expand Down
17 changes: 11 additions & 6 deletions mods/beds/functions.lua
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
15 changes: 8 additions & 7 deletions mods/creative/inventory.lua
Expand Up @@ -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) .. "]" ..
[[
Expand All @@ -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)
Expand Down
17 changes: 9 additions & 8 deletions mods/default/craftitems.lua
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion mods/default/nodes.lua
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion mods/farming/api.lua
Expand Up @@ -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
Expand Down Expand Up @@ -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},
})
Expand Down
2 changes: 2 additions & 0 deletions mods/farming/init.lua
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
25 changes: 15 additions & 10 deletions mods/farming/nodes.lua
Expand Up @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion mods/sfinv/init.lua
Expand Up @@ -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;]
Expand Down

0 comments on commit b4c7522

Please sign in to comment.