summaryrefslogtreecommitdiff
path: root/u_skins/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'u_skins/init.lua')
-rw-r--r--u_skins/init.lua24
1 files changed, 16 insertions, 8 deletions
diff --git a/u_skins/init.lua b/u_skins/init.lua
index bd223a2..2d3246c 100644
--- a/u_skins/init.lua
+++ b/u_skins/init.lua
@@ -2,6 +2,14 @@
-- Copyright (c) 2012 cornernote, Dean Montgomery
-- License: GPLv3
+-- Boilerplate to support localized strings if intllib mod is installed.
+local S
+if intllib then
+ S = intllib.Getter()
+else
+ S = function(s) return s end
+end
+
u_skins = {}
u_skins.modpath = minetest.get_modpath("u_skins")
u_skins.file = minetest.get_worldpath().."/u_skins.mt"
@@ -62,29 +70,29 @@ unified_inventory.register_page("u_skins", {
local formspec = ("background[0.06,0.99;7.92,7.52;ui_misc_form.png]"
.."image[0,.75;1,2;"..u_skins.u_skins[name].."_preview.png]"
- .."label[6,.5;Raw texture:]"
+ .."label[6,.5;"..S("Raw texture")..":]"
.."image[6,1;2,1;"..u_skins.u_skins[name]..".png]")
local meta = u_skins.meta[u_skins.u_skins[name]]
if meta then
if meta.name ~= "" then
- formspec = formspec.."label[2,.5;Name: "..minetest.formspec_escape(meta.name).."]"
+ formspec = formspec.."label[2,.5;"..S("Name")..": "..minetest.formspec_escape(meta.name).."]"
end
if meta.author ~= "" then
- formspec = formspec.."label[2,1;Author: "..minetest.formspec_escape(meta.author).."]"
+ formspec = formspec.."label[2,1;"..S("Author")..": "..minetest.formspec_escape(meta.author).."]"
end
if meta.license ~= "" then
- formspec = formspec.."label[2,1.5;License: "..minetest.formspec_escape(meta.license).."]"
+ formspec = formspec.."label[2,1.5;"..S("License")..": "..minetest.formspec_escape(meta.license).."]"
end
if meta.description ~= "" then --what's that??
- formspec = formspec.."label[2,2;Description: "..minetest.formspec_escape(meta.description).."]"
+ formspec = formspec.."label[2,2;"..S("Description")..": "..minetest.formspec_escape(meta.description).."]"
end
end
local page = 0
if u_skins.pages[name] then
page = u_skins.pages[name]
end
- formspec = formspec .. "button[.75,3;6.5,.5;u_skins_page$"..page..";Change]"
+ formspec = formspec .. "button[.75,3;6.5,.5;u_skins_page$"..page..";"..S("Change").."]"
return {formspec=formspec}
end,
})
@@ -131,7 +139,7 @@ u_skins.generate_pages = function(texture)
end
formspec = (formspec
.."button[0,3.8;1,.5;u_skins_page$"..page_prev..";<<]"
- .."button[.75,3.8;6.5,.5;u_skins_null;Page "..page.."/"..total_pages.."]"
+ .."button[.75,3.8;6.5,.5;u_skins_null;"..S("Page").." "..page.."/"..total_pages.."]"
.."button[7,3.8;1,.5;u_skins_page$"..page_next..";>>]")
unified_inventory.register_page("u_skins_page$"..(page - 1), {
@@ -172,4 +180,4 @@ minetest.register_on_joinplayer(function(player)
end)
u_skins.generate_pages()
-u_skins.load_players() \ No newline at end of file
+u_skins.load_players()