i18n support and Chinese translations

master
pevernow 2021-06-29 22:14:46 +08:00
parent 59c29e55d2
commit 63fb4c3361
20 changed files with 226 additions and 67 deletions

View File

@ -1,6 +1,8 @@
fluidity.florbs = {}
local S = fluidity.S
local function get_itemdef_field(nodename, fieldname)
if not minetest.registered_items[nodename] then
return nil

View File

@ -6,6 +6,8 @@ fluidity = rawget(_G, "fluidity") or {}
local mpath = minetest.get_modpath("fluidity")
fluidity.modpath = mpath
fluidity.S = minetest.get_translator("fluidity")
function fluidity.fluid_short(str)
return string.lower(str):gsub("%s", "_")
end

View File

@ -0,0 +1,5 @@
# textdomain:fluidity
Molten @1 Source=熔化@1源
Flowing Molten @1=流动熔融@1
Florb=弗洛布

View File

@ -0,0 +1,5 @@
# textdomain:fluidity
Molten @1 Source=
Flowing Molten @1=
Florb=

View File

@ -2,6 +2,8 @@
fluidity.molten_metals = {}
local S = fluidity.S
local function firstToUpper(str)
return (str:gsub("^%l", string.upper))
end
@ -20,7 +22,7 @@ function fluidity.register_molten_metal(metal)
fluidity.molten_metals[metal] = mod_name..":"..metal.."_source"
minetest.register_node(mod_name..":"..metal.."_source", {
description = "Molten "..description.." Source",
description = S("Molten @1 Source",description),
drawtype = "liquid",
tiles = {
{
@ -65,7 +67,7 @@ function fluidity.register_molten_metal(metal)
})
minetest.register_node(mod_name..":"..metal.."_flowing", {
description = "Flowing Molten "..description,
description = S("Flowing Molten @1",description),
drawtype = "flowingliquid",
tiles = {"fluidity_"..metal..".png"},
special_tiles = {

View File

@ -3,6 +3,8 @@
-- Default metals
local metals = {"steel", "copper", "tin", "bronze", "gold", "mese", "obsidian", "lead", "chromium", "zinc", "silver", "mithril"}
local S=fluidity.S
for _,v in pairs(metals) do
fluidity.register_molten_metal(v)
end
@ -10,7 +12,7 @@ end
-- Register florbs for all fluids
fluidity.florbs.register_florb({
florb_name = "florb",
florb_description = "Florb",
florb_description = S("Florb"),
capacity = 1000,
tiles = {"fluidity_florb.png", "fluidity_florb_mask.png"}
})

View File

@ -1,5 +1,7 @@
-- Casts molten metals into a solid form
local S = metal_melter.S
metal_caster = {}
metal_caster.max_coolant = 8000
@ -9,9 +11,9 @@ metal_caster.max_metal = 16000
metal_caster.spec = metal_melter.spec
metal_caster.casts = {
ingot = {description = "Ingot", result = "ingot", cost = 1, typenames = {"ingot"}},
lump = {description = "Lump", result = "lump", cost = 2, typenames = {"lump"}},
gem = {description = "Gem", result = "crystal", cost = 1, typenames = {"crystal", "gem"}}
ingot = {description = S("Ingot"), result = "ingot", cost = 1, typenames = {"ingot"}},
lump = {description = S("Lump"), result = "lump", cost = 2, typenames = {"lump"}},
gem = {description = S("Gem"), result = "crystal", cost = 1, typenames = {"crystal", "gem"}}
}
local metal_cache = {}
@ -491,7 +493,7 @@ end
-- Register the caster
minetest.register_node("metal_melter:metal_caster", {
description = "Metal Caster",
description = S("Metal Caster"),
tiles = {
"melter_side.png"..tube_entry, "melter_side.png"..tube_entry,
"melter_side.png"..tube_entry, "melter_side.png"..tube_entry,

View File

@ -1,9 +1,11 @@
-- Crafting components
local S = metal_melter.S
-- Items
minetest.register_craftitem("metal_melter:heated_brick", {
description = "Heatbrick",
description = S("Heatbrick"),
inventory_image = "metal_melter_heated_brick.png",
groups = {brick=1}
})
@ -11,7 +13,7 @@ minetest.register_craftitem("metal_melter:heated_brick", {
-- Nodes
minetest.register_node("metal_melter:heated_bricks", {
description = "Heatbricks",
description = S("Heatbricks"),
tiles = {"metal_melter_heatbrick.png"},
groups = {cracky = 3},
paramtype2 = "facedir",
@ -21,14 +23,14 @@ minetest.register_node("metal_melter:heated_bricks", {
})
minetest.register_node("metal_melter:heat_gravel", {
description = "Heat Gravel",
description = S("Heat Gravel"),
tiles = {"metal_melter_heat_gravel.png"},
groups = {crumbly = 2, falling_node = 1},
sounds = default.node_sound_gravel_defaults()
})
minetest.register_node("metal_melter:heat_exchanger", {
description = "Heat Exchanger Plate",
description = S("Heat Exchanger Plate"),
tiles = {"metal_melter_heat_exchanger.png"},
groups = {cracky = 3},
place_param2 = 0,
@ -46,7 +48,7 @@ minetest.register_node("metal_melter:heat_exchanger", {
})
minetest.register_node('metal_melter:casting_table', {
description = "Casting Table",
description = S("Casting Table"),
paramtype = "light",
drawtype = "nodebox",
node_box = {
@ -66,7 +68,7 @@ minetest.register_node('metal_melter:casting_table', {
})
fluid_tanks.register_tank("metal_melter:heated_tank",{
description = "Heated Tank",
description = S("Heated Tank"),
capacity = 8000,
tiles = {"melter_heated_tank.png"},
accepts = {"default:lava_source"}

View File

@ -4,6 +4,8 @@
local modpath = minetest.get_modpath("metal_melter")
metal_melter = {}
metal_melter.S = minetest.get_translator("metal_melter")
-- Melting database
dofile(modpath.."/meltable.lua")

View File

@ -0,0 +1,13 @@
# textdomain:metal_melter
Ingot=铸锭
Lump=肿块
Gem=宝石
Metal Caster=金属铸造机
Heatbrick=热砖
Heatbricks=加热砖
Heat Gravel=热砾石
Heat Exchanger Plate=热交换器板
Casting Table=铸造工作台
Heated Tank=加热水箱
Metal Melter=金属熔化器

View File

@ -0,0 +1,13 @@
# textdomain:metal_melter
Ingot=
Lump=
Gem=
Metal Caster=
Heatbrick=
Heatbricks=
Heat Gravel=
Heat Exchanger Plate=
Casting Table=
Heated Tank=
Metal Melter=

View File

@ -1,5 +1,7 @@
-- Melts metals using lava as a heat source.
local S = metal_melter.S
-- Max lava that can be held by the melter.
metal_melter.max_fuel = 8000
@ -389,7 +391,7 @@ if minetest.get_modpath("pipeworks") ~= nil then
end
minetest.register_node("metal_melter:metal_melter", {
description = "Metal Melter",
description = S("Metal Melter"),
tiles = {
"melter_side.png"..tube_entry, "melter_side.png"..tube_entry,
"melter_side.png"..tube_entry, "melter_side.png"..tube_entry,

View File

@ -6,6 +6,8 @@
tinkering = rawget(_G, "tinkering") or {}
tinkering.S = minetest.get_translator("tinkering")
local modpath = minetest.get_modpath(minetest.get_current_modname())
tinkering.modpath = modpath

View File

@ -0,0 +1,49 @@
# textdomain:tinkering
Cheap=
Wooden=
Economic=
Stonebound=
Metallic=
Cold=
Cheap=
Precious=
Expensive=
Shiny=
Soft=
Reinforced=
Toxic=
Shiny=
Metallic=
Durable=
Lethal=
Diamond=
Pickaxe=
Axe=
Sword=
Shovel=
Pickaxe Head=
Axe Head=
Sword Blade=
Shovel Head=
Tool Rod=
Tool Binding=
Part Builder=
Pattern Table=
Tool Station=
Flint=
Wood=
Stone=
Obsidian=
Steel=
Copper=
Tin=
Bronze=
Gold=
Mese=
Silver=
Mithril=
Diamond=
Lead=
Chromium=
Zinc=

View File

@ -0,0 +1,46 @@
# textdomain:tinkering
Cheap=低廉
Wooden=自然
Economic=合算的
Stonebound=石板
Metallic=金属制品
Cold=冷的
Precious=珍贵
Expensive=昂贵
Shiny=闪亮
Soft=柔软
Reinforced=加固
Toxic=有毒
Durable=耐用
Lethal=致命
Diamond=钻石
Pickaxe=鹤嘴锄
Axe=斧头
Sword=剑
Shovel=铲子
Pickaxe Head=镐头
Axe Head=斧头
Sword Blade=剑刃
Shovel Head=锹头
Tool Rod=手柄
Tool Binding=绑定结
Part Builder=零件制造台
Pattern Table=模具制造台
Tool Station=工具组装台
Flint=燧石
Wood=木
Stone=石
Obsidian=黑曜石
Steel=钢
Copper=铜
Tin=锡
Bronze=青铜
Gold=金
Mese=黄石
Silver=银
Mithril=秘银
Diamond=钻石
Lead=铅
Chromium=铬
Zinc=锌

View File

@ -1,3 +1,5 @@
local S = tinkering.S
local modifiers = {
flint = {
@ -11,7 +13,7 @@ local modifiers = {
binding = {increase = 0.00, uses = 0},
rod = {increase = 0.00, uses = 0},
tags = {
{name = "cheap", description = "Cheap"}
{name = "cheap", description = S("Cheap")}
}
},
wood = {
@ -25,8 +27,8 @@ local modifiers = {
binding = {increase = 0.00, uses = 0},
rod = {increase = 0.00, uses = 0},
tags = {
{name = "cheap", description = "Cheap"},
{name = "wooden", description = "Wooden"}
{name = "cheap", description = S("Cheap")},
{name = "wooden", description = S("Wooden")}
}
},
stone = {
@ -40,8 +42,8 @@ local modifiers = {
binding = {increase = 0.05, uses = -1},
rod = {increase = 0.05, uses = -1},
tags = {
{name = "economic", description = "Economic"},
{name = "stonebound", description = "Stonebound"}
{name = "economic", description = S("Economic")},
{name = "stonebound", description = S("Stonebound")}
}
},
steel = {
@ -55,8 +57,8 @@ local modifiers = {
binding = {increase = 0.05, uses = 3},
rod = {increase = 0.10, uses = 5},
tags = {
{name = "economic", description = "Economic"},
{name = "metal", description = "Metallic"}
{name = "economic", description = S("Economic")},
{name = "metal", description = S("Metallic")}
}
},
copper = {
@ -70,7 +72,7 @@ local modifiers = {
binding = {increase = 0.05, uses = 3},
rod = {increase = 0.06, uses = 5},
tags = {
{name = "cold", description = "Cold"}
{name = "cold", description = S("Cold")}
}
},
tin = {
@ -84,7 +86,7 @@ local modifiers = {
binding = {increase = 0.02, uses = -2},
rod = {increase = 0.06, uses = -3},
tags = {
{name = "cheap", description = "Cheap"}
{name = "cheap", description = S("Cheap")}
}
},
bronze = {
@ -110,8 +112,8 @@ local modifiers = {
binding = {increase = 0.10, uses = 10},
rod = {increase = 0.15, uses = 10},
tags = {
{name = "gem", description = "Precious"},
{name = "expensive", description = "Expensive"}
{name = "gem", description = S("Precious")},
{name = "expensive", description = S("Expensive")}
}
},
gold = {
@ -125,8 +127,8 @@ local modifiers = {
binding = {increase = -0.07, uses = -10},
rod = {increase = -0.01, uses = -5},
tags = {
{name = "shiny", description = "Shiny"},
{name = "soft", description = "Soft"}
{name = "shiny", description = S("Shiny")},
{name = "soft", description = S("Soft")}
}
},
obsidian = {
@ -140,7 +142,7 @@ local modifiers = {
binding = {increase = 0.10, uses = 15},
rod = {increase = 0.05, uses = 5},
tags = {
{name = "reinforced", description = "Reinforced"}
{name = "reinforced", description = S("Reinforced")}
}
},
lead = {
@ -155,7 +157,7 @@ local modifiers = {
binding = {increase = 0.15, uses = 1},
rod = {increase = 0.05, uses = -5},
tags = {
{name = "toxic", description = "Toxic"}
{name = "toxic", description = S("Toxic")}
}
},
chromium = {
@ -170,7 +172,7 @@ local modifiers = {
binding = {increase = 0.15, uses = 1},
rod = {increase = -0.05, uses = 2},
tags = {
{name = "shiny", description = "Shiny"}
{name = "shiny", description = S("Shiny")}
}
},
zinc = {
@ -185,7 +187,7 @@ local modifiers = {
binding = {increase = -0.05, uses = 1},
rod = {increase = -0.05, uses = 2},
tags = {
{name = "metal", description = "Metallic"}
{name = "metal", description = S("Metallic")}
}
},
silver = {
@ -199,8 +201,8 @@ local modifiers = {
binding = {increase = -0.05, uses = 10},
rod = {increase = -0.05, uses = 10},
tags = {
{name = "durable", description = "Durable"},
{name = "shiny", description = "Shiny"}
{name = "durable", description = S("Durable")},
{name = "shiny", description = S("Shiny")}
}
},
mithril = {
@ -214,8 +216,8 @@ local modifiers = {
binding = {increase = 0.05, uses = 15},
rod = {increase = -0.10, uses = 15, damage = {fleshy = 8}},
tags = {
{name = "durable", description = "Durable"},
{name = "lethal", description = "Lethal"}
{name = "durable", description = S("Durable")},
{name = "lethal", description = S("Lethal")}
}
},
-- Modifier items
@ -224,7 +226,7 @@ local modifiers = {
increase = 0.25,
count = 1,
tags = {
{name = "diamond", description = "Diamond"}
{name = "diamond", description = S("Diamond")}
}
},
-- Templates
@ -261,48 +263,48 @@ local modifiers = {
tinkering.materials = {
-- Materials
flint = {name = "Flint", default = "default:flint", color = "#514E49", base = "item", modifier = modifiers.flint},
wood = {name = "Wood", default = "wood", color = "#634623", base = "group", modifier = modifiers.wood},
stone = {name = "Stone", default = "stone", color = "#8D8988", base = "group", modifier = modifiers.stone},
obsidian = {name = "Obsidian", default = "default:obsidian", color = "#2C384E", base = "node", cast = true, modifier = modifiers.obsidian},
flint = {name = S("Flint"), default = "default:flint", color = "#514E49", base = "item", modifier = modifiers.flint},
wood = {name = S("Wood"), default = "wood", color = "#634623", base = "group", modifier = modifiers.wood},
stone = {name = S("Stone"), default = "stone", color = "#8D8988", base = "group", modifier = modifiers.stone},
obsidian = {name = S("Obsidian"), default = "default:obsidian", color = "#2C384E", base = "node", cast = true, modifier = modifiers.obsidian},
-- Metals
steel = {name = "Steel", default = "default:steel_ingot", color = "#FFF", base = "ingot", cast = true, modifier = modifiers.steel},
copper = {name = "Copper", default = "default:copper_ingot", color = "#E87945", base = "ingot", cast = true, modifier = modifiers.copper},
tin = {name = "Tin", default = "default:tin_ingot", color = "#C1C1C1", base = "ingot", cast = true, modifier = modifiers.tin},
bronze = {name = "Bronze", default = "default:bronze_ingot", color = "#C14E19", base = "ingot", cast = true, modifier = modifiers.bronze},
gold = {name = "Gold", default = "default:gold_ingot", color = "#FFFF54", base = "ingot", cast = true, modifier = modifiers.gold},
mese = {name = "Mese", default = "default:mese_crystal", color = "#FFFF02", base = "gem", cast = true, modifier = modifiers.mese},
steel = {name = S("Steel"), default = "default:steel_ingot", color = "#FFF", base = "ingot", cast = true, modifier = modifiers.steel},
copper = {name = S("Copper"), default = "default:copper_ingot", color = "#E87945", base = "ingot", cast = true, modifier = modifiers.copper},
tin = {name = S("Tin"), default = "default:tin_ingot", color = "#C1C1C1", base = "ingot", cast = true, modifier = modifiers.tin},
bronze = {name = S("Bronze"), default = "default:bronze_ingot", color = "#C14E19", base = "ingot", cast = true, modifier = modifiers.bronze},
gold = {name = S("Gold"), default = "default:gold_ingot", color = "#FFFF54", base = "ingot", cast = true, modifier = modifiers.gold},
mese = {name = S("Mese"), default = "default:mese_crystal", color = "#FFFF02", base = "gem", cast = true, modifier = modifiers.mese},
-- From moreores
silver = {name = "Silver", default = "moreores:silver_ingot", color = "#D7E2E8", base = "ingot", cast = true, modifier = modifiers.silver},
mithril = {name = "Mithril", default = "moreores:mithril_ingot", color = "#6868D7", base = "ingot", cast = true, modifier = modifiers.mithril}
silver = {name = S("Silver"), default = "moreores:silver_ingot", color = "#D7E2E8", base = "ingot", cast = true, modifier = modifiers.silver},
mithril = {name = S("Mithril"), default = "moreores:mithril_ingot", color = "#6868D7", base = "ingot", cast = true, modifier = modifiers.mithril}
}
tinkering.modifiers = {
diamond = {name = "Diamond", default = "default:diamond", modifier = modifiers.diamond}
diamond = {name = S("Diamond"), default = "default:diamond", modifier = modifiers.diamond}
}
-- Add mod-based materials
minetest.register_on_mods_loaded(function ()
if minetest.get_modpath("technic") then
-- From technic
tinkering.materials["lead"] = {name = "Lead", default = "technic:lead_ingot",
tinkering.materials["lead"] = {name = S("Lead"), default = "technic:lead_ingot",
color = "#C6C6C6", base = "ingot", cast = true, modifier = modifiers.lead}
tinkering.materials["chromium"] = {name = "Chromium", default = "technic:chromium_ingot",
tinkering.materials["chromium"] = {name = S("Chromium"), default = "technic:chromium_ingot",
color = "#DFE8E8", base = "ingot", cast = true, modifier = modifiers.chromium}
tinkering.materials["zinc"] = {name = "Zinc", default = "technic:zinc_ingot",
tinkering.materials["zinc"] = {name = S("Zinc"), default = "technic:zinc_ingot",
color = "#CEE8EF", base = "ingot", cast = true, modifier = modifiers.zinc}
end
if minetest.get_modpath("elepower_dynamics") then
-- From elepower
tinkering.materials["lead"] = {name = "Lead", default = "elepower_dynamics:lead_ingot",
tinkering.materials["lead"] = {name = S("Lead"), default = "elepower_dynamics:lead_ingot",
color = "#C6C6C6", base = "ingot", cast = true, modifier = modifiers.lead}
tinkering.materials["zinc"] = {name = "Zinc", default = "elepower_dynamics:zinc_ingot",
tinkering.materials["zinc"] = {name = S("Zinc"), default = "elepower_dynamics:zinc_ingot",
color = "#CEE8EF", base = "ingot", cast = true, modifier = modifiers.zinc}
end
end)

View File

@ -1,3 +1,5 @@
local S = tinkering.S
part_builder = {}
function part_builder.get_formspec()
@ -213,7 +215,7 @@ local function on_receive_fields(pos, formname, fields, sender)
end
minetest.register_node("tinkering:part_builder", {
description = "Part Builder",
description = S("Part Builder"),
tiles = {
"tinkering_blank_pattern.png", "tinkering_bench_bottom.png",
"tinkering_bench_side.png", "tinkering_bench_side.png",

View File

@ -1,3 +1,5 @@
local S = tinkering.S
pattern_table = {}
function pattern_table.get_tool_type_list(ix, iy, mx)
@ -139,7 +141,7 @@ local function on_receive_fields(pos, formname, fields, sender)
end
minetest.register_node("tinkering:pattern_table", {
description = "Pattern Table",
description = S("Pattern Table"),
tiles = {
"tinkering_pattern_bench.png", "tinkering_bench_bottom.png",
"tinkering_bench_side.png", "tinkering_bench_side.png",

View File

@ -1,3 +1,5 @@
local S = tinkering.S
tool_station = {}
local tool_list_cache = nil
@ -519,7 +521,7 @@ local function on_receive_fields(pos, formname, fields, sender)
end
minetest.register_node("tinkering:tool_station", {
description = "Tool Station",
description = S("Tool Station"),
tiles = {
"tinkering_workbench_top.png", "tinkering_bench_bottom.png",
"tinkering_bench_side.png", "tinkering_bench_side.png",

View File

@ -1,6 +1,8 @@
local S = tinkering.S
tinkering.tools = {
pick = {
description = "Pickaxe",
description = S("Pickaxe"),
groups = {"cracky"},
fleshy_decrement = 1,
components = {
@ -15,7 +17,7 @@ tinkering.tools = {
}
},
axe = {
description = "Axe",
description = S("Axe"),
groups = {"choppy"},
fleshy_increment = 1,
components = {
@ -30,7 +32,7 @@ tinkering.tools = {
}
},
sword = {
description = "Sword",
description = S("Sword"),
groups = {"snappy"},
fleshy_decrement = 0,
components = {
@ -45,7 +47,7 @@ tinkering.tools = {
}
},
shovel = {
description = "Shovel",
description = S("Shovel"),
groups = {"crumbly"},
fleshy_decrement = 1,
components = {
@ -62,12 +64,12 @@ tinkering.tools = {
}
tinkering.components = {
pickaxe_head = {description = "%s Pickaxe Head", material_cost = 2, image = tinkering.tools.pick.textures.main},
axe_head = {description = "%s Axe Head", material_cost = 2, image = tinkering.tools.axe.textures.main},
sword_blade = {description = "%s Sword Blade", material_cost = 2, image = tinkering.tools.sword.textures.main},
shovel_head = {description = "%s Shovel Head", material_cost = 2, image = tinkering.tools.shovel.textures.main},
tool_rod = {description = "%s Tool Rod", material_cost = 1, image = "tinkering_tool_rod.png"},
tool_binding = {description = "%s Tool Binding", material_cost = 2, image = "tinkering_tool_binding.png"}
pickaxe_head = {description = "%s "..S("Pickaxe Head"), material_cost = 2, image = tinkering.tools.pick.textures.main},
axe_head = {description = "%s "..S("Axe Head"), material_cost = 2, image = tinkering.tools.axe.textures.main},
sword_blade = {description = "%s "..S("Sword Blade"), material_cost = 2, image = tinkering.tools.sword.textures.main},
shovel_head = {description = "%s "..S("Shovel Head"), material_cost = 2, image = tinkering.tools.shovel.textures.main},
tool_rod = {description = "%s "..S("Tool Rod"), material_cost = 1, image = "tinkering_tool_rod.png"},
tool_binding = {description = "%s "..S("Tool Binding"), material_cost = 2, image = "tinkering_tool_binding.png"}
}
-- Create component for material