aboutsummaryrefslogtreecommitdiff
path: root/signs
diff options
context:
space:
mode:
authorNiklp <89982526+Niklp09@users.noreply.github.com>2023-07-24 09:59:26 +0200
committerGitHub <noreply@github.com>2023-07-24 09:59:26 +0200
commit1440f35fa62fd2c01b4844261290c88e42d2430f (patch)
treee42db53056e5d6f1c4fd562a924934081ae787c4 /signs
parente0e03058362e038d07d4063c4fbd6999ad27109c (diff)
downloaddisplay_modpack_no_craft-1440f35fa62fd2c01b4844261290c88e42d2430f.tar.gz
display_modpack_no_craft-1440f35fa62fd2c01b4844261290c88e42d2430f.zip
Add luacheck, update translations, replace ABMs, bug fixes (#1)
* luacheck, mt 5 translation, german translation, maintenance * fix luacheck warnings * Fix digital clock nodebox and texture * Fix luacheck usage * Add comment why fonts are not split into several lines
Diffstat (limited to 'signs')
-rw-r--r--signs/common.lua3
-rw-r--r--signs/init.lua5
-rw-r--r--signs/intllib.lua45
-rw-r--r--signs/locale/fr.po54
-rw-r--r--signs/locale/ms.po51
-rw-r--r--signs/locale/signs.de.tr14
-rw-r--r--signs/locale/signs.fr.tr14
-rw-r--r--signs/locale/signs.ms.tr14
-rw-r--r--signs/locale/template.pot51
-rw-r--r--signs/locale/template.txt14
-rw-r--r--signs/mod.conf1
-rw-r--r--signs/nodes.lua28
-rwxr-xr-xsigns/tools/updatepo.sh25
13 files changed, 72 insertions, 247 deletions
diff --git a/signs/common.lua b/signs/common.lua
index 733a44c..f40681f 100644
--- a/signs/common.lua
+++ b/signs/common.lua
@@ -18,9 +18,6 @@
along with signs. If not, see <http://www.gnu.org/licenses/>.
--]]
-local S = signs.intllib
-local F = function(...) return minetest.formspec_escape(S(...)) end
-
-- Generic callback for show_formspec displayed formspecs of "sign" mod
minetest.register_on_player_receive_fields(function(player, formname, fields)
diff --git a/signs/init.lua b/signs/init.lua
index 4f9239f..b2870c8 100644
--- a/signs/init.lua
+++ b/signs/init.lua
@@ -22,9 +22,8 @@ signs = {}
signs.name = minetest.get_current_modname()
signs.path = minetest.get_modpath(signs.name)
--- Load support for intllib.
-local S, NS = dofile(signs.path.."/intllib.lua")
-signs.intllib = S
+-- Translation support
+signs.S = minetest.get_translator(signs.name)
dofile(signs.path.."/common.lua")
dofile(signs.path.."/nodes.lua")
diff --git a/signs/intllib.lua b/signs/intllib.lua
deleted file mode 100644
index 6669d72..0000000
--- a/signs/intllib.lua
+++ /dev/null
@@ -1,45 +0,0 @@
-
--- 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/locale/fr.po b/signs/locale/fr.po
deleted file mode 100644
index 7a00544..0000000
--- a/signs/locale/fr.po
+++ /dev/null
@@ -1,54 +0,0 @@
-# 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-08-26 13:20+0200\n"
-"PO-Revision-Date: 2017-05-08 07:08+0200\n"
-"Last-Translator: Peppy <peppy@twang-factory.com>\n"
-"Language-Team: \n"
-"Language: fr\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"
-
-#: common.lua nodes.lua
-msgid "Text"
-msgstr "Texte"
-
-#: common.lua nodes.lua
-msgid "Write"
-msgstr "Écrire"
-
-#: common.lua
-#, lua-format
-msgid " (first %s lines only)"
-msgstr " (uniquement les %s premières lignes)"
-
-#: nodes.lua
-msgid "Title"
-msgstr "Titre"
-
-#: nodes.lua
-msgid "Close"
-msgstr "Fermer"
-
-#: nodes.lua
-msgid "(right-click to read more text)"
-msgstr "(Clic-droit pour afficher le texte entier)"
-
-#: nodes.lua
-msgid "Wooden direction sign"
-msgstr "Panneau de direction en bois"
-
-#: nodes.lua
-msgid "Poster"
-msgstr "Affiche"
-
-#~ msgid "Textd"
-#~ msgstr "Texte"
diff --git a/signs/locale/ms.po b/signs/locale/ms.po
deleted file mode 100644
index defee7b..0000000
--- a/signs/locale/ms.po
+++ /dev/null
@@ -1,51 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# Yaya (Nurul Azeera Hidayah @ Muhammad Nur Hidayat) <translation@mnh48.moe>, 2017.
-msgid ""
-msgstr ""
-"Project-Id-Version: Display Modpack\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2017-08-26 13:20+0200\n"
-"PO-Revision-Date: 2020-07-05 11:34+0000\n"
-"Last-Translator: Yaya MNH48 <translation@mnh48.moe>\n"
-"Language-Team: Malay <translation@mnh48.moe>\n"
-"Language: ms\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Poedit 2.3\n"
-
-#: common.lua nodes.lua
-msgid "Text"
-msgstr "Teks"
-
-#: common.lua nodes.lua
-msgid "Write"
-msgstr "Tulis"
-
-#: common.lua
-#, lua-format
-msgid " (first %s lines only)"
-msgstr " (%s baris pertama sahaja)"
-
-#: nodes.lua
-msgid "Title"
-msgstr "Tajuk"
-
-#: nodes.lua
-msgid "Close"
-msgstr "Tutup"
-
-#: nodes.lua
-msgid "(right-click to read more text)"
-msgstr "(klik-kanan untuk baca teks penuh)"
-
-#: nodes.lua
-msgid "Wooden direction sign"
-msgstr "Papan tanda arah kayu"
-
-#: nodes.lua
-msgid "Poster"
-msgstr "Poster"
diff --git a/signs/locale/signs.de.tr b/signs/locale/signs.de.tr
new file mode 100644
index 0000000..10f1100
--- /dev/null
+++ b/signs/locale/signs.de.tr
@@ -0,0 +1,14 @@
+# textdomain: signs
+Wooden sign=Hölzernes Schild
+Wooden long sign=Langes hölzernes Schild
+Wooden direction sign=Hölzerner Wegweiser
+Poster=Poster
+Small label=Kleines Etikett
+Label=Etikett
+Close=Schließen
+Edit=Bearbeiten
+Title=Titel
+Text=Text
+Title font=Titel Schriftart
+Write=Schreiben
+(right-click to read more text)=(Rechtsklick für mehr Text)
diff --git a/signs/locale/signs.fr.tr b/signs/locale/signs.fr.tr
new file mode 100644
index 0000000..4d753b8
--- /dev/null
+++ b/signs/locale/signs.fr.tr
@@ -0,0 +1,14 @@
+# textdomain: signs
+Wooden sign=
+Wooden long sign=
+Wooden direction sign=Panneau de direction en bois
+Poster=Affiche
+Small label=
+Label=
+Close=
+Edit=
+Title=
+Text=
+Title font=
+Write=
+(right-click to read more text)=(Clic-droit pour afficher le texte entier)
diff --git a/signs/locale/signs.ms.tr b/signs/locale/signs.ms.tr
new file mode 100644
index 0000000..5b63ffa
--- /dev/null
+++ b/signs/locale/signs.ms.tr
@@ -0,0 +1,14 @@
+# textdomain: signs
+Wooden sign=
+Wooden long sign=
+Wooden direction sign=Papan tanda arah kayu
+Poster=Poster
+Small label=
+Label=
+Close=
+Edit=
+Title=
+Text=
+Title font=
+Write=
+(right-click to read more text)=(klik-kanan untuk baca teks penuh)
diff --git a/signs/locale/template.pot b/signs/locale/template.pot
deleted file mode 100644
index a1fc065..0000000
--- a/signs/locale/template.pot
+++ /dev/null
@@ -1,51 +0,0 @@
-# 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-08-26 13:20+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"
-
-#: common.lua nodes.lua
-msgid "Text"
-msgstr ""
-
-#: common.lua nodes.lua
-msgid "Write"
-msgstr ""
-
-#: common.lua
-#, lua-format
-msgid " (first %s lines only)"
-msgstr ""
-
-#: nodes.lua
-msgid "Title"
-msgstr ""
-
-#: nodes.lua
-msgid "Close"
-msgstr ""
-
-#: nodes.lua
-msgid "(right-click to read more text)"
-msgstr ""
-
-#: nodes.lua
-msgid "Wooden direction sign"
-msgstr ""
-
-#: nodes.lua
-msgid "Poster"
-msgstr ""
diff --git a/signs/locale/template.txt b/signs/locale/template.txt
new file mode 100644
index 0000000..c0ff5ec
--- /dev/null
+++ b/signs/locale/template.txt
@@ -0,0 +1,14 @@
+# textdomain: signs
+Wooden sign=
+Wooden long sign=
+Wooden direction sign=
+Poster=
+Small label=
+Label=
+Close=
+Edit=
+Title=
+Text=
+Title font=
+Write=
+(right-click to read more text)=
diff --git a/signs/mod.conf b/signs/mod.conf
index 1ef5d39..f437617 100644
--- a/signs/mod.conf
+++ b/signs/mod.conf
@@ -2,4 +2,3 @@ name = signs
title = Signs
description = Basic signs and posters with text display using signs_api
depends = default,dye,signs_api
-optional_depends = intllib
diff --git a/signs/nodes.lua b/signs/nodes.lua
index 7c238c4..ac70ec6 100644
--- a/signs/nodes.lua
+++ b/signs/nodes.lua
@@ -18,8 +18,8 @@
along with signs. If not, see <http://www.gnu.org/licenses/>.
--]]
-local S = signs.intllib
-local F = function(...) return minetest.formspec_escape(S(...)) end
+local S = signs.S
+local FS = function(...) return minetest.formspec_escape(S(...)) end
-- Poster specific formspec
local function display_poster(pos, node, player)
@@ -47,11 +47,11 @@ local function display_poster(pos, node, player)
minetest.formspec_escape(meta:get_string("text"))))
if minetest.is_protected(pos, player:get_player_name()) then
- fs = string.format("%sbutton_exit[2.5,8;2,1;ok;%s]", fs, F("Close"))
+ fs = string.format("%sbutton_exit[2.5,8;2,1;ok;%s]", fs, FS("Close"))
else
fs = string.format(
"%sbutton[1,8;2,1;edit;%s]button_exit[4,8;2,1;ok;%s]",
- fs, F("Edit"), F("Close"))
+ fs, FS("Edit"), FS("Close"))
end
minetest.show_formspec(player:get_player_name(), fname, fs)
end
@@ -70,10 +70,10 @@ local function edit_poster(pos, node, player)
textarea[0.5,1.7;6,6;text;%s;%s]
button[1.25,7;2,1;font;%s]
button_exit[3.25,7;2,1;write;%s]]=],
- default.gui_bg, default.gui_bg_img, default.gui_slots, F("Title"),
+ default.gui_bg, default.gui_bg_img, default.gui_slots, FS("Title"),
minetest.formspec_escape(meta:get_string("display_text")),
- F("Text"), minetest.formspec_escape(meta:get_string("text")),
- F("Title font"), F("Write"))
+ FS("Text"), minetest.formspec_escape(meta:get_string("text")),
+ FS("Title font"), FS("Write"))
minetest.show_formspec(player:get_player_name(), fname, fs)
end
end
@@ -95,17 +95,17 @@ local function on_receive_fields_poster(pos, formname, fields, player)
meta:set_string("display_text", fields.display_text)
meta:set_string("text", fields.text)
meta:set_string("infotext", "\""..fields.display_text
- .."\"\n"..S("(right-click to read more text)"))
+ .."\"\n"..FS("(right-click to read more text)"))
display_api.update_entities(pos)
end
if (fields.write or fields.key_enter) then
display_poster(pos, node, player)
elseif (fields.font) then
- font_api.show_font_list(player, pos, function (playername, pos)
- local player = minetest.get_player_by_name(playername)
- local node = minetest.get_node(pos)
- if player and node then
- edit_poster(pos, node, player)
+ font_api.show_font_list(player, pos, function (playername, npos)
+ local user = minetest.get_player_by_name(playername)
+ local node2 = minetest.get_node(npos)
+ if user and node2 then
+ edit_poster(npos, node2, user)
end
end)
end
@@ -168,7 +168,7 @@ local models = {
drawtype = "mesh",
mesh = "signs_dir_right.obj",
selection_box = { type="fixed", fixed = {-0.5, -7/32, 0.5, 7/16, 7/32, 7/16}},
- collision_box = { type="fixed", fixed = {-0,5, -7/32, 0.5, 7/16, 7/32, 7/16}},
+ collision_box = { type="fixed", fixed = {-7/16, -7/32, 0.5, 0.5, 7/32, 7/16}},
groups= { dig_immediate = 2 },
},
},
diff --git a/signs/tools/updatepo.sh b/signs/tools/updatepo.sh
deleted file mode 100755
index feb2504..0000000
--- a/signs/tools/updatepo.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#! /bin/bash
-
-# To create a new translation:
-# msginit --locale=ll_CC -o locale/ll_CC.po -i locale/template.pot
-
-cd "$(dirname "${BASH_SOURCE[0]}")/..";
-
-# Extract translatable strings.
-xgettext --from-code=UTF-8 \
- --language=Lua \
- --sort-by-file \
- --keyword=S \
- --keyword=NS:1,2 \
- --keyword=N_ \
- --keyword=F \
- --add-comments='Translators:' \
- --add-location=file \
- -o locale/template.pot \
- $(find . -name '*.lua')
-
-# Update translations.
-find locale -name '*.po' | while read -r file; do
- echo $file
- msgmerge --update $file locale/template.pot;
-done