diff --git a/u_skins/depends.txt b/u_skins/depends.txt index 050b422..d6abd12 100644 --- a/u_skins/depends.txt +++ b/u_skins/depends.txt @@ -1,3 +1,4 @@ unified_inventory default -simple_skins? \ No newline at end of file +simple_skins? +intllib? 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() diff --git a/u_skins/locale/de.txt b/u_skins/locale/de.txt new file mode 100644 index 0000000..6ad87f3 --- /dev/null +++ b/u_skins/locale/de.txt @@ -0,0 +1,9 @@ +# Translation by Xanthin + +Raw texture = Rohtextur +Name = Name +Author = Autor +Change = Wechseln +Page = Seite +License = Lizenz +Description = Beschreibung diff --git a/u_skins/locale/template.txt b/u_skins/locale/template.txt new file mode 100644 index 0000000..6412b7f --- /dev/null +++ b/u_skins/locale/template.txt @@ -0,0 +1,9 @@ +# Template + +Raw texture = +Name = +Author = +Change = +Page = +License = +Description =