added complete intllib support (i18n)

added french translation
This commit is contained in:
fat115
2017-08-06 18:43:41 +02:00
committed by stujones11
parent 925b39f577
commit ae448c150c
14 changed files with 908 additions and 104 deletions

View File

@ -1,17 +1,11 @@
-- support for i18n
local S = armor_i18n.gettext
local F = armor_i18n.fgettext
if not minetest.global_exists("unified_inventory") then
minetest.log("warning", "3d_armor_ui: Mod loaded but unused.")
minetest.log("warning", S("3d_armor_ui: Mod loaded but unused."))
return
end
local S = function(s) return s end
if minetest.global_exists("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
S = intllib.make_gettext_pair()
else
-- Old method using text files.
S = intllib.Getter()
end
end
if unified_inventory.sfinv_compat_layer then
return
@ -35,23 +29,23 @@ unified_inventory.register_page("armor", {
local fy = perplayer_formspec.formspec_y
local name = player:get_player_name()
if armor.def[name].init_time == 0 then
return {formspec="label[0,0;Armor not initialized!]"}
return {formspec="label[0,0;"..F("Armor not initialized!").."]"}
end
local formspec = "background[0.06,"..fy..";7.92,7.52;3d_armor_ui_form.png]"..
"label[0,0;Armor]"..
"label[0,0;"..F("Armor").."]"..
"list[detached:"..name.."_armor;armor;0,"..fy..";2,3;]"..
"image[2.5,"..(fy - 0.25)..";2,4;"..armor.textures[name].preview.."]"..
"label[5.0,"..(fy + 0.0)..";"..S("Level")..": "..armor.def[name].level.."]"..
"label[5.0,"..(fy + 0.5)..";"..S("Heal")..": "..armor.def[name].heal.."]"..
"label[5.0,"..(fy + 0.0)..";"..F("Level")..": "..armor.def[name].level.."]"..
"label[5.0,"..(fy + 0.5)..";"..F("Heal")..": "..armor.def[name].heal.."]"..
"listring[current_player;main]"..
"listring[detached:"..name.."_armor;armor]"
if armor.config.fire_protect then
formspec = formspec.."label[5.0,"..(fy + 1.0)..";"..
S("Fire")..": "..armor.def[name].fire.."]"
F("Fire")..": "..armor.def[name].fire.."]"
end
if minetest.global_exists("technic") then
formspec = formspec.."label[5.0,"..(fy + 1.5)..";"..
S("Radiation")..": "..armor.def[name].groups["radiation"].."]"
F("Radiation")..": "..armor.def[name].groups["radiation"].."]"
end
return {formspec=formspec}
end,