Make enchant % translatable
This commit is contained in:
parent
ed5b525dd8
commit
254ae5a4d5
@ -1,5 +1,6 @@
|
|||||||
screwdriver = screwdriver or {}
|
screwdriver = screwdriver or {}
|
||||||
local S = minetest.get_translator("xdecor")
|
local S = minetest.get_translator("xdecor")
|
||||||
|
local NS = function(s) return s end
|
||||||
local FS = function(...) return minetest.formspec_escape(S(...)) end
|
local FS = function(...) return minetest.formspec_escape(S(...)) end
|
||||||
local ceil, abs, random = math.ceil, math.abs, math.random
|
local ceil, abs, random = math.ceil, math.abs, math.random
|
||||||
local reg_tools = minetest.registered_tools
|
local reg_tools = minetest.registered_tools
|
||||||
@ -39,9 +40,9 @@ function enchanting:get_tooltip(enchant, orig_caps, fleshy)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local specs = {
|
local specs = {
|
||||||
durable = {"#00baff", " (+" .. bonus.durable .. "%)"},
|
durable = {"#00baff", bonus.durable},
|
||||||
fast = {"#74ff49", " (+" .. bonus.efficiency .. "%)"},
|
fast = {"#74ff49", bonus.efficiency},
|
||||||
sharp = {"#ffff00", " (+" .. bonus.damages .. "%)"},
|
sharp = {"#ffff00", bonus.damages},
|
||||||
}
|
}
|
||||||
|
|
||||||
local enchant_loc = {
|
local enchant_loc = {
|
||||||
@ -50,9 +51,12 @@ function enchanting:get_tooltip(enchant, orig_caps, fleshy)
|
|||||||
sharp = S("Sharpness"),
|
sharp = S("Sharpness"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return minetest.colorize and minetest.colorize(specs[enchant][1],
|
if minetest.colorize then
|
||||||
enchant_loc[enchant] .. specs[enchant][2]) or
|
--~ Tooltip in format "<enchantment name> (+<bonus>%)", e.g. "Efficiency (+5%)"
|
||||||
enchant_loc[enchant] .. specs[enchant][2]
|
return minetest.colorize(specs[enchant][1], S("@1 (+@2%)", enchant_loc[enchant], specs[enchant][2]))
|
||||||
|
else
|
||||||
|
return S("@1 (+@2%", enchant_loc[enchant], specs[enchant][2])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local enchant_buttons = {
|
local enchant_buttons = {
|
||||||
|
Loading…
Reference in New Issue
Block a user