diff --git a/depends.txt b/depends.txt index d2b2b14..a61ffbc 100644 --- a/depends.txt +++ b/depends.txt @@ -1,2 +1,3 @@ mana? +intllib? doc_items? diff --git a/init.lua b/init.lua index 45fdc24..92e2a80 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,11 @@ +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + returnmirror = {} returnmirror.cost_teleport = 200 returnmirror.cost_set = 20 @@ -53,7 +61,7 @@ returnmirror.set_position_active = function(itemstack, user, pointed_thing) end minetest.register_tool("returnmirror:mirror_inactive", { - description = "Mirror of Returning", + description = S("Mirror of Returning"), inventory_image = "returnmirror_mirror_inactive.png", wield_image = "returnmirror_mirror_inactive.png", tool_capabilities = {}, @@ -66,7 +74,7 @@ minetest.register_tool("returnmirror:mirror_inactive", { }) minetest.register_tool("returnmirror:mirror_active", { - description = "Mirror of Returning", + description = S("Mirror of Returning"), stack_max = 1, inventory_image = "returnmirror_mirror_active.png", wield_image = "returnmirror_mirror_active.png", @@ -124,12 +132,12 @@ minetest.register_alias("returnmirror:mirror_inactive", "returnmirror:returnmirr if minetest.get_modpath("doc_items") ~= nil then local longdesc, usagehelp - usagehelp = "Rightclick to set the mirror's teleport location. Leftclick to immediately teleport back to the mirror's teleport location." + usagehelp = S("Rightclick to set the mirror's teleport location. Leftclick to immediately teleport back to the mirror's teleport location.") if minetest.get_modpath("mana") ~= nil then - longdesc ="This item allows to teleport the user back to a previously set location, at the cost of mana." - usagehelp = usagehelp .. " " .. string.format("Setting the teleport location costs %d mana, teleporting costs %d mana.", returnmirror.cost_set, returnmirror.cost_teleport) + longdesc = S("This item allows to teleport the user back to a previously set location, at the cost of mana.") + usagehelp = usagehelp .. " " .. string.format(S("Setting the teleport location costs %d mana, teleporting costs %d mana."), returnmirror.cost_set, returnmirror.cost_teleport) else - longdesc = "This item allows to teleport its user back to a previously set location." + longdesc = S("This item allows to teleport its user back to a previously set location.") end doc.sub.items.set_items_longdesc({ diff --git a/locale/de.txt b/locale/de.txt new file mode 100644 index 0000000..426fad4 --- /dev/null +++ b/locale/de.txt @@ -0,0 +1,5 @@ +Mirror of Returning = Spiegel der Rückkehr +Rightclick to set the mirror's teleport location. Leftclick to immediately teleport back to the mirror's teleport location. = Rechtsklicken, um die Teleportationsposition des Spiegels zu setzen. Linksklicken, um eine sofortige Teleportation zur Teleportationsposition des Spiegels vorzunehmen. +Setting the teleport location costs %d mana, teleporting costs %d mana. = Das Setzen der Teleportationsposition kostet %d Mana. Das Teleportieren kostet %d Mana. +This item allows to teleport its user back to a previously set location. = Dieser Gegenstand ermöglicht es seinem Benutzer, sich zu einer zuvor gesetzen Position zurück zu teleportieren. +This item allows to teleport the user back to a previously set location, at the cost of mana. = Dieser Gegenstand ermöglicht es dem Benutzer, sich auf Kosten von Mana zu einer zuvor gesetzten Position zurück zu teleportieren. diff --git a/locale/template.txt b/locale/template.txt new file mode 100644 index 0000000..9d9ea76 --- /dev/null +++ b/locale/template.txt @@ -0,0 +1,5 @@ +Mirror of Returning = +Rightclick to set the mirror's teleport location. Leftclick to immediately teleport back to the mirror's teleport location. = +Setting the teleport location costs %d mana, teleporting costs %d mana. = +This item allows to teleport its user back to a previously set location. = +This item allows to teleport the user back to a previously set location, at the cost of mana. =