mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-16 16:11:06 +01:00
New translation system, part 2: Environment, help
This commit is contained in:
parent
1217d9fa88
commit
d691490016
6 changed files with 62 additions and 62 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
--[[
|
||||
|
||||
Copyright (C) 2016 - Auke Kok <sofar@foo-projects.org>
|
||||
|
@ -10,6 +9,8 @@ of the license, or (at your option) any later version.
|
|||
|
||||
--]]
|
||||
|
||||
local S = minetest.get_translator("lightning")
|
||||
|
||||
lightning = {}
|
||||
|
||||
lightning.interval_low = 17
|
||||
|
@ -178,7 +179,7 @@ lightning.strike = function(pos)
|
|||
if obj:is_player() then
|
||||
-- Player damage
|
||||
if minetest.get_modpath("mcl_death_messages") then
|
||||
mcl_death_messages.player_damage(obj, string.format("%s was struck by lightning.", obj:get_player_name()))
|
||||
mcl_death_messages.player_damage(obj, S("@1 was struck by lightning.", obj:get_player_name()))
|
||||
end
|
||||
obj:set_hp(obj:get_hp()-5)
|
||||
-- Mobs
|
||||
|
@ -233,7 +234,7 @@ end)
|
|||
|
||||
minetest.register_chatcommand("lightning", {
|
||||
params = "[<X> <Y> <Z>]",
|
||||
description = "Let lightning strike at the specified position or yourself",
|
||||
description = S("Let lightning strike at the specified position or yourself"),
|
||||
privs = { maphack = true },
|
||||
func = function(name, param)
|
||||
local pos = {}
|
||||
|
@ -254,7 +255,7 @@ minetest.register_chatcommand("lightning", {
|
|||
if player then
|
||||
lightning.strike(player:get_pos())
|
||||
else
|
||||
return false, "No position specified and unknown player"
|
||||
return false, S("No position specified and unknown player")
|
||||
end
|
||||
end
|
||||
return true
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
local S = minetest.get_translator("mcl_void_damage")
|
||||
|
||||
local voidtimer = 0
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
|
@ -24,7 +26,7 @@ minetest.register_globalstep(function(dtime)
|
|||
local spawn = mcl_spawn.get_spawn_pos(obj)
|
||||
obj:set_pos(spawn)
|
||||
mcl_worlds.dimension_change(obj, mcl_worlds.pos_to_dimension(spawn))
|
||||
minetest.chat_send_player(obj:get_player_name(), "The void is off-limits to you!")
|
||||
minetest.chat_send_player(obj:get_player_name(), S("The void is off-limits to you!"))
|
||||
else
|
||||
obj:remove()
|
||||
end
|
||||
|
@ -32,7 +34,7 @@ minetest.register_globalstep(function(dtime)
|
|||
-- Damage enabled, not immortal: Deal void damage (4 HP / 0.5 seconds)
|
||||
if obj:get_hp() > 0 then
|
||||
if is_player then
|
||||
mcl_death_messages.player_damage(obj, string.format("%s fell into the endless void.", obj:get_player_name()))
|
||||
mcl_death_messages.player_damage(obj, S("@1 fell into the endless void.", obj:get_player_name()))
|
||||
end
|
||||
obj:set_hp(obj:get_hp() - 4)
|
||||
end
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
local S = minetest.get_translator("mcl_weather")
|
||||
|
||||
-- weather states, 'none' is default, other states depends from active mods
|
||||
mcl_weather.state = "none"
|
||||
|
||||
|
@ -182,18 +184,18 @@ mcl_weather.get_weather = function()
|
|||
end
|
||||
|
||||
minetest.register_privilege("weather_manager", {
|
||||
description = "Gives ability to control weather",
|
||||
description = S("Gives ability to control weather"),
|
||||
give_to_singleplayer = false
|
||||
})
|
||||
|
||||
-- Weather command definition. Set
|
||||
minetest.register_chatcommand("weather", {
|
||||
params = "(clear | rain | snow | thunder) [<duration>]",
|
||||
description = "Changes the weather to the specified parameter.",
|
||||
params = S("(clear | rain | snow | thunder) [<duration>]"),
|
||||
description = S("Changes the weather to the specified parameter."),
|
||||
privs = {weather_manager = true},
|
||||
func = function(name, param)
|
||||
if (param == "") then
|
||||
return false, "Error: No weather specified."
|
||||
return false, S("Error: No weather specified.")
|
||||
end
|
||||
local new_weather, end_time
|
||||
local parse1, parse2 = string.match(param, "(%w+) ?(%d*)")
|
||||
|
@ -204,13 +206,13 @@ minetest.register_chatcommand("weather", {
|
|||
new_weather = parse1
|
||||
end
|
||||
else
|
||||
return false, "Error: Invalid parameters."
|
||||
return false, S("Error: Invalid parameters.")
|
||||
end
|
||||
if parse2 then
|
||||
if type(tonumber(parse2)) == "number" then
|
||||
local duration = tonumber(parse2)
|
||||
if duration < 1 then
|
||||
return false, "Error: Duration can't be less than 1 second."
|
||||
return false, S("Error: Duration can't be less than 1 second.")
|
||||
end
|
||||
end_time = minetest.get_gametime() + duration
|
||||
end
|
||||
|
@ -220,14 +222,14 @@ minetest.register_chatcommand("weather", {
|
|||
if success then
|
||||
return true
|
||||
else
|
||||
return false, "Error: Invalid weather specified. Use “clear”, “rain”, “snow” or “thunder”."
|
||||
return false, S("Error: Invalid weather specified. Use “clear”, “rain”, “snow” or “thunder”.")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("toggledownfall", {
|
||||
params = "",
|
||||
description = "Toggles between clear weather and weather with downfall (randomly rain, thunderstorm or snow)",
|
||||
description = S("Toggles between clear weather and weather with downfall (randomly rain, thunderstorm or snow)"),
|
||||
privs = {weather_manager = true},
|
||||
func = function(name, param)
|
||||
-- Currently rain/thunder/snow: Set weather to clear
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
local S = minetest.get_translator("mcl_doc")
|
||||
|
||||
-- Disable built-in factoids; it is planned to add custom ones as replacements
|
||||
doc.sub.items.disable_core_factoid("node_mining")
|
||||
doc.sub.items.disable_core_factoid("tool_capabilities")
|
||||
|
@ -14,7 +16,7 @@ end)
|
|||
-- dig_by_water
|
||||
doc.sub.items.register_factoid("nodes", "drop_destroy", function(itemstring, def)
|
||||
if def.groups.dig_by_water then
|
||||
return "Water can flow into this block and cause it to drop as an item."
|
||||
return S("Water can flow into this block and cause it to drop as an item.")
|
||||
end
|
||||
return ""
|
||||
end)
|
||||
|
@ -22,9 +24,9 @@ end)
|
|||
-- usable by hoes
|
||||
doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def)
|
||||
if def.groups.cultivatable == 2 then
|
||||
return "This block can be turned into dirt with a hoe."
|
||||
return S("This block can be turned into dirt with a hoe.")
|
||||
elseif def.groups.cultivatable == 2 then
|
||||
return "This block can be turned into farmland with a hoe."
|
||||
return S("This block can be turned into farmland with a hoe.")
|
||||
end
|
||||
return ""
|
||||
end)
|
||||
|
@ -33,15 +35,15 @@ end)
|
|||
doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def)
|
||||
local datastring = ""
|
||||
if def.groups.soil_sapling == 2 then
|
||||
datastring = datastring .. "This block acts as a soil for all saplings." .. "\n"
|
||||
datastring = datastring .. S("This block acts as a soil for all saplings.") .. "\n"
|
||||
elseif def.groups.soil_sapling == 1 then
|
||||
datastring = datastring .. "This block acts as a soil for some saplings." .. "\n"
|
||||
datastring = datastring .. S("This block acts as a soil for some saplings.") .. "\n"
|
||||
end
|
||||
if def.groups.soil_sugarcane then
|
||||
datastring = datastring .. "Sugar canes will grow on this block." .. "\n"
|
||||
datastring = datastring .. S("Sugar canes will grow on this block.") .. "\n"
|
||||
end
|
||||
if def.groups.soil_nether_wart then
|
||||
datastring = datastring .. "Nether wart will grow on this block." .. "\n"
|
||||
datastring = datastring .. S("Nether wart will grow on this block.") .. "\n"
|
||||
end
|
||||
return datastring
|
||||
end)
|
||||
|
@ -50,9 +52,9 @@ doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def)
|
|||
local formstring = ""
|
||||
if def.groups.leafdecay ~= nil then
|
||||
if def.drop ~= "" and def.drop ~= nil and def.drop ~= itemstring then
|
||||
formstring = string.format("This block quickly decays when there is no wood block of any species within a distance of %d. When decaying, it disappears and may drop one of its regular drops. The block does not decay when the block has been placed by a player.", def.groups.leafdecay)
|
||||
formstring = S("This block quickly decays when there is no wood block of any species within a distance of @1. When decaying, it disappears and may drop one of its regular drops. The block does not decay when the block has been placed by a player.", def.groups.leafdecay)
|
||||
else
|
||||
formstring = string.format("This block quickly decays and disappears when there is no wood block of any species within a distance of %d. The block does not decay when the block has been placed by a player.", def.groups.leafdecay)
|
||||
formstring = S("This block quickly decays and disappears when there is no wood block of any species within a distance of @1. The block does not decay when the block has been placed by a player.", def.groups.leafdecay)
|
||||
end
|
||||
end
|
||||
return formstring
|
||||
|
@ -62,9 +64,9 @@ end)
|
|||
doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def)
|
||||
local datastring = ""
|
||||
if def.groups.place_flowerlike == 1 then
|
||||
return "This plant can only grow on grass blocks and dirt. To survive, it needs to have an unobstructed view to the sky above or be exposed to a light level of 8 or higher."
|
||||
return S("This plant can only grow on grass blocks and dirt. To survive, it needs to have an unobstructed view to the sky above or be exposed to a light level of 8 or higher.")
|
||||
elseif def.groups.place_flowerlike == 2 then
|
||||
return "This plant can grow on grass blocks, podzol, dirt and coarse dirt. To survive, it needs to have an unobstructed view to the sky above or be exposed to a light level of 8 or higher."
|
||||
return S("This plant can grow on grass blocks, podzol, dirt and coarse dirt. To survive, it needs to have an unobstructed view to the sky above or be exposed to a light level of 8 or higher.")
|
||||
end
|
||||
return ""
|
||||
end)
|
||||
|
@ -72,7 +74,7 @@ end)
|
|||
-- flammable
|
||||
doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def)
|
||||
if def.groups.flammable then
|
||||
return "This block is flammable."
|
||||
return S("This block is flammable.")
|
||||
end
|
||||
return ""
|
||||
end)
|
||||
|
@ -80,7 +82,7 @@ end)
|
|||
-- destroys_items
|
||||
doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def)
|
||||
if def.groups.destroys_items then
|
||||
return "This block destroys any item it touches."
|
||||
return S("This block destroys any item it touches.")
|
||||
end
|
||||
return ""
|
||||
end)
|
||||
|
@ -91,25 +93,25 @@ doc.sub.items.register_factoid(nil, "use", function(itemstring, def)
|
|||
local s = ""
|
||||
if def.groups.eatable and not def._doc_items_usagehelp then
|
||||
if def.groups.food == 2 then
|
||||
s = s .. "To eat it, wield it, then rightclick."
|
||||
s = s .. S("To eat it, wield it, then rightclick.")
|
||||
if def.groups.can_eat_when_full == 1 then
|
||||
s = s .. "\n" .. "You can eat this even when your hunger bar is full."
|
||||
s = s .. "\n" .. S("You can eat this even when your hunger bar is full.")
|
||||
else
|
||||
s = s .. "\n" .. "You cannot eat this when your hunger bar is full."
|
||||
s = s .. "\n" .. S("You cannot eat this when your hunger bar is full.")
|
||||
end
|
||||
elseif def.groups.food == 3 then
|
||||
s = s .. "To drink it, wield it, then rightclick."
|
||||
s = s .. S("To drink it, wield it, then rightclick.")
|
||||
if def.groups.can_eat_when_full ~= 1 then
|
||||
s = s .. "\n" .. "You cannot drink this when your hunger bar is full."
|
||||
s = s .. "\n" .. S("You cannot drink this when your hunger bar is full.")
|
||||
end
|
||||
else
|
||||
s = s .. "To consume it, wield it, then rightclick."
|
||||
s = s .. S("To consume it, wield it, then rightclick.")
|
||||
if def.groups.can_eat_when_full ~= 1 then
|
||||
s = s .. "\n" .. "You cannot consume this when your hunger bar is full."
|
||||
s = s .. "\n" .. S("You cannot consume this when your hunger bar is full.")
|
||||
end
|
||||
end
|
||||
if def.groups.no_eat_delay ~= 1 then
|
||||
s = s .. "\n" .. "You have to wait for about 2 seconds before you can eat or drink again."
|
||||
s = s .. "\n" .. S("You have to wait for about 2 seconds before you can eat or drink again.")
|
||||
end
|
||||
end
|
||||
return s
|
||||
|
@ -118,10 +120,10 @@ end)
|
|||
doc.sub.items.register_factoid(nil, "groups", function(itemstring, def)
|
||||
local s = ""
|
||||
if def.groups.eatable and def.groups.eatable > 0 then
|
||||
s = s .. string.format("Hunger points restored: %d", def.groups.eatable)
|
||||
s = s .. S("Hunger points restored: @1", def.groups.eatable)
|
||||
end
|
||||
if def._mcl_saturation and def._mcl_saturation > 0 then
|
||||
s = s .. "\n" .. string.format("Saturation points restored: %.1f", def._mcl_saturation)
|
||||
s = s .. "\n" .. S("Saturation points restored: @1%.1f", string.format("%.1f", def._mcl_saturation))
|
||||
end
|
||||
return s
|
||||
end)
|
||||
|
@ -132,12 +134,12 @@ doc.sub.items.register_factoid(nil, "groups", function(itemstring, def)
|
|||
local mdef = minetest.registered_items[def._repair_material]
|
||||
local desc
|
||||
if mdef and mdef.description and mdef.description ~= "" then
|
||||
return string.format("This item can be repaired at an anvil with: %s.", mdef.description)
|
||||
return S("This item can be repaired at an anvil with: @1.", mdef.description)
|
||||
elseif def._repair_material == "group:wood" then
|
||||
return "This item can be repaired at an anvil with any wooden planks."
|
||||
return S("This item can be repaired at an anvil with any wooden planks.")
|
||||
elseif string.sub(def._repair_material, 1, 6) == "group:" then
|
||||
local group = string.sub(def._repair_material, 7)
|
||||
return string.format("This item can be repaired at an anvil with any item in the “%s” group.", group)
|
||||
return S("This item can be repaired at an anvil with any item in the “@1” group.", group)
|
||||
end
|
||||
end
|
||||
return ""
|
||||
|
@ -145,7 +147,7 @@ end)
|
|||
|
||||
doc.sub.items.register_factoid(nil, "groups", function(itemstring, def)
|
||||
if minetest.get_item_group(itemstring, "no_rename") == 1 then
|
||||
return "This item cannot be renamed at an anvil."
|
||||
return S("This item cannot be renamed at an anvil.")
|
||||
else
|
||||
return ""
|
||||
end
|
||||
|
@ -154,7 +156,7 @@ end)
|
|||
doc.sub.items.register_factoid("nodes", "gravity", function(itemstring, def)
|
||||
local s = ""
|
||||
if minetest.get_item_group(itemstring, "crush_after_fall") == 1 then
|
||||
s = s .. "This block crushes any block it falls into."
|
||||
s = s .. S("This block crushes any block it falls into.")
|
||||
end
|
||||
return s
|
||||
end)
|
||||
|
@ -162,22 +164,22 @@ end)
|
|||
doc.sub.items.register_factoid("nodes", "gravity", function(itemstring, def)
|
||||
local s = ""
|
||||
if minetest.get_item_group(itemstring, "crush_after_fall") == 1 then
|
||||
s = s .. "When this block falls deeper than 1 block, it causes damage to any player it hits. The damage dealt is B×2−2 hit points with B = number of blocks fallen. The damage can never be more than 40 HP."
|
||||
s = s .. S("When this block falls deeper than 1 block, it causes damage to any player it hits. The damage dealt is B×2−2 hit points with B = number of blocks fallen. The damage can never be more than 40 HP.")
|
||||
end
|
||||
return s
|
||||
end)
|
||||
|
||||
-- Mining, hardness and all that
|
||||
doc.sub.items.register_factoid("nodes", "mining", function(itemstring, def)
|
||||
local pickaxey = { "Diamond Pickaxe", "Iron Pickaxe", "Stone Pickaxe", "Golden Pickaxe", "Wooden Pickaxe" }
|
||||
local axey = { "Diamond Axe", "Iron Axe", "Stone Axe", "Golden Axe", "Wooden Axe" }
|
||||
local shovely = { "Diamond Shovel", "Iron Shovel", "Stone Shovel", "Golden Shovel", "Wooden Shovel" }
|
||||
local pickaxey = { S("Diamond Pickaxe"), S("Iron Pickaxe"), S("Stone Pickaxe"), S("Golden Pickaxe"), S("Wooden Pickaxe") }
|
||||
local axey = { S("Diamond Axe"), S("Iron Axe"), S("Stone Axe"), S("Golden Axe"), S("Wooden Axe") }
|
||||
local shovely = { S("Diamond Shovel"), S("Iron Shovel"), S("Stone Shovel"), S("Golden Shovel"), S("Wooden Shovel") }
|
||||
|
||||
local datastring = ""
|
||||
local groups = def.groups
|
||||
if groups then
|
||||
if groups.dig_immediate == 3 then
|
||||
datastring = datastring .. "This block can be mined by any tool instantly." .. "\n"
|
||||
datastring = datastring .. S("This block can be mined by any tool instantly.") .. "\n"
|
||||
else
|
||||
local tool_minable = false
|
||||
|
||||
|
@ -213,7 +215,7 @@ doc.sub.items.register_factoid("nodes", "mining", function(itemstring, def)
|
|||
end
|
||||
|
||||
if tool_minable then
|
||||
datastring = "This block can be mined by:\n" .. datastring .. "\n"
|
||||
datastring = S("This block can be mined by:") .. "\n" .. datastring .. "\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -222,9 +224,9 @@ doc.sub.items.register_factoid("nodes", "mining", function(itemstring, def)
|
|||
hardness = 0
|
||||
end
|
||||
if hardness == -1 then
|
||||
datastring = datastring .. "Hardness: ∞"
|
||||
datastring = datastring .. S("Hardness: ∞")
|
||||
else
|
||||
datastring = datastring .. string.format("Hardness: %.2f", hardness)
|
||||
datastring = datastring .. S("Hardness: @1", string.format("%.2f", hardness))
|
||||
end
|
||||
local blast = def._mcl_blast_resistance
|
||||
if not blast then
|
||||
|
@ -232,7 +234,7 @@ doc.sub.items.register_factoid("nodes", "mining", function(itemstring, def)
|
|||
end
|
||||
-- TODO: Blast resistance as number
|
||||
if blast >= 1000 then
|
||||
datastring = datastring .. "\n" .. "This block will not be destroyed by TNT explosions."
|
||||
datastring = datastring .. "\n" .. S("This block will not be destroyed by TNT explosions.")
|
||||
end
|
||||
return datastring
|
||||
end)
|
||||
|
@ -240,7 +242,7 @@ end)
|
|||
-- Special drops when mined by shears
|
||||
doc.sub.items.register_factoid("nodes", "drops", function(itemstring, def)
|
||||
if def._mcl_shears_drop == true then
|
||||
return "This block drops itself when mined by shears."
|
||||
return S("This block drops itself when mined by shears.")
|
||||
elseif type(def._mcl_shears_drop) == "table" then
|
||||
local drops = {}
|
||||
for d=1, #def._mcl_shears_drop do
|
||||
|
@ -255,11 +257,11 @@ doc.sub.items.register_factoid("nodes", "drops", function(itemstring, def)
|
|||
text = itemname
|
||||
end
|
||||
if itemcount > 1 then
|
||||
text = string.format("%d×%s", itemcount, text)
|
||||
text = S("@1×@2", itemcount, text)
|
||||
end
|
||||
table.insert(drops, text)
|
||||
end
|
||||
local ret = string.format("This blocks drops the following when mined by shears: %s", table.concat(drops, ", "))
|
||||
local ret = S("This blocks drops the following when mined by shears: @1", table.concat(drops, S(", ")))
|
||||
return ret
|
||||
end
|
||||
return ""
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
doc
|
||||
intllib?
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if minetest.get_modpath("intllib") then
|
||||
S = intllib.Getter()
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
local S = minetest.get_translator("mcl_doc_basics")
|
||||
|
||||
doc.add_category("basics",
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue