From 1440f35fa62fd2c01b4844261290c88e42d2430f Mon Sep 17 00:00:00 2001 From: Niklp <89982526+Niklp09@users.noreply.github.com> Date: Mon, 24 Jul 2023 09:59:26 +0200 Subject: 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 --- boards/font_tinycurs.lua | 6 ++++-- boards/init.lua | 29 +++++++++++++++++++---------- boards/intllib.lua | 45 --------------------------------------------- boards/locale/boards.de.tr | 6 ++++++ boards/locale/boards.fr.tr | 6 ++++++ boards/locale/boards.ms.tr | 6 ++++++ boards/locale/fr.po | 40 ---------------------------------------- boards/locale/ms.po | 35 ----------------------------------- boards/locale/template.pot | 34 ---------------------------------- boards/locale/template.txt | 6 ++++++ boards/tools/updatepo.sh | 25 ------------------------- 11 files changed, 47 insertions(+), 191 deletions(-) delete mode 100644 boards/intllib.lua create mode 100644 boards/locale/boards.de.tr create mode 100644 boards/locale/boards.fr.tr create mode 100644 boards/locale/boards.ms.tr delete mode 100644 boards/locale/fr.po delete mode 100644 boards/locale/ms.po delete mode 100644 boards/locale/template.pot create mode 100644 boards/locale/template.txt delete mode 100755 boards/tools/updatepo.sh (limited to 'boards') diff --git a/boards/font_tinycurs.lua b/boards/font_tinycurs.lua index a9a323a..cef0d1d 100644 --- a/boards/font_tinycurs.lua +++ b/boards/font_tinycurs.lua @@ -7,11 +7,13 @@ released under CC-BY-SA license https://fontstruct.com/fontstructions/show/63155/tiny_cursive - + Derivative texture are under CC-BY-SA license Code is under LGPL v3 license --]] +-- widths is not split into several lines, because the font is generated by 'make_font_lua.sh' +-- luacheck: ignore font_api.register_font('tinycurs', { default = false, -- Don't register this font as a possible default font @@ -19,7 +21,7 @@ font_api.register_font('tinycurs', marginbottom = -2, linespacing = -4, height = 19, - widths = { + widths = { [0]=9, [32]=9, [33]=6, [34]=7, [35]=10, [36]=14, [37]=14, [38]=12, [39]=3, [40]=6, [41]=6, [42]=9, [43]=8, [44]=3, [45]=7, [46]=3, [47]=9, [48]=9, [49]=7, [50]=10, [51]=9, [52]=9, [53]=10, [54]=10, [55]=9, [56]=10, [57]=8, [58]=5, [59]=5, [60]=8, [61]=8, [62]=8, [63]=8, [64]=12, [65]=9, [66]=7, [67]=9, [68]=10, [69]=8, [70]=8, [71]=8, [72]=10, [73]=7, [74]=8, [75]=9, [76]=9, [77]=12, [78]=10, [79]=9, [80]=9, [81]=9, [82]=11, [83]=11, [84]=8, [85]=11, [86]=11, [87]=12, [88]=12, [89]=11, [90]=11, [91]=8, [92]=5, [93]=8, [94]=8, [95]=8, [96]=5, [97]=6, [98]=6, [99]=6, [100]=7, [101]=6, [102]=5, [103]=6, [104]=6, [105]=4, [106]=5, [107]=7, [108]=5, [109]=9, [110]=8, [111]=6, [112]=9, [113]=8, [114]=7, [115]=7, [116]=6, [117]=8, [118]=8, [119]=11, [120]=10, [121]=8, [122]=8, [123]=8, [124]=6, [125]=9, [126]=10, [8216]=4, [8217]=4, [8220]=6, [8221]=6 }, } diff --git a/boards/init.lua b/boards/init.lua index 4126a6c..e27e8da 100644 --- a/boards/init.lua +++ b/boards/init.lua @@ -22,10 +22,9 @@ boards = {} boards.name = minetest.get_current_modname() boards.path = minetest.get_modpath(boards.name) --- Load support for intllib. -local S, NS = dofile(boards.path.."/intllib.lua") -boards.intllib = S -local F = function(...) return minetest.formspec_escape(S(...)) end +-- Translation support +local S = minetest.get_translator(boards.name) +local FS = function(...) return minetest.formspec_escape(S(...)) end -- Load font dofile(boards.path.."/font_tinycurs.lua") @@ -34,9 +33,9 @@ local function set_formspec(pos) local meta = minetest.get_meta(pos) meta:set_string("formspec", "size[6,4]"..default.gui_bg..default.gui_bg_img..default.gui_slots.. - "textarea[0.5,0.7;5.5,3;display_text;"..F("Text")..";${display_text}]".. - "button_exit[3,3.5;2,1;ok;"..F("Write").."]".. - "button_exit[1,3.5;2,1;wipe;"..F("Wipe").."]") + "textarea[0.5,0.7;5.5,3;display_text;"..FS("Text")..";${display_text}]".. + "button_exit[3,3.5;2,1;ok;"..FS("Write").."]".. + "button_exit[1,3.5;2,1;wipe;"..FS("Wipe").."]") end -- On boards, everyone is allowed to write and wipe @@ -51,7 +50,7 @@ local function on_receive_fields(pos, formname, fields, player) end end -models = { +local models = { black_board = { depth = 1/16, width = 1, height = 1, entity_fields = { @@ -67,6 +66,7 @@ models = { tiles = { "default_wood.png", "default_wood.png", "default_wood.png", "default_wood.png", "default_wood.png", "board_black_front.png" }, + _itemframe_texture = "board_black_front.png", drawtype = "nodebox", node_box = { type = "fixed", @@ -79,6 +79,10 @@ models = { set_formspec(pos) display_api.on_construct(pos) end, + on_punch = function(pos) + set_formspec(pos) + display_api.update_entities(pos) + end, on_receive_fields = on_receive_fields, }, }, @@ -98,6 +102,7 @@ models = { "default_wood.png", "default_wood.png", "default_wood.png", "board_green_front.png" }, drawtype = "nodebox", + _itemframe_texture = "board_green_front.png", node_box = { type = "fixed", fixed = { @@ -109,6 +114,10 @@ models = { set_formspec(pos) display_api.on_construct(pos) end, + on_punch = function(pos) + set_formspec(pos) + display_api.update_entities(pos) + end, on_receive_fields = on_receive_fields, }, }, @@ -126,7 +135,7 @@ minetest.register_craft( output = "boards:black_board", recipe = { {"group:wood", "group:stone", "dye:black"}, - } + } }) minetest.register_craft( @@ -134,6 +143,6 @@ minetest.register_craft( output = "boards:green_board", recipe = { {"group:wood", "group:stone", "dye:dark_green"}, - } + } }) diff --git a/boards/intllib.lua b/boards/intllib.lua deleted file mode 100644 index 6669d72..0000000 --- a/boards/intllib.lua +++ /dev/null @@ -1,45 +0,0 @@ - --- Fallback functions for when `intllib` is not installed. --- Code released under Unlicense . - --- 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/boards/locale/boards.de.tr b/boards/locale/boards.de.tr new file mode 100644 index 0000000..ab81fd3 --- /dev/null +++ b/boards/locale/boards.de.tr @@ -0,0 +1,6 @@ +# textdomain: boards +Black board=Schwarze Tafel +Green board=GrĂ¼ne Tafel +Text=Text +Write=Schreiben +Wipe=Abwischen diff --git a/boards/locale/boards.fr.tr b/boards/locale/boards.fr.tr new file mode 100644 index 0000000..6553436 --- /dev/null +++ b/boards/locale/boards.fr.tr @@ -0,0 +1,6 @@ +# textdomain: boards +Black board=Tableau noir +Green board=Tableau vert +Text= +Write= +Wipe= diff --git a/boards/locale/boards.ms.tr b/boards/locale/boards.ms.tr new file mode 100644 index 0000000..49bdbee --- /dev/null +++ b/boards/locale/boards.ms.tr @@ -0,0 +1,6 @@ +# textdomain: boards +Black board=Papan hitam +Green board= +Text= +Write= +Wipe= diff --git a/boards/locale/fr.po b/boards/locale/fr.po deleted file mode 100644 index 1b081be..0000000 --- a/boards/locale/fr.po +++ /dev/null @@ -1,40 +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 , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-07-16 10:00+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: init.lua -msgid "Text" -msgstr "Texte" - -#: init.lua -msgid "Write" -msgstr "Ecrire" - -#: init.lua -msgid "Wipe" -msgstr "Effacer" - -#: init.lua -msgid "Black board" -msgstr "Tableau noir" - -#: init.lua -msgid "Green board" -msgstr "Tableau vert" - - diff --git a/boards/locale/ms.po b/boards/locale/ms.po deleted file mode 100644 index fe360aa..0000000 --- a/boards/locale/ms.po +++ /dev/null @@ -1,35 +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) , 2020. -# -msgid "" -msgstr "" -"Project-Id-Version: Display Modpack\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-07-16 10:00+0200\n" -"PO-Revision-Date: 2020-07-05 11:31+0000\n" -"Language-Team: Malay \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.3\n" -"Last-Translator: Yaya MNH48 \n" -"Plural-Forms: nplurals=1; plural=0;\n" -"Language: ms\n" - -#: init.lua -msgid "Text" -msgstr "Teks" - -#: init.lua -msgid "Write" -msgstr "Tulis" - -#: init.lua -msgid "Wipe" -msgstr "Padam" - -#: init.lua -msgid "Black board" -msgstr "Papan hitam" diff --git a/boards/locale/template.pot b/boards/locale/template.pot deleted file mode 100644 index 8db98b8..0000000 --- a/boards/locale/template.pot +++ /dev/null @@ -1,34 +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 , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-07-16 10:00+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: init.lua -msgid "Text" -msgstr "" - -#: init.lua -msgid "Write" -msgstr "" - -#: init.lua -msgid "Wipe" -msgstr "" - -#: init.lua -msgid "Black board" -msgstr "" diff --git a/boards/locale/template.txt b/boards/locale/template.txt new file mode 100644 index 0000000..104a8e6 --- /dev/null +++ b/boards/locale/template.txt @@ -0,0 +1,6 @@ +# textdomain: boards +Black board= +Green board= +Text= +Write= +Wipe= diff --git a/boards/tools/updatepo.sh b/boards/tools/updatepo.sh deleted file mode 100755 index feb2504..0000000 --- a/boards/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 -- cgit v1.2.3