summaryrefslogtreecommitdiff
path: root/signs_lib
diff options
context:
space:
mode:
Diffstat (limited to 'signs_lib')
-rw-r--r--signs_lib/init.lua51
-rw-r--r--signs_lib/intllib.lua45
-rw-r--r--signs_lib/locale/de.po92
-rw-r--r--signs_lib/locale/es.po95
-rw-r--r--signs_lib/locale/fr.po91
-rw-r--r--signs_lib/locale/template.pot90
6 files changed, 444 insertions, 20 deletions
diff --git a/signs_lib/init.lua b/signs_lib/init.lua
index 775db95..5f3acfc 100644
--- a/signs_lib/init.lua
+++ b/signs_lib/init.lua
@@ -113,8 +113,9 @@ signs_lib.sign_post_model = {
}
}
--- Boilerplate to support localized strings if intllib mod is installed.
-local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
+-- Load support for intllib.
+local MP = minetest.get_modpath(minetest.get_current_modname())
+local S, NS = dofile(MP.."/intllib.lua")
signs_lib.gettext = S
-- the list of standard sign nodes
@@ -413,7 +414,7 @@ end
local function set_obj_text(obj, text, new, pos)
local split = new and split_lines_and_words or split_lines_and_words_old
local n = minetest.registered_nodes[minetest.get_node(pos).name]
- local text_scale = n.text_scale or DEFAULT_TEXT_SCALE
+ local text_scale = (n and n.text_scale) or DEFAULT_TEXT_SCALE
obj:set_properties({
textures={make_sign_texture(split(text), pos)},
visual_size = text_scale,
@@ -473,7 +474,7 @@ signs_lib.update_sign = function(pos, fields, owner)
signs_lib.destruct_sign(pos)
meta:set_string("keyword", current_keyword)
local ownstr = ""
- if owner then ownstr = "Locked sign, owned by "..owner.."\n" end
+ if owner then ownstr = S("Locked sign, owned by @1\n", owner) end
meta:set_string("infotext", ownstr..string.gsub(make_infotext(stored_text), "@KEYWORD", current_keyword).." ")
end
end
@@ -485,7 +486,7 @@ signs_lib.update_sign = function(pos, fields, owner)
fields.text = trim_input(fields.text)
local ownstr = ""
- if owner then ownstr = "Locked sign, owned by "..owner.."\n" end
+ if owner then ownstr = S("Locked sign, owned by @1\n", owner) end
meta:set_string("infotext", ownstr..string.gsub(make_infotext(fields.text), "@KEYWORD", current_keyword).." ")
meta:set_string("text", fields.text)
@@ -631,11 +632,12 @@ function signs_lib.receive_fields(pos, formname, fields, sender, lock)
sender:get_player_name())
return
end
- local lockstr = lock and "locked " or ""
+ local lockstr = lock and S("locked ") or ""
if fields and fields.text and fields.ok then
- minetest.log("action", S("%s wrote \"%s\" to "..lockstr.."sign at %s"):format(
+ minetest.log("action", S("@1 wrote \"@2\" to @3sign at @4",
(sender:get_player_name() or ""),
fields.text,
+ lockstr,
minetest.pos_to_string(pos)
))
if lock then
@@ -766,10 +768,10 @@ minetest.register_node(":signs:sign_post", {
-- Locked wall sign
-minetest.register_privilege("sign_editor", "Can edit all locked signs")
+minetest.register_privilege("sign_editor", S("Can edit all locked signs"))
minetest.register_node(":locked_sign:sign_wall_locked", {
- description = S("Sign"),
+ description = S("Locked Sign"),
inventory_image = "signs_locked_inv.png",
wield_image = "signs_locked_inv.png",
node_placement_prediction = "",
@@ -849,14 +851,23 @@ end
-- metal, colored signs
if enable_colored_metal_signs then
- local sign_colors = { "green", "yellow", "red", "white_red", "white_black", "orange", "blue", "brown" }
- local sign_default_text_colors = { "f", "0", "f", "4", "0", "0", "f", "f" }
+ -- array : color, translated color, default text color
+ local sign_colors = {
+ {"green", S("green"), "f"},
+ {"yellow", S("yellow"), "0"},
+ {"red", S("red"), "f"},
+ {"white_red", S("white_red"), "4"},
+ {"white_black", S("white_black"), "0"},
+ {"orange", S("orange"), "0"},
+ {"blue", S("blue"), "f"},
+ {"brown", S("brown"), "f"},
+ }
for i, color in ipairs(sign_colors) do
- minetest.register_node(":signs:sign_wall_"..color, {
- description = S("Sign ("..color..", metal)"),
- inventory_image = "signs_"..color.."_inv.png",
- wield_image = "signs_"..color.."_inv.png",
+ minetest.register_node(":signs:sign_wall_"..color[1], {
+ description = S("Sign (@1, metal)", color[2]),
+ inventory_image = "signs_"..color[1].."_inv.png",
+ wield_image = "signs_"..color[1].."_inv.png",
node_placement_prediction = "",
paramtype = "light",
sunlight_propagates = true,
@@ -869,9 +880,9 @@ if enable_colored_metal_signs then
"signs_metal_sides.png",
"signs_metal_sides.png",
"signs_metal_back.png",
- "signs_"..color.."_front.png"
+ "signs_"..color[1].."_front.png"
},
- default_color = sign_default_text_colors[i],
+ default_color = color[3],
groups = sign_groups,
on_place = function(itemstack, placer, pointed_thing)
return signs_lib.determine_sign_type(itemstack, placer, pointed_thing)
@@ -919,7 +930,7 @@ function signs_lib.register_fence_with_sign(fencename, fencewithsignname)
local def = minetest.registered_nodes[fencename]
local def_sign = minetest.registered_nodes[fencewithsignname]
if not (def and def_sign) then
- minetest.log("warning", "[signs_lib] Attempt to register unknown node as fence")
+ minetest.log("warning", "[signs_lib] "..S("Attempt to register unknown node as fence"))
return
end
def = signs_lib.table_copy(def)
@@ -982,7 +993,7 @@ function signs_lib.register_fence_with_sign(fencename, fencewithsignname)
minetest.register_node(":"..fencename, def)
minetest.register_node(":"..fencewithsignname, def_sign)
table.insert(signs_lib.sign_node_list, fencewithsignname)
- minetest.log("verbose", S("Registered %s and %s"):format(fencename, fencewithsignname))
+ minetest.log("verbose", S("Registered @1 and @2", fencename, fencewithsignname))
end
build_char_db()
@@ -1159,5 +1170,5 @@ if enable_colored_metal_signs then
end
if minetest.settings:get("log_mods") then
- minetest.log("action", S("signs loaded"))
+ minetest.log("action", S("[MOD] signs loaded"))
end
diff --git a/signs_lib/intllib.lua b/signs_lib/intllib.lua
new file mode 100644
index 0000000..6669d72
--- /dev/null
+++ b/signs_lib/intllib.lua
@@ -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
diff --git a/signs_lib/locale/de.po b/signs_lib/locale/de.po
new file mode 100644
index 0000000..24f13a4
--- /dev/null
+++ b/signs_lib/locale/de.po
@@ -0,0 +1,92 @@
+# 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.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-07-31 18:31+0200\n"
+"PO-Revision-Date: 2017-07-31 18:35+0200\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.8.12\n"
+"Last-Translator: Xanthin\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"Language: de\n"
+
+#: init.lua
+msgid "Locked sign, owned by @1\n"
+msgstr ""
+
+#: init.lua
+msgid "locked "
+msgstr "eingesperrt "
+
+#: init.lua
+#, fuzzy
+msgid "@1 wrote \"@2\" to @3sign at @4"
+msgstr "@1 schrieb \"@2\" auf das @3Schild bei @4"
+
+#: init.lua
+msgid "Sign"
+msgstr "Schild"
+
+#: init.lua
+msgid "Can edit all locked signs"
+msgstr ""
+
+#: init.lua
+msgid "Locked Sign"
+msgstr ""
+
+#: init.lua
+msgid "green"
+msgstr ""
+
+#: init.lua
+msgid "yellow"
+msgstr ""
+
+#: init.lua
+msgid "red"
+msgstr ""
+
+#: init.lua
+msgid "white_red"
+msgstr ""
+
+#: init.lua
+msgid "white_black"
+msgstr ""
+
+#: init.lua
+msgid "orange"
+msgstr ""
+
+#: init.lua
+msgid "blue"
+msgstr ""
+
+#: init.lua
+msgid "brown"
+msgstr ""
+
+#: init.lua
+msgid "Sign (@1, metal)"
+msgstr "Schild (@1, Metall)"
+
+#: init.lua
+msgid "Attempt to register unknown node as fence"
+msgstr ""
+
+#: init.lua
+msgid "Registered @1 and @2"
+msgstr "Registrierte @1 und @2"
+
+#: init.lua
+msgid "[MOD] signs loaded"
+msgstr "[MOD] signs geladen"
diff --git a/signs_lib/locale/es.po b/signs_lib/locale/es.po
new file mode 100644
index 0000000..8579937
--- /dev/null
+++ b/signs_lib/locale/es.po
@@ -0,0 +1,95 @@
+# 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.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-07-31 18:22+0200\n"
+"PO-Revision-Date: 2017-07-31 18:30+0200\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.8.12\n"
+"Last-Translator: Carlos Barraza\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"Language: es\n"
+
+#: init.lua
+msgid "Locked sign, owned by @1\n"
+msgstr ""
+
+#: init.lua
+msgid "locked "
+msgstr "bloqueada "
+
+#: init.lua
+msgid "@1 wrote \"@2\" to @3sign at @4"
+msgstr "@1 escribio \"@2\" en el cartel @3en @4"
+
+#: init.lua
+msgid "Sign"
+msgstr "Letrero"
+
+#: init.lua
+msgid "Can edit all locked signs"
+msgstr ""
+
+#: init.lua
+#, fuzzy
+msgid "Locked Sign"
+msgstr "Letrero bloqueada"
+
+#: init.lua
+msgid "green"
+msgstr "verde"
+
+#: init.lua
+msgid "yellow"
+msgstr "amarillo"
+
+#: init.lua
+msgid "red"
+msgstr "rojo"
+
+#: init.lua
+#, fuzzy
+msgid "white_red"
+msgstr "rojo y blanco"
+
+#: init.lua
+#, fuzzy
+msgid "white_black"
+msgstr "negro y blanco"
+
+#: init.lua
+msgid "orange"
+msgstr "naranja"
+
+#: init.lua
+msgid "blue"
+msgstr "azul"
+
+#: init.lua
+msgid "brown"
+msgstr "marrón"
+
+#: init.lua
+#, fuzzy
+msgid "Sign (@1, metal)"
+msgstr "Letrero (@1, metal)"
+
+#: init.lua
+msgid "Attempt to register unknown node as fence"
+msgstr ""
+
+#: init.lua
+msgid "Registered @1 and @2"
+msgstr "Registrado @1 y @2"
+
+#: init.lua
+msgid "[MOD] signs loaded"
+msgstr "[MOD] signs cargados"
diff --git a/signs_lib/locale/fr.po b/signs_lib/locale/fr.po
new file mode 100644
index 0000000..a503574
--- /dev/null
+++ b/signs_lib/locale/fr.po
@@ -0,0 +1,91 @@
+# 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.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-07-31 18:13+0200\n"
+"PO-Revision-Date: 2017-07-31 18:22+0200\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.8.12\n"
+"Last-Translator: fat115 <fat115@framasoft.org>\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+"Language: fr\n"
+
+#: init.lua
+msgid "Locked sign, owned by @1\n"
+msgstr "Panneau verrouillé, appartient à @1\n"
+
+#: init.lua
+msgid "locked "
+msgstr "verrouillé "
+
+#: init.lua
+msgid "@1 wrote \"@2\" to @3sign at @4"
+msgstr "@1 a écrit \"@2\" sur le panneau @3en @4"
+
+#: init.lua
+msgid "Sign"
+msgstr "Panneau"
+
+#: init.lua
+msgid "Can edit all locked signs"
+msgstr "Peut modifier les panneaux verrouillés"
+
+#: init.lua
+msgid "Locked Sign"
+msgstr "Panneau (verrouillé)"
+
+#: init.lua
+msgid "green"
+msgstr "vert"
+
+#: init.lua
+msgid "yellow"
+msgstr "jaune"
+
+#: init.lua
+msgid "red"
+msgstr "rouge"
+
+#: init.lua
+msgid "white_red"
+msgstr "rouge et blanc"
+
+#: init.lua
+msgid "white_black"
+msgstr "noir et blanc"
+
+#: init.lua
+msgid "orange"
+msgstr "orange"
+
+#: init.lua
+msgid "blue"
+msgstr "bleu"
+
+#: init.lua
+msgid "brown"
+msgstr "marron"
+
+#: init.lua
+msgid "Sign (@1, metal)"
+msgstr "Panneau (@1, métal)"
+
+#: init.lua
+msgid "Attempt to register unknown node as fence"
+msgstr "Tentative d'enregistrer un nœud inconnu comme barrière"
+
+#: init.lua
+msgid "Registered @1 and @2"
+msgstr "Enregistrement de @1 et @"
+
+#: init.lua
+msgid "[MOD] signs loaded"
+msgstr "[MOD] signs chargé"
diff --git a/signs_lib/locale/template.pot b/signs_lib/locale/template.pot
new file mode 100644
index 0000000..8a80e3c
--- /dev/null
+++ b/signs_lib/locale/template.pot
@@ -0,0 +1,90 @@
+# 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-07-31 18:00+0200\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 "Locked sign, owned by @1\n"
+msgstr ""
+
+#: init.lua
+msgid "locked "
+msgstr ""
+
+#: init.lua
+msgid "@1 wrote \"@2\" to @3sign at @4"
+msgstr ""
+
+#: init.lua
+msgid "Sign"
+msgstr ""
+
+#: init.lua
+msgid "Can edit all locked signs"
+msgstr ""
+
+#: init.lua
+msgid "Locked Sign"
+msgstr ""
+
+#: init.lua
+msgid "green"
+msgstr ""
+
+#: init.lua
+msgid "yellow"
+msgstr ""
+
+#: init.lua
+msgid "red"
+msgstr ""
+
+#: init.lua
+msgid "white_red"
+msgstr ""
+
+#: init.lua
+msgid "white_black"
+msgstr ""
+
+#: init.lua
+msgid "orange"
+msgstr ""
+
+#: init.lua
+msgid "blue"
+msgstr ""
+
+#: init.lua
+msgid "brown"
+msgstr ""
+
+#: init.lua
+msgid "Sign (@1, metal)"
+msgstr ""
+
+#: init.lua
+msgid "Attempt to register unknown node as fence"
+msgstr ""
+
+#: init.lua
+msgid "Registered @1 and @2"
+msgstr ""
+
+#: init.lua
+msgid "[MOD] signs loaded"
+msgstr ""