Support Intlib added.

master
= 2017-12-24 04:54:46 +01:00
parent 6f176ff2c5
commit 14ddde689e
9 changed files with 1122 additions and 72 deletions

View File

@ -1 +1,3 @@
intllib?
unified_inventory?

141
init.lua
View File

@ -1,6 +1,9 @@
poi_namefilter = {}
poi_categories = {}
-- Load support for intllib.
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/namefilter.lua") -- avoid servercrash loop if someone decided to rename the modfolder !
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/categories.lua")
@ -31,7 +34,7 @@ local drop_down = 0
local catlist = ""
minetest.register_privilege("poi", "Player may set and manage Points of Interest.")
minetest.register_privilege("poi", S("Player may set and manage Points of Interest."))
--[[
@ -68,7 +71,7 @@ function poi.list_filter(name)
end -- for key, value
poi.print(name, list, orange)
poi.print(name, index .. " Filter in List.", green)
poi.print(name, index .. S(" Filter in List."), green)
end -- poi.list_filter()
@ -83,7 +86,7 @@ function poi.list_categories(name)
end -- for key,value
poi.print(name, list, orange) -- Send List to Player
poi.print(name, index .. " Categories in List.", green) -- Send List to Player
poi.print(name, index .. S(" Categories in List."), green) -- Send List to Player
end -- poi.list_categories()
@ -127,10 +130,10 @@ function poi.list(name, option)
end
if (idx > 0) then
poi.print(name, "Point's of Interest in Categorie " .. poi.get_categoriename(idx) .. " are:", green)
poi.print(name, S("Point's of Interest in Categorie ") .. poi.get_categoriename(idx) .. S(" are:"), green)
else
poi.print(name, poi.count() .. " Point's of Interest are:", green)
poi.print(name, poi.count() .. S(" Point's of Interest are:"), green)
end -- if(idx > 0)
@ -150,7 +153,7 @@ function poi.list(name, option)
else -- if(idx > 0)
if all then
list = list .. key .. ": " .. pos .. " Categorie: " .. poi.get_categoriename(cat) .. "\n"
list = list .. key .. ": " .. pos .. S(" Categorie: ") .. poi.get_categoriename(cat) .. "\n"
else
list = list .. key .. "\n"
@ -182,7 +185,7 @@ function poi.set(name, poi_name)
if poi.exist(p_name) then -- Ups, Name exists
if(poi.get_categorie(p_name) ~= categorie) then -- ok, we want to change the Categorie
if(categorie == -1) then -- Invalid Categoriename?
poi.print(name, "Given Categorie don't exists.", red)
poi.print(name, S("Given Categorie don't exists."), red)
return false
end -- if(poi.get_categoriename())
@ -191,13 +194,13 @@ function poi.set(name, poi_name)
local pos, cat
pos, cat = poi.split_pos_cat(poi.points[p_name])
poi.points[p_name] = pos .. "{" .. tonumber(categorie) .. "}" -- Changes the Entry
poi.print(name, name .. " has changed the POI: " .. p_name .. " at " .. pos .. " Categorie: " .. poi.get_categoriename(cat) .. " to Categorie: " .. poi.get_categoriename(categorie) .. "\n", log)
poi.print(name, "POI: " .. p_name .. " at " .. pos .." in Categorie: " .. poi.get_categoriename(cat) .." changed to Categorie: " .. poi.get_categoriename(categorie), green)
poi.print(name, name .. S(" has changed the POI: ") .. p_name .. S(" at ") .. pos .. S(" Categorie: ") .. poi.get_categoriename(cat) .. S(" to Categorie: ") .. poi.get_categoriename(categorie) .. "\n", log)
poi.print(name, "POI: " .. p_name .. S(" at ") .. pos .. S(" in Categorie: ") .. poi.get_categoriename(cat) .. S(" changed to Categorie: ") .. poi.get_categoriename(categorie), green)
poi.save()
return true
else
poi.print(name, "PoI <" .. p_name .. "> in Categorie <" .. categorie .. " - " .. poi.get_categoriename(categorie) .. "> already exists.", red)
poi.print(name, "PoI <" .. p_name .. S("> in Categorie <") .. categorie .. " - " .. poi.get_categoriename(categorie) .. S("> already exists."), red)
return false -- Name exists, leave function
end -- if(poi.get_categorie)
@ -206,21 +209,21 @@ function poi.set(name, poi_name)
if not poi.check_name(p_name) then
poi_name = poi.convertnil(poi_name) -- convert possible NIL
poi.print(name, "Invalid or Forbidden Name <" .. p_name .. "> for PoI.", red)
poi.print(name, S("Invalid or Forbidden Name <") .. p_name .. S("> for PoI."), red)
return false
end -- if poi.check_name
if(categorie == -1) then -- Checks invalid Categoriename, then set it on new Entry to 1
poi.print(name, "Warning: Unkown Categorie, set to Categorie 1.", red)
poi.print(name, S("Warning: Unkown Categorie, set to Categorie 1."), red)
categorie = 1
end
poi.points[p_name] = minetest.pos_to_string(currpos) .. "{" .. tonumber(categorie) .. "}"-- Insert the new Entry
poi.save() -- and write the new List
poi.print(name, name .. " has set the POI: " .. p_name .. " at " .. minetest.pos_to_string(currpos) .. " Categorie: {" .. poi.get_categoriename(categorie) .. "}\n", log)
poi.print(name, "POI: " .. p_name .. " at " .. minetest.pos_to_string(currpos) .." in Categorie: " .. poi.get_categoriename(categorie) .." stored.", green)
poi.print(name, name .. S(" has set the POI: ") .. p_name .. S(" at ") .. minetest.pos_to_string(currpos) .. S(" Categorie: ") .. "{" .. poi.get_categoriename(categorie) .. "}\n", log)
poi.print(name, "POI: " .. p_name .. S(" at ") .. minetest.pos_to_string(currpos) .. S(" in Categorie: ") .. poi.get_categoriename(categorie) .. S(" stored."), green)
return true
end -- poi.set()
@ -230,7 +233,7 @@ function poi.delete(name, poi_name)
if(poi_name == nil or poi_name == "") then -- No PoI-Name given ..
poi.print(name, "Name of the PoI needed.", red)
poi.print(name, S("Name of the PoI needed."), red)
return false -- can't delete a non-existing Entry, leave function
end
@ -238,7 +241,7 @@ function poi.delete(name, poi_name)
if poi.exist(poi_name) == false then
poi_name = poi.convertnil(poi_name) -- convert possible NIL
poi.print(name, "PoI <" .. poi_name .. "> unknown to delete.", red)
poi.print(name, "PoI <" .. poi_name .. S("> unknown to delete."), red)
return false -- can't delete a non-existing Entry, leave function
end -- if poi.exist
@ -248,8 +251,8 @@ function poi.delete(name, poi_name)
list = poi_name .. ": " .. poi.points[poi_name] -- Get the full Name of the PoI and save it in a temporary var
poi.points[poi_name] = nil -- and delete it
poi.print(name, name .. " has deleted POI-Name: " .. list .. "\n", log)
poi.print(name, list .. " deleted.", red)
poi.print(name, name .. S(" has deleted POI-Name: ") .. list .. "\n", log)
poi.print(name, list .. S(" deleted."), red)
poi.save() -- Write the new list at the server
return true
@ -261,7 +264,7 @@ function poi.reload(name)
poi.points = nil -- Deletes the List of PoI's
poi.openlist() -- and Load it new
poi.print(name, "POI-List reloaded.", red)
poi.print(name, S("POI-List reloaded."), red)
return true
end -- poi.reload()
@ -271,7 +274,7 @@ function poi.jump(name, poi_name)
if (poi.exist(poi_name) == false) then -- Unknown or not existing Point of Interest
poi_name = poi.convertnil(poi_name) -- convert possible NIL
poi.print(name, "Unknown Point of Interest: " .. poi_name .. ".", red)
poi.print(name, S("Unknown Point of Interest: ") .. poi_name .. ".", red)
return false -- POI not in List, leave function
end -- if poi.exist
@ -284,7 +287,7 @@ function poi.jump(name, poi_name)
poi.play_soundeffect(name, "teleport") -- Play's a Sound
player:setpos(minetest.string_to_pos(Position)) -- Move Player to Point
poi.print(name, "You are moved to POI: " .. poi_name .. ".", green)
poi.print(name, S("You are moved to POI: ") .. poi_name .. ".", green)
return true
end -- poi.jump()
@ -346,36 +349,36 @@ function poi.gui(player_name, showup, main)
end -- for key,value
if minetest.get_player_privs(player_name).poi then
manageme = "button[5,6.5;2,1;poimanager;Manage_PoI]"
manageme = "button[5,6.5;2,1;poimanager;" .. S("Manage_PoI]")
end
if main then
minetest.show_formspec(player_name,"minetest_poi:thegui", -- The main gui for everyone with interact
"size[7,8]" ..
"label[0.4,0;> Doubleclick on destination to teleport <]"..
"label[0.4,0;> ".. S("Doubleclick on destination to teleport") .. " <]"..
--showcat..
"textlist[0.4,1;3,5;name;"..list..";selected_idx;false]"..
"label[0.6,6;".. count .. " Points in List]"..
"label[4.3,0.5; Categories ]"..
"label[0.6,6;".. count .. S(" Points in List]") ..
"label[4.3,0.5; ".. S("Categories ]") ..
"dropdown[4,1;2,1;dname;"..catlist..";"..drop_down.."]"..
"button[0.4,6.5;1,1;poitelme;Go]"..
"button[1.4,6.5;2,1;poishowall;ShowAll]"..manageme..
"button_exit[0.4,7.4;3.4,1;poiexit;Quit]"
"button[0.4,6.5;1,1;poitelme;".. S("Go]") ..
"button[1.4,6.5;2,1;poishowall;" .. S("ShowAll]") ..manageme..
"button_exit[0.4,7.4;3.4,1;poiexit;" .. S("Quit]")
)
else
minetest.show_formspec(player_name,"minetest_poi:manager", -- The management gui for people with poi priv
"size[7,9]" ..
"textlist[0.4,0;3,5;maname;"..list..";"..choosen_name..";false]"..
"textlist[4,0;2,2;madname;"..catlist..";"..selected_category..";false]"..
"button[4,2.5;2,1;reload;Reload]"..
"button[4,3.5;2,1;validate;Validate]"..
"button[4,2.5;2,1;reload;" .. S("Reload") .. "]" ..
"button[4,3.5;2,1;validate;" .. S("Validate") .. "]"..
"field[0.3,5.4;7,1;managename; - enter name -;"..selected_point.."]"..
"button[0.4,6;6,1;set;Set Point or change Categorie]"..
"button[0.4,7;2,1;rename;Rename]"..
"button[2.4,7;2,1;move;Move]"..
"button[0.4,6;6,1;set;" .. S("Set Point or change Categorie") .. "]"..
"button[0.4,7;2,1;rename;" .. S("Rename") .. "]"..
"button[2.4,7;2,1;move;" .. S("Move") .. "]"..
"image_button[5.4,7;1,1;minetest_poi_deleteme.png;delete;]"..
"button_exit[0.4,8;3,1;doexit;Quit]"..
"button[3.4,8;3,1;goback;Back]"
"button_exit[0.4,8;3,1;doexit;" .. S("Quit") .. "]"..
"button[3.4,8;3,1;goback;" .. S("Back") .. "]"
)
end
end -- poi.gui()
@ -468,7 +471,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
poi.delete(player:get_player_name(),selected_point)
poi.gui(player:get_player_name(), nil, false)
else
poi.print(player:get_player_name()," >>> Sorry this button is for admin only, please use /poi_delete "..selected_point,red)
poi.print(player:get_player_name(),S(" >>> Sorry this button is for admin only, please use /poi_delete ")..selected_point,red)
end
end
@ -524,7 +527,7 @@ function poi.move(name, poi_name)
if (poi.exist(poi_name) == false) then
poi_name = poi.convertnil(poi_name) -- convert possible NIL
poi.print(name, "Unknown PoI <" .. poi_name .. ">.", red)
poi.print(name, S("Unknown PoI <") .. poi_name .. ">.", red)
return false
end -- if poi.exist
@ -537,8 +540,8 @@ function poi.move(name, poi_name)
poi.points[poi_name] = minetest.pos_to_string(currpos) .. "{" .. tonumber(cat) .. "}" -- Write the Position new
poi.save() -- and write the List
poi.print(name, name .. " has moved the POI: " .. poi_name .. " at " .. oldpos .. " to Position: " .. minetest.pos_to_string(currpos) .. "\n", log)
poi.print(name, "POI: " .. poi_name .. " at " .. oldpos .." moved to Position: " .. minetest.pos_to_string(currpos) .."\n", green)
poi.print(name, name .. S(" has moved the POI: ") .. poi_name .. S(" at ") .. oldpos .. S(" to Position: ") .. minetest.pos_to_string(currpos) .. "\n", log)
poi.print(name, "POI: " .. poi_name .. S(" at ") .. oldpos .. S(" moved to Position: ") .. minetest.pos_to_string(currpos) .."\n", green)
return true
end -- poi.move
@ -548,26 +551,26 @@ function poi.rename(name, poi_name)
local oldname, newname
if string.find(poi_name, ",") == nil then
poi.print(name, "/poi_rename: No new Name for Point given.\n", red)
poi.print(name, S("/poi_rename: No new Name for Point given.") .. "\n", red)
return false
end
oldname = poi.trim(string.sub(poi_name,1, string.find(poi_name, ",")-1))
if not poi.exist(oldname) then
poi.print(name, "Point to rename not found.\n", red)
poi.print(name, S("Point to rename not found.") .. "\n", red)
return false
end
newname = poi.trim(string.sub(poi_name, string.find(poi_name, ",") + 1, -1))
if not poi.check_name(newname) then
poi.print(name, "Invalid new Pointname.\n", red)
poi.print(name, S("Invalid new Pointname.") .. "\n", red)
return false
end
if poi.exist(newname) then
poi.print(name, "New Pointname already exists.\n", red)
poi.print(name, S("New Pointname already exists.") .. "\n", red)
return false
end
@ -578,8 +581,8 @@ function poi.rename(name, poi_name)
poi.points[oldname] = nil -- now deletes the old one
poi.save() -- saves the List
poi.print(name, name .. " has renamed POI-Name: " .. oldname .. " to: " .. newname .. " - Position: " .. old_position .. "\n", log)
poi.print(name, "PoI-Name: " .. oldname .. " renamed to " .. newname .. " - Position: " .. old_position .. "\n", green)
poi.print(name, name .. S(" has renamed POI-Name: ") .. oldname .. S(" to: ") .. newname .. S(" - Position: ") .. old_position .. "\n", log)
poi.print(name, S("PoI-Name: ") .. oldname .. S(" renamed to ") .. newname .. S(" - Position: ") .. old_position .. "\n", green)
end -- poi.rename()
@ -644,12 +647,12 @@ function poi.validate(name)
if (count > 0) or (invalid_cat > 0) then
poi.print(name, name .. " has deleted with validate " .. count .. " PoI's.\n", log)
poi.print(name, name .. " has found " .. invalid_cat .. " Entries with an invalid Categorie.\n", log)
poi.print(name, count .. " invalid PoI's found and deleted.", red)
poi.print(name, invalid_cat .. " PoI's with an invalid Categorie found and set to 1.", red)
poi.print(name, count .. S(" invalid PoI's found and deleted."), red)
poi.print(name, invalid_cat .. S(" PoI's with an invalid Categorie found and set to 1."), red)
poi.save()
else
poi.print(name, "No invalid PoI found.\n", green)
poi.print(name, S("No invalid PoI found.") .. "\n", green)
end
@ -921,8 +924,8 @@ end -- poi.convertnil()
--]]
minetest.register_chatcommand("poi_set", {
params = "<poi_name, Categorie[number]>",
description = "Set's a Point of Interest or changes the Categorie of an existing Point.",
params = S("<poi_name, Categorie[number]>"),
description = S("Set's a Point of Interest or changes the Categorie of an existing Point."),
privs = {poi = true},
func = function(name, poi_name)
@ -933,7 +936,7 @@ minetest.register_chatcommand("poi_set", {
minetest.register_chatcommand("poi_gui", {
params = "",
description = "Shows PoIs in a GUI.",
description = S("Shows PoIs in a GUI."),
privs = {interact = true},
func = function(name)
@ -942,8 +945,8 @@ minetest.register_chatcommand("poi_gui", {
end,
})
minetest.register_chatcommand("poi_list", {
params = "<-a> <-c> <-f> <-i [Categorie[Number]]>",
description = "Shows Point's of Interest.\nOption -a shows Point's of Interest with Coordinates.\nOption -c shows you Categories.\nOption -f shows you the Namefilter\nOption -i <Categorie[number]]> shows only the Entries of the given Categorienumber or Name",
params = S("<-a> <-c> <-f> <-i [Categorie[Number]]>"),
description = S("Shows Point's of Interest.\nOption -a shows Point's of Interest with Coordinates.\nOption -c shows you Categories.\nOption -f shows you the Namefilter\nOption -i <Categorie[number]]> shows only the Entries of the given Categorienumber or Name"),
privs = {interact = true},
func = function(name, arg)
@ -953,8 +956,8 @@ minetest.register_chatcommand("poi_list", {
})
minetest.register_chatcommand("poi_delete", {
params = "<poi_name>",
description = "Deletes a Point of Interest.",
params = S("<POI-Name>"),
description = S("Deletes a Point of Interest."),
privs = {poi = true},
func = function(name, poi_name)
@ -965,7 +968,7 @@ minetest.register_chatcommand("poi_delete", {
minetest.register_chatcommand("poi_reload", {
params = "",
description = "Loads the List of POI's new.",
description = S("Loads the List of POI's new."),
privs = {poi = true},
func = function(name)
@ -976,8 +979,8 @@ minetest.register_chatcommand("poi_reload", {
minetest.register_chatcommand("poi_jump", {
params = "<POI-Name>",
description = "Jumps to the Position of the Point of Interest.",
params = S("<POI-Name>"),
description = S("Jumps to the Position of the Point of Interest."),
privs = {interact = true},
func = function(name, poi_name)
@ -987,8 +990,8 @@ minetest.register_chatcommand("poi_jump", {
})
minetest.register_chatcommand("poi_move", {
params = "<POI-Name>",
description = "Changes the Position of the Point of Interest.",
params = S("<POI-Name>"),
description = S("Changes the Position of the Point of Interest."),
privs = {interact = true},
func = function(name, poi_name)
@ -998,8 +1001,8 @@ minetest.register_chatcommand("poi_move", {
})
minetest.register_chatcommand("poi_rename", {
params = "<POI Old Name>,<POI New Name>",
description = "Changes the Name of the Point of Interest.",
params = S("<POI Old Name>,<POI New Name>"),
description = S("Changes the Name of the Point of Interest."),
privs = {interact = true},
func = function(name, poi_name)
@ -1010,7 +1013,7 @@ minetest.register_chatcommand("poi_rename", {
minetest.register_chatcommand("poi_validate", {
params = "",
description = "Validates the List of PoI's.",
description = S("Validates the List of PoI's."),
privs = {poi = true},
func = function(name)
@ -1025,7 +1028,7 @@ if (minetest.get_modpath("unified_inventory")) then
unified_inventory.register_button("minetest_poi", {
type = "image",
image = "minetest_poi_button_32x32.png",
tooltip = "Show Points of Interest",
tooltip = S("Show Points of Interest"),
hide_lite=true,
action = function(player)
local player_name = player:get_player_name()
@ -1033,7 +1036,7 @@ if (minetest.get_modpath("unified_inventory")) then
if minetest.check_player_privs(player_name, {interact=true}) then
poi.gui(player_name,nil,true)
else
minetest.chat_send_player(player_name,core.colorize(red, "You need the")..core.colorize(green," interact")..core.colorize(red," priv, please type")..core.colorize(green," /rules")..core.colorize(red," and search for the keyword"))
minetest.chat_send_player(player_name,core.colorize(red, S("You need the"))..core.colorize(green, S(" interact"))..core.colorize(red,S(" priv, please type"))..core.colorize(green,S(" /rules"))..core.colorize(red,S(" and search for the keyword")))
end
end,
})
@ -1049,10 +1052,4 @@ poi.openlist() -- Initalize the List on Start
poi.filter = poi_namefilter
poi.categories = poi_categories
poi.max_categories = poi.count_categories()
poi.build_cat_list()
poi.build_cat_list()

45
intllib.lua Normal file
View File

@ -0,0 +1,45 @@
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.
-- Get the latest version of this file at:
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
local function format(str, ...)
local args = { ... }
local function repl(escape, open, num, close)
if escape == "" then
local replacement = tostring(args[tonumber(num)])
if open == "" then
replacement = replacement..close
end
return replacement
else
return "@"..open..num..close
end
end
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end
local gettext, ngettext
if minetest.get_modpath("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
gettext, ngettext = intllib.make_gettext_pair()
else
-- Old method using text files.
gettext = intllib.Getter()
end
end
-- Fill in missing functions.
gettext = gettext or function(msgid, ...)
return format(msgid, ...)
end
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
return format(n==1 and msgid or msgid_plural, ...)
end
return gettext, ngettext

340
locale/de_DE.pot Normal file
View File

@ -0,0 +1,340 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-24 03:51+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: init.lua
msgid "Player may set and manage Points of Interest."
msgstr "Spieler dürfen Sehenswürdigkeiten setzen und verwalten."
#: init.lua
msgid " Filter in List."
msgstr "Filter in Liste."
#: init.lua
msgid " Categories in List."
msgstr "Kategorien in Liste."
#: init.lua
msgid "Point's of Interest in Categorie "
msgstr "Sehenswürdigkeiten in Kategorie "
#: init.lua
msgid " are:"
msgstr " sind:"
#: init.lua
msgid " Point's of Interest are:"
msgstr " Sehenswürdigkeiten sind:"
#: init.lua
msgid " Categorie: "
msgstr " Kategorie: "
#: init.lua
msgid "Given Categorie don't exists."
msgstr "Gegebene Kategorie gibt es nicht."
#: init.lua
msgid " has changed the POI: "
msgstr " veränderte den POI: "
#: init.lua
msgid " at "
msgstr " bei "
#: init.lua
msgid " to Categorie: "
msgstr " zur Kategorie: "
#: init.lua
msgid " in Categorie: "
msgstr " in der Kategorie: "
#: init.lua
msgid " changed to Categorie: "
msgstr " verändert zur Kategorie: "
#: init.lua
msgid "> in Categorie <"
msgstr "> in Kategorie <"
#: init.lua
msgid "> already exists."
msgstr "> gibts es bereits."
#: init.lua
msgid "Invalid or Forbidden Name <"
msgstr " Ungültiger oder verbotener Name <"
#: init.lua
msgid "> for PoI."
msgstr "> für PoI."
#: init.lua
msgid "Warning: Unkown Categorie, set to Categorie 1."
msgstr "Warnung: Unbekannte Kategorie, auf Kategorie 1 gesetzt."
#: init.lua
msgid " has set the POI: "
msgstr " hat den POI gesetzt: "
#: init.lua
msgid " stored."
msgstr " gespeichert."
#: init.lua
msgid "Name of the PoI needed."
msgstr "Namen der Sehenswürdigkeit benötigt."
#: init.lua
msgid "> unknown to delete."
msgstr "> unbekannt um zu löschen."
#: init.lua
msgid " has deleted POI-Name: "
msgstr " löschte POI-Name: "
#: init.lua
msgid " deleted."
msgstr " gelöscht."
#: init.lua
msgid "POI-List reloaded."
msgstr "POI-Liste neu geladen."
#: init.lua
msgid "Unknown Point of Interest: "
msgstr "Unbekannte Sehenswürdigkeit: "
#: init.lua
msgid "You are moved to POI: "
msgstr "Du wurdest verschoben zur Sehenswürdigkeit: "
#: init.lua
msgid "Manage_PoI]"
msgstr "Verwalte PoI"
#: init.lua
msgid " Points in List]"
msgstr " Punkte in Liste]"
#: init.lua
msgid "Categories ]"
msgstr " Kategorien ]"
#: init.lua
msgid "Go]"
msgstr "Los]"
#: init.lua
msgid "ShowAll]"
msgstr "ZeigeAlles]"
#: init.lua
msgid "Quit]"
msgstr "Ende]"
#: init.lua
msgid "Doubleclick on destination to teleport"
msgstr "Doppelklick auf Ziel zum Teleportieren"
#: init.lua
msgid "Reload"
msgstr "Neu laden"
#: init.lua
msgid "Validate"
msgstr "Überprüfen"
#: init.lua
msgid "Set Point or change Categorie"
msgstr "Erstelle Punkt oder ändere die Kategorie"
#: init.lua
msgid "Rename"
msgstr "Umbenennen"
#: init.lua
msgid "Move"
msgstr "Verschieben"
#: init.lua
msgid "Quit"
msgstr "Ende"
#: init.lua
msgid "Back"
msgstr "Zurück"
#: init.lua
msgid " >>> Sorry this button is for admin only, please use /poi_delete "
msgstr " >>> Tut mir leid, dieser Knopf ist nur für Admin, verwende stattdessen bitte /poi_delete "
#: init.lua
msgid "Unknown PoI <"
msgstr "Unbekannter PoI <"
#: init.lua
msgid " has moved the POI: "
msgstr " verschob den POI: "
#: init.lua
msgid " to Position: "
msgstr " auf Position: "
#: init.lua
msgid " moved to Position: "
msgstr " verschoben zu Position: "
#: init.lua
msgid "/poi_rename: No new Name for Point given."
msgstr "/poi_rename: Keinen neuen Namen für Punkt angegeben."
#: init.lua
msgid "Point to rename not found."
msgstr "Punkt zum Umbenennen nicht gefunden."
#: init.lua
msgid "Invalid new Pointname."
msgstr "Ungültiger neuer Punktnamen."
#: init.lua
msgid "New Pointname already exists."
msgstr "Neuen Punktnamen gibt es bereits."
#: init.lua
msgid " has renamed POI-Name: "
msgstr "hat POI-Name umbenannt: "
#: init.lua
msgid " to: "
msgstr " zu: "
#: init.lua
msgid " - Position: "
msgstr " - Position: "
#: init.lua
msgid "PoI-Name: "
msgstr "PoI-Name: "
#: init.lua
msgid " renamed to "
msgstr " umbenannt zu "
#: init.lua
msgid " invalid PoI's found and deleted."
msgstr " ungültige PoI's gefunden und gelöscht."
#: init.lua
msgid " PoI's with an invalid Categorie found and set to 1."
msgstr " PoI's mit ungültiger Kategorie gefunden und auf 1 gesetzt."
#: init.lua
msgid "No invalid PoI found."
msgstr "Keinen ungültigen PoI gefunden."
#: init.lua
msgid "<poi_name, Categorie[number]>"
msgstr "<poi_name, Kategorie[nummer]>"
#: init.lua
msgid ""
"Set's a Point of Interest or changes the Categorie of an existing Point."
msgstr ""
"Erstellt eine Sehenswürdigkeit oder verändert die Kategorie einer existierenden Sehenswürdigkeit."
#: init.lua
msgid "Shows PoIs in a GUI."
msgstr "Zeigt PoIs in einer GUI"
#: init.lua
msgid "<-a> <-c> <-f> <-i [Categorie[Number]]>"
msgstr "<-a> <-c> <-f> <-i [Kategorie[Nummer]]>"
#: init.lua
msgid ""
"Shows Point's of Interest.\n"
"Option -a shows Point's of Interest with Coordinates.\n"
"Option -c shows you Categories.\n"
"Option -f shows you the Namefilter\n"
"Option -i <Categorie[number]]> shows only the Entries of the given "
"Categorienumber or Name"
msgstr ""
"Zeigt Sehenswürdigkeiten.\n"
"Option -a zeigt Sehenswürdigkeiten mit Koordinaten.\n"
"Option -c zeigt dir die Kategorien.\n"
"Option -f zeigt dir den Namensfilter\n"
"Option -i <Kategorie[nummer]]> zeigt nur die Einträge der gegebenen "
"Kategorienummer oder Name"
#: init.lua
msgid "<POI-Name>"
msgstr "<POI-Name>"
#: init.lua
msgid "Deletes a Point of Interest."
msgstr "Löscht eine Sehenswürdigkeit."
#: init.lua
msgid "Loads the List of POI's new."
msgstr "Lädt die Liste der POI's neu."
#: init.lua
msgid "Jumps to the Position of the Point of Interest."
msgstr "Springt zur Position der Sehenswürdigkeit."
#: init.lua
msgid "Changes the Position of the Point of Interest."
msgstr "Verändert die Position der Sehenswürdigkeit."
#: init.lua
msgid "<POI Old Name>,<POI New Name>"
msgstr "<POI alter Name>,<POI neuer Name>"
#: init.lua
msgid "Changes the Name of the Point of Interest."
msgstr "Verändert den Namen der Sehenswürdigkeit."
#: init.lua
msgid "Validates the List of PoI's."
msgstr "Überprüft die Liste der PoI's."
#: init.lua
msgid "Show Points of Interest"
msgstr "Zeit Sehenswürdigkeiten"
#: init.lua
msgid "You need the"
msgstr "Du brauchst"
#: init.lua
msgid " interact"
msgstr " interact"
#: init.lua
msgid " priv, please type"
msgstr " priv, bitte gib"
#: init.lua
msgid " /rules"
msgstr " /rules"
#: init.lua
msgid " and search for the keyword"
msgstr " und suche nach dem Schlüsselwort"

333
locale/template.pot Normal file
View File

@ -0,0 +1,333 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-24 04:05+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: init.lua
msgid "Player may set and manage Points of Interest."
msgstr ""
#: init.lua
msgid " Filter in List."
msgstr ""
#: init.lua
msgid " Categories in List."
msgstr ""
#: init.lua
msgid "Point's of Interest in Categorie "
msgstr ""
#: init.lua
msgid " are:"
msgstr ""
#: init.lua
msgid " Point's of Interest are:"
msgstr ""
#: init.lua
msgid " Categorie: "
msgstr ""
#: init.lua
msgid "Given Categorie don't exists."
msgstr ""
#: init.lua
msgid " has changed the POI: "
msgstr ""
#: init.lua
msgid " at "
msgstr ""
#: init.lua
msgid " to Categorie: "
msgstr ""
#: init.lua
msgid " in Categorie: "
msgstr ""
#: init.lua
msgid " changed to Categorie: "
msgstr ""
#: init.lua
msgid "> in Categorie <"
msgstr ""
#: init.lua
msgid "> already exists."
msgstr ""
#: init.lua
msgid "Invalid or Forbidden Name <"
msgstr ""
#: init.lua
msgid "> for PoI."
msgstr ""
#: init.lua
msgid "Warning: Unkown Categorie, set to Categorie 1."
msgstr ""
#: init.lua
msgid " has set the POI: "
msgstr ""
#: init.lua
msgid " stored."
msgstr ""
#: init.lua
msgid "Name of the PoI needed."
msgstr ""
#: init.lua
msgid "> unknown to delete."
msgstr ""
#: init.lua
msgid " has deleted POI-Name: "
msgstr ""
#: init.lua
msgid " deleted."
msgstr ""
#: init.lua
msgid "POI-List reloaded."
msgstr ""
#: init.lua
msgid "Unknown Point of Interest: "
msgstr ""
#: init.lua
msgid "You are moved to POI: "
msgstr ""
#: init.lua
msgid "Manage_PoI]"
msgstr ""
#: init.lua
msgid "Doubleclick on destination to teleport"
msgstr ""
#: init.lua
msgid " Points in List]"
msgstr ""
#: init.lua
msgid "Categories ]"
msgstr ""
#: init.lua
msgid "Go]"
msgstr ""
#: init.lua
msgid "ShowAll]"
msgstr ""
#: init.lua
msgid "Quit]"
msgstr ""
#: init.lua
msgid "Reload"
msgstr ""
#: init.lua
msgid "Validate"
msgstr ""
#: init.lua
msgid "Set Point or change Categorie"
msgstr ""
#: init.lua
msgid "Rename"
msgstr ""
#: init.lua
msgid "Move"
msgstr ""
#: init.lua
msgid "Quit"
msgstr ""
#: init.lua
msgid "Back"
msgstr ""
#: init.lua
msgid " >>> Sorry this button is for admin only, please use /poi_delete "
msgstr ""
#: init.lua
msgid "Unknown PoI <"
msgstr ""
#: init.lua
msgid " has moved the POI: "
msgstr ""
#: init.lua
msgid " to Position: "
msgstr ""
#: init.lua
msgid " moved to Position: "
msgstr ""
#: init.lua
msgid "/poi_rename: No new Name for Point given."
msgstr ""
#: init.lua
msgid "Point to rename not found."
msgstr ""
#: init.lua
msgid "Invalid new Pointname."
msgstr ""
#: init.lua
msgid "New Pointname already exists."
msgstr ""
#: init.lua
msgid " has renamed POI-Name: "
msgstr ""
#: init.lua
msgid " to: "
msgstr ""
#: init.lua
msgid " - Position: "
msgstr ""
#: init.lua
msgid "PoI-Name: "
msgstr ""
#: init.lua
msgid " renamed to "
msgstr ""
#: init.lua
msgid " invalid PoI's found and deleted."
msgstr ""
#: init.lua
msgid " PoI's with an invalid Categorie found and set to 1."
msgstr ""
#: init.lua
msgid "No invalid PoI found."
msgstr ""
#: init.lua
msgid "<poi_name, Categorie[number]>"
msgstr ""
#: init.lua
msgid ""
"Set's a Point of Interest or changes the Categorie of an existing Point."
msgstr ""
#: init.lua
msgid "Shows PoIs in a GUI."
msgstr ""
#: init.lua
msgid "<-a> <-c> <-f> <-i [Categorie[Number]]>"
msgstr ""
#: init.lua
msgid ""
"Shows Point's of Interest.\n"
"Option -a shows Point's of Interest with Coordinates.\n"
"Option -c shows you Categories.\n"
"Option -f shows you the Namefilter\n"
"Option -i <Categorie[number]]> shows only the Entries of the given "
"Categorienumber or Name"
msgstr ""
#: init.lua
msgid "<POI-Name>"
msgstr ""
#: init.lua
msgid "Deletes a Point of Interest."
msgstr ""
#: init.lua
msgid "Loads the List of POI's new."
msgstr ""
#: init.lua
msgid "Jumps to the Position of the Point of Interest."
msgstr ""
#: init.lua
msgid "Changes the Position of the Point of Interest."
msgstr ""
#: init.lua
msgid "<POI Old Name>,<POI New Name>"
msgstr ""
#: init.lua
msgid "Changes the Name of the Point of Interest."
msgstr ""
#: init.lua
msgid "Validates the List of PoI's."
msgstr ""
#: init.lua
msgid "Show Points of Interest"
msgstr ""
#: init.lua
msgid "You need the"
msgstr ""
#: init.lua
msgid " interact"
msgstr ""
#: init.lua
msgid " priv, please type"
msgstr ""
#: init.lua
msgid " /rules"
msgstr ""
#: init.lua
msgid " and search for the keyword"
msgstr ""

142
tools/findtext.lua Executable file
View File

@ -0,0 +1,142 @@
#! /usr/bin/env lua
local me = arg[0]:gsub(".*[/\\](.*)$", "%1")
local function err(fmt, ...)
io.stderr:write(("%s: %s\n"):format(me, fmt:format(...)))
os.exit(1)
end
local output
local inputs = { }
local lang
local author
local i = 1
local function usage()
print([[
Usage: ]]..me..[[ [OPTIONS] FILE...
Extract translatable strings from the given FILE(s).
Available options:
-h,--help Show this help screen and exit.
-o,--output X Set output file (default: stdout).
-a,--author X Set author.
-l,--lang X Set language name.
]])
os.exit(0)
end
while i <= #arg do
local a = arg[i]
if (a == "-h") or (a == "--help") then
usage()
elseif (a == "-o") or (a == "--output") then
i = i + 1
if i > #arg then
err("missing required argument to `%s'", a)
end
output = arg[i]
elseif (a == "-a") or (a == "--author") then
i = i + 1
if i > #arg then
err("missing required argument to `%s'", a)
end
author = arg[i]
elseif (a == "-l") or (a == "--lang") then
i = i + 1
if i > #arg then
err("missing required argument to `%s'", a)
end
lang = arg[i]
elseif a:sub(1, 1) ~= "-" then
table.insert(inputs, a)
else
err("unrecognized option `%s'", a)
end
i = i + 1
end
if #inputs == 0 then
err("no input files")
end
local outfile = io.stdout
local function printf(fmt, ...)
outfile:write(fmt:format(...))
end
if output then
local e
outfile, e = io.open(output, "w")
if not outfile then
err("error opening file for writing: %s", e)
end
end
if author or lang then
outfile:write("\n")
end
if lang then
printf("# Language: %s\n", lang)
end
if author then
printf("# Author: %s\n", author)
end
if author or lang then
outfile:write("\n")
end
local escapes = {
["\n"] = "\\n",
["="] = "\\=",
["\\"] = "\\\\",
}
local function escape(s)
return s:gsub("[\\\n=]", escapes)
end
local messages = { }
for _, file in ipairs(inputs) do
local infile, e = io.open(file, "r")
if infile then
for line in infile:lines() do
for s in line:gmatch('S%("([^"]*)"') do
table.insert(messages, s)
end
end
infile:close()
else
io.stderr:write(("%s: WARNING: error opening file: %s\n"):format(me, e))
end
end
table.sort(messages)
local last_msg
for _, msg in ipairs(messages) do
if msg ~= last_msg then
printf("%s =\n", escape(msg))
end
last_msg = msg
end
if output then
outfile:close()
end
--[[
TESTS:
S("foo") S("bar")
S("bar")
S("foo")
]]

131
tools/updatetext.lua Normal file
View File

@ -0,0 +1,131 @@
#! /usr/bin/env lua
local basedir = ""
if arg[0]:find("[/\\]") then
basedir = arg[0]:gsub("(.*[/\\]).*$", "%1"):gsub("\\", "/")
end
if basedir == "" then basedir = "./" end
-- Required by load_strings()
function string.trim(s) -- luacheck: ignore
return s:gsub("^%s*(.-)%s*$", "%1")
end
dofile(basedir.."/../lib.lua")
local me = arg[0]:gsub(".*[/\\](.*)$", "%1")
local function err(fmt, ...)
io.stderr:write(("%s: %s\n"):format(me, fmt:format(...)))
os.exit(1)
end
local output, outfile, template
local catalogs = { }
local function usage()
print([[
Usage: ]]..me..[[ [OPTIONS] TEMPLATE CATALOG...
Update a catalog with new strings from a template.
Available options:
-h,--help Show this help screen and exit.
-o,--output X Set output file (default: stdout).
Messages in the template that are not on the catalog are added to the
catalog at the end.
This tool also checks messages that are in the catalog but not in the
template, and reports such lines. It's up to the user to remove such
lines, if so desired.
]])
os.exit(0)
end
local i = 1
while i <= #arg do
local a = arg[i]
if (a == "-h") or (a == "--help") then
usage()
elseif (a == "-o") or (a == "--output") then
i = i + 1
if i > #arg then
err("missing required argument to `%s'", a)
end
output = arg[i]
elseif a:sub(1, 1) ~= "-" then
if not template then
template = a
else
table.insert(catalogs, a)
end
else
err("unrecognized option `%s'", a)
end
i = i + 1
end
if not template then
err("no template specified")
elseif #catalogs == 0 then
err("no catalogs specified")
end
local f, e = io.open(template, "r")
if not f then
err("error opening template: %s", e)
end
local escapes = { ["\n"] = "\\n", ["="] = "\\=", ["\\"] = "\\\\", }
local function escape(s)
return s:gsub("[\\\n=]", escapes)
end
if output then
outfile, e = io.open(output, "w")
if not outfile then
err("error opening file for writing: %s", e)
end
end
local template_msgs = intllib.load_strings(template)
for _, file in ipairs(catalogs) do
print("Processing: "..file)
local catalog_msgs = intllib.load_strings(file)
local dirty_lines = { }
if catalog_msgs then
-- Add new entries from template.
for k in pairs(template_msgs) do
if not catalog_msgs[k] then
print("NEW: "..k)
table.insert(dirty_lines, escape(k).." =")
end
end
-- Check for old messages.
for k, v in pairs(catalog_msgs) do
if not template_msgs[k] then
print("OLD: "..k)
table.insert(dirty_lines, "OLD: "..escape(k).." = "..escape(v))
end
end
if #dirty_lines > 0 then
local outf
outf, e = io.open(file, "a+")
if outf then
outf:write("\n")
for _, line in ipairs(dirty_lines) do
outf:write(line)
outf:write("\n")
end
outf:close()
else
io.stderr:write(("%s: WARNING: cannot write: %s\n"):format(me, e))
end
end
else
io.stderr:write(("%s: WARNING: could not load catalog\n"):format(me))
end
end

33
tools/xgettext.bat Normal file
View File

@ -0,0 +1,33 @@
@echo off
setlocal
set me=%~n0
rem # Uncomment the following line if gettext is not in your PATH.
rem # Value must be absolute and end in a backslash.
rem set gtprefix=C:\path\to\gettext\bin\
if "%1" == "" (
echo Usage: %me% FILE... 1>&2
exit 1
)
set xgettext=%gtprefix%xgettext.exe
set msgmerge=%gtprefix%msgmerge.exe
md locale > nul 2>&1
echo Generating template... 1>&2
echo %xgettext% --from-code=UTF-8 -kS -kNS:1,2 -k_ -o locale/template.pot %*
%xgettext% --from-code=UTF-8 -kS -kNS:1,2 -k_ -o locale/template.pot %*
if %ERRORLEVEL% neq 0 goto done
cd locale
for %%f in (*.po) do (
echo Updating %%f... 1>&2
%msgmerge% --update %%f template.pot
)
echo DONE! 1>&2
:done

27
tools/xgettext.sh Executable file
View File

@ -0,0 +1,27 @@
#! /bin/bash
me=$(basename "${BASH_SOURCE[0]}");
if [[ $# -lt 1 ]]; then
echo "Usage: $me FILE..." >&2;
exit 1;
fi
mkdir -p locale;
echo "Generating template..." >&2;
xgettext --from-code=UTF-8 \
--keyword=S \
--keyword=NS:1,2 \
--keyword=N_ \
--add-comments='Translators:' \
--add-location=file \
-o locale/template.pot \
"$@" \
|| exit;
find locale -name '*.po' -type f | while read -r file; do
echo "Updating $file..." >&2;
msgmerge --update "$file" locale/template.pot;
done
echo "DONE!" >&2;