Fix translation of iron

And preserve compatibility with [toolranks
mod](https://github.com/lisacvuk/minetest-toolranks/).
This commit is contained in:
Louis 2020-02-18 14:05:42 +01:00
parent fcbc7ecb60
commit 8c7e636ceb
9 changed files with 110 additions and 50 deletions

View File

@ -141,54 +141,29 @@ minetest.register_craft({
output = "technic:wrought_iron_ingot",
})
local function for_each_registered_item(action)
local already_reg = {}
for k, _ in pairs(minetest.registered_items) do
table.insert(already_reg, k)
end
local really_register_craftitem = minetest.register_craftitem
minetest.register_craftitem = function(name, def)
really_register_craftitem(name, def)
action(string.gsub(name, "^:", ""))
end
local really_register_tool = minetest.register_tool
minetest.register_tool = function(name, def)
really_register_tool(name, def)
action(string.gsub(name, "^:", ""))
end
local really_register_node = minetest.register_node
minetest.register_node = function(name, def)
really_register_node(name, def)
action(string.gsub(name, "^:", ""))
end
for _, name in ipairs(already_reg) do
action(name)
local steel_to_iron = {
{name="default:axe_steel", description=S("Iron Axe")},
{name="default:pick_steel", description=S("Iron Pickaxe")},
{name="default:shovel_steel", description=S("Iron Shovel")},
{name="default:sword_steel", description=S("Iron Sword")},
{name="doors:door_steel", description=S("Iron Door")},
{name="farming:hoe_steel", description=S("Iron Hoe")},
{name="glooptest:hammer_steel", description=S("Iron Hammer")},
{name="glooptest:handsaw_steel", description=S("Iron Handsaw")},
{name="glooptest:reinforced_crystal_glass", description=S("Iron-Reinforced Crystal Glass")},
{name="vessels:steel_bottle", description=S("Heavy Iron Bottle (empty)")},
}
for _, v in ipairs(steel_to_iron) do
local item_def = minetest.registered_items[v.name]
if item_def then
-- toolranks mod compatibility
if minetest.get_modpath("toolranks") and item_def.original_description then
minetest.override_item(v.name, {
original_description = v.description,
description = toolranks.create_description(v.description, 0, 1)})
else
minetest.override_item(v.name, { description = v.description })
end
end
end
local steel_to_iron = {}
for _, i in ipairs({
"default:axe_steel",
"default:pick_steel",
"default:shovel_steel",
"default:sword_steel",
"doors:door_steel",
"farming:hoe_steel",
"glooptest:hammer_steel",
"glooptest:handsaw_steel",
"glooptest:reinforced_crystal_glass",
"mesecons_doors:op_door_steel",
"mesecons_doors:sig_door_steel",
"vessels:steel_bottle",
}) do
steel_to_iron[i] = true
end
for_each_registered_item(function(item_name)
local item_def = minetest.registered_items[item_name]
if steel_to_iron[item_name] and string.find(item_def.description, "Steel") then
-- TODO: Fix this line
-- This is not the good way to do this because it breaks translations
minetest.override_item(item_name, { description = string.gsub(item_def.description, "Steel", "Iron") })
end
end)

View File

@ -18,6 +18,18 @@ Carbon Steel Ingot=Kohlenstoffstahlbarren
Stainless Steel Ingot=Edelstahlbarren
Iron=Eisen
#### Steel to iron
Iron Axe=
Iron Pickaxe=
Iron Shovel=
Iron Sword=
Iron Door=
Iron Hoe=
Iron Hammer=
Iron Handsaw=
Iron-Reinforced Crystal Glass=
Heavy Iron Bottle (empty)=
## nodes.lua
Uranium Ore=Uranerz
Chromium Ore=Chromerz

View File

@ -16,6 +16,18 @@ Carbon Steel Ingot=Lingote de Acero al Carbon
Stainless Steel Ingot=Lingote de Acero inoxidable
Iron=Lingote
#### Steel to iron
Iron Axe=
Iron Pickaxe=
Iron Shovel=
Iron Sword=
Iron Door=
Iron Hoe=
Iron Hammer=
Iron Handsaw=
Iron-Reinforced Crystal Glass=
Heavy Iron Bottle (empty)=
###nodes.lua
Uranium Ore=Mineral de Uranio
Chromium Ore=Mineral de Cromo

View File

@ -20,6 +20,18 @@ Carbon Steel Ingot=Lingot d'acier au carbone
Stainless Steel Ingot=Lingot d'acier inoxydable
Iron=Fer
#### Steel to iron
Iron Axe=Hache en fer
Iron Pickaxe=Pioche en fer
Iron Shovel=Pelle en fer
Iron Sword=Épée en fer
Iron Door=Porte en fer
Iron Hoe=Houe en fer
Iron Hammer=Marteau en fer
Iron Handsaw=Scie circulaire en fer
Iron-Reinforced Crystal Glass=Verre en crystal renforcé au fer
Heavy Iron Bottle (empty)=Bouteille lourde en fer (vide)
###nodes.lua
Sulfur Ore=Minerai de soufre
Lead Ore=Minerai de plomb

View File

@ -18,6 +18,18 @@ Carbon Steel Ingot=Sztabka stali węglowej
Stainless Steel Ingot=Sztabka nierdzewnej stali
Iron=Żelazo
#### Steel to iron
Iron Axe=
Iron Pickaxe=
Iron Shovel=
Iron Sword=
Iron Door=
Iron Hoe=
Iron Hammer=
Iron Handsaw=
Iron-Reinforced Crystal Glass=
Heavy Iron Bottle (empty)=
###nodes.lua
Uranium Ore=Ruda uranu
Chromium Ore=Ruda chromu

View File

@ -18,6 +18,18 @@ Carbon Steel Ingot=Lingote de Aço Carbono
Stainless Steel Ingot= Lingote de Ferro Inoxidável
Iron=Ferro
#### Steel to iron
Iron Axe=
Iron Pickaxe=
Iron Shovel=
Iron Sword=
Iron Door=
Iron Hoe=
Iron Hammer=
Iron Handsaw=
Iron-Reinforced Crystal Glass=
Heavy Iron Bottle (empty)=
###nodes.lua
Uranium Ore=Minério de Urânio
Chromium Ore=Minério de Crômio

View File

@ -18,6 +18,18 @@ Carbon Steel Ingot=Karbon çelik külçe
Stainless Steel Ingot =Paslanmaz çelik külçe
Iron=Demir
#### Steel to iron
Iron Axe=
Iron Pickaxe=
Iron Shovel=
Iron Sword=
Iron Door=
Iron Hoe=
Iron Hammer=
Iron Handsaw=
Iron-Reinforced Crystal Glass=
Heavy Iron Bottle (empty)=
###nodes.lua
Uranium Ore=Uranyum madeni
Chromium Ore=Krom madeni

View File

@ -20,6 +20,19 @@ Carbon Steel Ingot=
Stainless Steel Ingot=
Iron=
#### Steel to iron
Iron Axe=
Iron Pickaxe=
Iron Shovel=
Iron Sword=
Iron Door=
Iron Hoe=
Iron Hammer=
Iron Handsaw=
Iron-Reinforced Crystal Glass=
Heavy Iron Bottle (empty)=
###nodes.lua
Sulfur Ore=
Lead Ore=

View File

@ -1,3 +1,3 @@
name = technic_worldgen
depends = default, basic_materials
optional_depends = mg, doors, farming, glooptest, mesecons_doors, vessels
optional_depends = mg, doors, farming, glooptest, mesecons_doors, vessels, toolranks