1
0
mirror of https://github.com/pyrollo/display_modpack.git synced 2025-10-17 01:25:21 +02:00

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
This commit is contained in:
Niklp
2023-07-24 09:59:26 +02:00
committed by GitHub
parent e0e0305836
commit 1440f35fa6
91 changed files with 415 additions and 1465 deletions

View File

@@ -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
},
}

View File

@@ -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"},
}
}
})

View File

@@ -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

View File

@@ -0,0 +1,6 @@
# textdomain: boards
Black board=Schwarze Tafel
Green board=Grüne Tafel
Text=Text
Write=Schreiben
Wipe=Abwischen

View File

@@ -0,0 +1,6 @@
# textdomain: boards
Black board=Tableau noir
Green board=Tableau vert
Text=
Write=
Wipe=

View File

@@ -0,0 +1,6 @@
# textdomain: boards
Black board=Papan hitam
Green board=
Text=
Write=
Wipe=

View File

@@ -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 <EMAIL@ADDRESS>, 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 <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 "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"

View File

@@ -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) <translation@mnh48.moe>, 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 <translation@mnh48.moe>\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 <translation@mnh48.moe>\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"

View File

@@ -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 <EMAIL@ADDRESS>, 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 <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 "Text"
msgstr ""
#: init.lua
msgid "Write"
msgstr ""
#: init.lua
msgid "Wipe"
msgstr ""
#: init.lua
msgid "Black board"
msgstr ""

View File

@@ -0,0 +1,6 @@
# textdomain: boards
Black board=
Green board=
Text=
Write=
Wipe=

View File

@@ -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