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 --- .github/workflows/luacheck.yml | 10 +++ .luacheckrc | 19 +++++ README.md | 4 +- 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 ------ display_api/deprecation.lua | 8 +- display_api/display.lua | 45 ++--------- font_api/deprecation.lua | 2 +- font_api/fallbacks.lua | 2 +- font_api/font.lua | 12 +-- font_api/fontform.lua | 7 +- font_api/init.lua | 3 + font_api/locale/font_api.de.tr | 2 + font_api/locale/template.txt | 2 + font_api/registry.lua | 7 +- font_metro/init.lua | 10 ++- modpack.conf | 0 modpack.txt | 0 ontime_clocks/common.lua | 6 +- ontime_clocks/crafts.lua | 2 +- ontime_clocks/init.lua | 7 +- ontime_clocks/intllib.lua | 45 ----------- ontime_clocks/locale/fr.po | 43 ---------- ontime_clocks/locale/ms.po | 42 ---------- ontime_clocks/locale/ontime_clocks.de.tr | 7 ++ ontime_clocks/locale/ontime_clocks.fr.tr | 7 ++ ontime_clocks/locale/ontime_clocks.ms.tr | 7 ++ ontime_clocks/locale/template.pot | 42 ---------- ontime_clocks/locale/template.txt | 7 ++ ontime_clocks/mod.conf | 1 - ontime_clocks/nodes.lua | 89 +++++++++------------ .../ontime_clocks_green_digital_inventory.png | Bin 175 -> 164 bytes ontime_clocks/tools/updatepo.sh | 25 ------ signs/common.lua | 3 - signs/init.lua | 5 +- signs/intllib.lua | 45 ----------- signs/locale/fr.po | 54 ------------- signs/locale/ms.po | 51 ------------ signs/locale/signs.de.tr | 14 ++++ signs/locale/signs.fr.tr | 14 ++++ signs/locale/signs.ms.tr | 14 ++++ signs/locale/template.pot | 51 ------------ signs/locale/template.txt | 14 ++++ signs/mod.conf | 1 - signs/nodes.lua | 28 +++---- signs/tools/updatepo.sh | 25 ------ signs_api/init.lua | 66 +++++---------- signs_api/intllib.lua | 45 ----------- signs_api/locale/fr.po | 49 ------------ signs_api/locale/ms.po | 46 ----------- signs_api/locale/signs_api.de.tr | 5 ++ signs_api/locale/signs_api.fr.tr | 5 ++ signs_api/locale/signs_api.ms.tr | 5 ++ signs_api/locale/template.pot | 31 ------- signs_api/locale/template.txt | 5 ++ signs_api/mod.conf | 1 - signs_api/tools/updatepo.sh | 25 ------ signs_road/crafts.lua | 7 +- signs_road/init.lua | 5 +- signs_road/intllib.lua | 45 ----------- signs_road/locale/fr.po | 56 ------------- signs_road/locale/ms.po | 54 ------------- signs_road/locale/signs_road.de.tr | 15 ++++ signs_road/locale/signs_road.fr.tr | 15 ++++ signs_road/locale/signs_road.ms.tr | 15 ++++ signs_road/locale/template.pot | 54 ------------- signs_road/locale/template.txt | 15 ++++ signs_road/mod.conf | 1 - signs_road/nodes.lua | 2 +- signs_road/tools/updatepo.sh | 25 ------ steles/config.lua | 8 +- steles/init.lua | 5 +- steles/intllib.lua | 45 ----------- steles/locale/fr.po | 47 ----------- steles/locale/ms.po | 46 ----------- steles/locale/steles.de.tr | 9 +++ steles/locale/steles.fr.tr | 9 +++ steles/locale/steles.ms.tr | 9 +++ steles/locale/template.pot | 46 ----------- steles/locale/template.txt | 9 +++ steles/mod.conf | 2 +- steles/nodes.lua | 8 +- steles/tools/updatepo.sh | 25 ------ 92 files changed, 415 insertions(+), 1465 deletions(-) create mode 100644 .github/workflows/luacheck.yml create mode 100644 .luacheckrc 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 create mode 100644 font_api/locale/font_api.de.tr create mode 100644 font_api/locale/template.txt create mode 100644 modpack.conf delete mode 100644 modpack.txt delete mode 100644 ontime_clocks/intllib.lua delete mode 100644 ontime_clocks/locale/fr.po delete mode 100644 ontime_clocks/locale/ms.po create mode 100644 ontime_clocks/locale/ontime_clocks.de.tr create mode 100644 ontime_clocks/locale/ontime_clocks.fr.tr create mode 100644 ontime_clocks/locale/ontime_clocks.ms.tr delete mode 100644 ontime_clocks/locale/template.pot create mode 100644 ontime_clocks/locale/template.txt delete mode 100755 ontime_clocks/tools/updatepo.sh delete mode 100644 signs/intllib.lua delete mode 100644 signs/locale/fr.po delete mode 100644 signs/locale/ms.po create mode 100644 signs/locale/signs.de.tr create mode 100644 signs/locale/signs.fr.tr create mode 100644 signs/locale/signs.ms.tr delete mode 100644 signs/locale/template.pot create mode 100644 signs/locale/template.txt delete mode 100755 signs/tools/updatepo.sh delete mode 100644 signs_api/intllib.lua delete mode 100644 signs_api/locale/fr.po delete mode 100644 signs_api/locale/ms.po create mode 100644 signs_api/locale/signs_api.de.tr create mode 100644 signs_api/locale/signs_api.fr.tr create mode 100644 signs_api/locale/signs_api.ms.tr delete mode 100644 signs_api/locale/template.pot create mode 100644 signs_api/locale/template.txt delete mode 100755 signs_api/tools/updatepo.sh delete mode 100644 signs_road/intllib.lua delete mode 100644 signs_road/locale/fr.po delete mode 100644 signs_road/locale/ms.po create mode 100644 signs_road/locale/signs_road.de.tr create mode 100644 signs_road/locale/signs_road.fr.tr create mode 100644 signs_road/locale/signs_road.ms.tr delete mode 100644 signs_road/locale/template.pot create mode 100644 signs_road/locale/template.txt delete mode 100755 signs_road/tools/updatepo.sh delete mode 100644 steles/intllib.lua delete mode 100644 steles/locale/fr.po delete mode 100644 steles/locale/ms.po create mode 100644 steles/locale/steles.de.tr create mode 100644 steles/locale/steles.fr.tr create mode 100644 steles/locale/steles.ms.tr delete mode 100644 steles/locale/template.pot create mode 100644 steles/locale/template.txt delete mode 100755 steles/tools/updatepo.sh diff --git a/.github/workflows/luacheck.yml b/.github/workflows/luacheck.yml new file mode 100644 index 0000000..5d79609 --- /dev/null +++ b/.github/workflows/luacheck.yml @@ -0,0 +1,10 @@ +name: luacheck +on: [push, pull_request] +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: Roang-zero1/factorio-mod-luacheck@master + with: + luacheckrc_url: "" \ No newline at end of file diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..c990d53 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,19 @@ +unused_args = false + +read_globals = { + "minetest", + "table", + "vector", + "default" +} + +globals = { + "boards", + "display_api", + "font_api", + "ontime_clocks", + "signs", + "signs_api", + "signs_road", + "steles" +} \ No newline at end of file diff --git a/README.md b/README.md index c37a469..6c84025 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # Display Modpack Version 1.3.1 -This modpack provides mods with dynamic display. Mods are : +Requires Minetest 5.0+ + +This modpack provides mods with dynamic display. Mods are: - **[display_api](https://github.com/pyrollo/display_modpack/tree/master/display_api)**: A library for adding display entities to nodes; - **[font_api](https://github.com/pyrollo/display_modpack/tree/master/font_api)**: A library for displaying fonts on entities; 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 diff --git a/display_api/deprecation.lua b/display_api/deprecation.lua index b041f6f..36e1ecd 100644 --- a/display_api/deprecation.lua +++ b/display_api/deprecation.lua @@ -19,17 +19,17 @@ -- Deprecation -function deprecated_group(deprecated_group, replacement_group) +local function deprecated_group(old_group, replacement_group) for name, ndef in pairs(minetest.registered_nodes) do - if ndef.groups and ndef.groups[deprecated_group] then + if ndef.groups and ndef.groups[old_group] then minetest.log("warning", string.format( 'Node %s belongs to deprecated "%s" group which should be replaced with new "%s" group.', - name, deprecated_group, replacement_group)) + name, old_group, replacement_group)) end end end -function deprecated_global_table(deprecated_global_name, replacement_global_name) +local function deprecated_global_table(deprecated_global_name, replacement_global_name) assert(type(deprecated_global_name) == 'string', "deprecated_global_name should be a string.") assert(type(replacement_global_name) == 'string', "replacement_global_name should be a string.") assert(deprecated_global_name ~= '', "deprecated_global_name should not be empty.") diff --git a/display_api/display.lua b/display_api/display.lua index fa7c854..2baef11 100644 --- a/display_api/display.lua +++ b/display_api/display.lua @@ -65,9 +65,7 @@ local function compute_values(r) for _ = 1, r.x do d, w, h = rx(d), rx(w), rx(h) end for _ = 1, r.y do d, w, h = ry(d), ry(w), ry(h) end - return { - rotation=r, depth=d, width=w, height=h, - restricted=(r.x==0 and r.z==0) } + return {rotation=r, depth=d, width=w, height=h} end for i, r in pairs(facedir_rotations) do @@ -78,25 +76,6 @@ for i, r in pairs(wallmounted_rotations) do wallmounted_values[i] = compute_values(r) end --- Detect rotation restriction -local rotation_restricted = nil -minetest.register_entity('display_api:dummy_entity', { - collisionbox = { 0, 0, 0, 0, 0, 0 }, - visual = "upright_sprite", - textures = {} }) - -function display_api.is_rotation_restricted() - if rotation_restricted == nil then - local objref = minetest.add_entity( - {x=0, y=0, z=0}, 'display_api:dummy_entity') - if objref then - rotation_restricted = objref.set_rotation == nil - objref:remove() - end - end - return rotation_restricted -end - -- Clip position property to maximum entity position local function clip_pos_prop(posprop) @@ -243,16 +222,6 @@ function display_api.on_place(itemstack, placer, pointed_thing, override_param2) z = pointed_thing.under.z - pointed_thing.above.z, } - local rotation_restriction = display_api.is_rotation_restricted() - - if rotation_restriction then - -- If item is not placed on a wall, use the player's view direction instead - if dir.x == 0 and dir.z == 0 then - dir = placer:get_look_dir() - end - dir.y = 0 - end - local param2 = 0 if ndef then if ndef.paramtype2 == "wallmounted" or @@ -261,7 +230,7 @@ function display_api.on_place(itemstack, placer, pointed_thing, override_param2) elseif ndef.paramtype2 == "facedir" or ndef.paramtype2 == "colorfacedir" then - param2 = minetest.dir_to_facedir(dir, not rotation_restriction) + param2 = minetest.dir_to_facedir(dir, true) end end return minetest.item_place(itemstack, placer, pointed_thing, @@ -291,13 +260,9 @@ function display_api.on_rotate(pos, node, user, _, new_param2) return end - if ov.restricted or not display_api.is_rotation_restricted() then - minetest.swap_node(pos, node) - display_api.update_entities(pos) - return true - else - return false - end + minetest.swap_node(pos, node) + display_api.update_entities(pos) + return true end --- Creates display entity with some fields and the on_activate callback diff --git a/font_api/deprecation.lua b/font_api/deprecation.lua index 1ffed11..93cf365 100644 --- a/font_api/deprecation.lua +++ b/font_api/deprecation.lua @@ -18,7 +18,7 @@ -- Deprecation -function deprecated_global_table(deprecated_global_name, replacement_global_name) +local function deprecated_global_table(deprecated_global_name, replacement_global_name) assert(type(deprecated_global_name) == 'string', "deprecated_global_name should be a string.") assert(type(replacement_global_name) == 'string', "replacement_global_name should be a string.") assert(deprecated_global_name ~= '', "deprecated_global_name should not be empty.") diff --git a/font_api/fallbacks.lua b/font_api/fallbacks.lua index da3ff03..ebe8387 100644 --- a/font_api/fallbacks.lua +++ b/font_api/fallbacks.lua @@ -53,7 +53,7 @@ return { ['×'] = 'x', ['Ý'] = 'Y', -- Lower case accents - ['à'] = 'a', ['à'] = 'a', ['á'] = 'a', ['â'] = 'a', + ['à'] = 'a', ['á'] = 'a', ['â'] = 'a', ['ã'] = 'a', ['ä'] = 'a', ['å'] = 'a', ['æ'] = 'ae', ['ç'] = 'c', ['è'] = 'e', ['é'] = 'e', ['ê'] = 'e', ['ë'] = 'e', diff --git a/font_api/font.lua b/font_api/font.lua index 5794867..d7b67d7 100644 --- a/font_api/font.lua +++ b/font_api/font.lua @@ -212,7 +212,7 @@ end -- @return Texture string function Font:render(text, texturew, textureh, style) - local style = style or {} + style = style or {} -- Split text into lines (and limit to style.lines # of lines) local lines = {} @@ -243,17 +243,17 @@ function Font:render(text, texturew, textureh, style) y = y + (self.margintop or 0) - for _, line in pairs(lines) do + for _, l in pairs(lines) do if style.halign == "left" then x = 0 elseif style.halign == "right" then - x = texturew - line.width + x = texturew - l.width else - x = (texturew - line.width) / 2 + x = (texturew - l.width) / 2 end - while line.text ~= '' do - codepoint, line.text = self:get_next_char(line.text) + while l.text ~= '' do + codepoint, l.text = self:get_next_char(l.text) if codepoint == nil then return '' end -- UTF Error -- Add image only if it is visible (at least partly) diff --git a/font_api/fontform.lua b/font_api/fontform.lua index b7e6724..d019fba 100644 --- a/font_api/fontform.lua +++ b/font_api/fontform.lua @@ -16,6 +16,9 @@ along with this program. If not, see . --]] +local S = font_api.S +local FS = function(...) return minetest.formspec_escape(S(...)) end + local modname = minetest.get_current_modname() local contexts = {} @@ -101,9 +104,9 @@ local function show_font_formspec(playername) table.sort(fonts) local fs = string.format( - "size[4,%s]%s%s%sbutton_exit[0,%s;4,1;cancel;Cancel]", + "size[4,%s]%s%s%sbutton_exit[0,%s;4,1;cancel;%s]", #fonts + 0.8, default.gui_bg, default.gui_bg_img, default.gui_slots, - #fonts) + #fonts, FS("Cancel")) for line = 1, #fonts do local font = font_api.get_font(fonts[line]) diff --git a/font_api/init.lua b/font_api/init.lua index c5858f4..a0a2969 100644 --- a/font_api/init.lua +++ b/font_api/init.lua @@ -23,6 +23,9 @@ font_api = {} font_api.name = minetest.get_current_modname() font_api.path = minetest.get_modpath(font_api.name) +-- Translation support +font_api.S = minetest.get_translator(font_api.name) + -- Inclusions ------------- diff --git a/font_api/locale/font_api.de.tr b/font_api/locale/font_api.de.tr new file mode 100644 index 0000000..5536527 --- /dev/null +++ b/font_api/locale/font_api.de.tr @@ -0,0 +1,2 @@ +# textdomain: font_api +Cancel=Schließen diff --git a/font_api/locale/template.txt b/font_api/locale/template.txt new file mode 100644 index 0000000..a2ffa72 --- /dev/null +++ b/font_api/locale/template.txt @@ -0,0 +1,2 @@ +# textdomain: font_api +Cancel= diff --git a/font_api/registry.lua b/font_api/registry.lua index e183675..b497453 100644 --- a/font_api/registry.lua +++ b/font_api/registry.lua @@ -58,12 +58,9 @@ local function get_default_font() end end - -- If failed, chose first font + -- If failed, choose the first registered font if default_font == nil then - for _, font in pairs(font_api.registered_fonts) do - default_font = font - break - end + default_font = next(font_api.registered_fonts) end -- Error, no font registered diff --git a/font_metro/init.lua b/font_metro/init.lua index ec9a918..1405efb 100644 --- a/font_metro/init.lua +++ b/font_metro/init.lua @@ -1,16 +1,18 @@ --[[ Metro font for Font API - - Original font Metro Sans - by Christian Munk (CMunk) + + Original font Metro Sans + by Christian Munk (CMunk) released under CC-BY-SA license - + https://fontstruct.com/fontstructions/show/723864/metro_sans Derivative textures and code are under CC-BY-SA license --]] +-- widths is not split into several lines, because the font is generated by 'make_font_lua.sh' +-- luacheck: ignore font_api.register_font( 'metro', { diff --git a/modpack.conf b/modpack.conf new file mode 100644 index 0000000..e69de29 diff --git a/modpack.txt b/modpack.txt deleted file mode 100644 index e69de29..0000000 diff --git a/ontime_clocks/common.lua b/ontime_clocks/common.lua index cced299..2c7639f 100644 --- a/ontime_clocks/common.lua +++ b/ontime_clocks/common.lua @@ -1,5 +1,5 @@ --[[ - ontime_clocks mod for Minetest - Clock nodes displaying ingame time + ontime_clocks mod for Minetest - Clock nodes displaying ingame time (c) Pierre-Yves Rollo This file is part of ontime_clocks. @@ -34,7 +34,7 @@ function ontime_clocks.get_m12() end function ontime_clocks.get_digital_properties(color_off, color_on, hour, minute) - return + return { textures={"ontime_clocks_digital_background.png^[colorize:"..color_off .."^([combine:21x7" @@ -51,7 +51,7 @@ end function ontime_clocks.get_needles_properties(color, size, hour, minute) return { - textures={"[combine:"..size.."x"..size + textures={"[combine:"..size.."x"..size ..":0,"..(-size*hour).."=ontime_clocks_needle_h"..size..".png" ..":0,"..(-size*minute).."=ontime_clocks_needle_m"..size..".png" .."^[colorize:"..color}, diff --git a/ontime_clocks/crafts.lua b/ontime_clocks/crafts.lua index c94352a..9eab3a9 100644 --- a/ontime_clocks/crafts.lua +++ b/ontime_clocks/crafts.lua @@ -1,5 +1,5 @@ --[[ - ontime_clocks mod for Minetest - Clock nodes displaying ingame time + ontime_clocks mod for Minetest - Clock nodes displaying ingame time (c) Pierre-Yves Rollo This file is part of ontime_clocks. diff --git a/ontime_clocks/init.lua b/ontime_clocks/init.lua index d0ac334..83edcdb 100644 --- a/ontime_clocks/init.lua +++ b/ontime_clocks/init.lua @@ -1,5 +1,5 @@ --[[ - ontime_clocks mod for Minetest - Clock nodes displaying ingame time + ontime_clocks mod for Minetest - Clock nodes displaying ingame time (c) Pierre-Yves Rollo This file is part of ontime_clocks. @@ -22,9 +22,8 @@ ontime_clocks = {} ontime_clocks.name = minetest.get_current_modname() ontime_clocks.path = minetest.get_modpath(ontime_clocks.name) --- Load support for intllib. -local S, NS = dofile(ontime_clocks.path.."/intllib.lua") -ontime_clocks.intllib = S +-- Translation support +ontime_clocks.S = minetest.get_translator(ontime_clocks.name) dofile(ontime_clocks.path.."/common.lua") dofile(ontime_clocks.path.."/nodes.lua") diff --git a/ontime_clocks/intllib.lua b/ontime_clocks/intllib.lua deleted file mode 100644 index 6669d72..0000000 --- a/ontime_clocks/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/ontime_clocks/locale/fr.po b/ontime_clocks/locale/fr.po deleted file mode 100644 index ed5d2b4..0000000 --- a/ontime_clocks/locale/fr.po +++ /dev/null @@ -1,43 +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. -# -msgid "" -msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-08-05 09:50+0200\n" -"PO-Revision-Date: 2017-05-08 06:20+0200\n" -"Last-Translator: Peppy \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" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#: nodes.lua -msgid "Green digital clock" -msgstr "Horloge numérique verte" - -#: nodes.lua -msgid "Red digital clock" -msgstr "Horloge numérique rouge" - -#: nodes.lua -msgid "White clock" -msgstr "Horloge blanche" - -#: nodes.lua -msgid "Frameless clock" -msgstr "Horloge sans cadre" - -#: nodes.lua -msgid "Frameless gold clock" -msgstr "Horloge dorée sans cadre" - -#: nodes.lua -msgid "Frameless white clock" -msgstr "Horloge blanche sans cadre" diff --git a/ontime_clocks/locale/ms.po b/ontime_clocks/locale/ms.po deleted file mode 100644 index 4d52ac2..0000000 --- a/ontime_clocks/locale/ms.po +++ /dev/null @@ -1,42 +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) , 2017. -msgid "" -msgstr "" -"Project-Id-Version: Display Modpack\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-08-26 11:21+0200\n" -"PO-Revision-Date: 2020-07-05 11:32+0000\n" -"Last-Translator: Yaya MNH48 \n" -"Language-Team: Malay \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" - -#: nodes.lua -msgid "Green digital clock" -msgstr "Jam digital hijau" - -#: nodes.lua -msgid "Red digital clock" -msgstr "Jam digital merah" - -#: nodes.lua -msgid "White clock" -msgstr "Jam putih" - -#: nodes.lua -msgid "Frameless clock" -msgstr "Jam tanpa bingkai" - -#: nodes.lua -msgid "Frameless gold clock" -msgstr "Jam emas tanpa bingkai" - -#: nodes.lua -msgid "Frameless white clock" -msgstr "Jam putih tanpa bingkai" diff --git a/ontime_clocks/locale/ontime_clocks.de.tr b/ontime_clocks/locale/ontime_clocks.de.tr new file mode 100644 index 0000000..5bdb660 --- /dev/null +++ b/ontime_clocks/locale/ontime_clocks.de.tr @@ -0,0 +1,7 @@ +# textdomain: ontime_clocks +Green digital clock=Grüne Digitaluhr +Red digital clock=Rote Digitaluhr +White clock=Weiße Uhr +Frameless clock=Rahmenlose Uhr +Frameless gold clock=Rahmenlose goldene Uhr +Frameless white clock=Rahmenlose weiße Uhr diff --git a/ontime_clocks/locale/ontime_clocks.fr.tr b/ontime_clocks/locale/ontime_clocks.fr.tr new file mode 100644 index 0000000..fdc8ccf --- /dev/null +++ b/ontime_clocks/locale/ontime_clocks.fr.tr @@ -0,0 +1,7 @@ +# textdomain: ontime_clocks +Green digital clock=Horloge numérique verte +Red digital clock=Horloge numérique rouge +White clock=Horloge blanche +Frameless clock=Horloge sans cadre +Frameless gold clock=Horloge dorée sans cadre +Frameless white clock=Horloge blanche sans cadre diff --git a/ontime_clocks/locale/ontime_clocks.ms.tr b/ontime_clocks/locale/ontime_clocks.ms.tr new file mode 100644 index 0000000..0478935 --- /dev/null +++ b/ontime_clocks/locale/ontime_clocks.ms.tr @@ -0,0 +1,7 @@ +# textdomain: ontime_clocks +Green digital clock=Jam digital hijau +Red digital clock=Jam digital merah +White clock=Jam putih +Frameless clock=Jam tanpa bingkai +Frameless gold clock=Jam emas tanpa bingkai +Frameless white clock=Jam putih tanpa bingkai diff --git a/ontime_clocks/locale/template.pot b/ontime_clocks/locale/template.pot deleted file mode 100644 index dca736f..0000000 --- a/ontime_clocks/locale/template.pot +++ /dev/null @@ -1,42 +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: 2017-08-26 11:21+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" - -#: nodes.lua -msgid "Green digital clock" -msgstr "" - -#: nodes.lua -msgid "Red digital clock" -msgstr "" - -#: nodes.lua -msgid "White clock" -msgstr "" - -#: nodes.lua -msgid "Frameless clock" -msgstr "" - -#: nodes.lua -msgid "Frameless gold clock" -msgstr "" - -#: nodes.lua -msgid "Frameless white clock" -msgstr "" diff --git a/ontime_clocks/locale/template.txt b/ontime_clocks/locale/template.txt new file mode 100644 index 0000000..6db07cb --- /dev/null +++ b/ontime_clocks/locale/template.txt @@ -0,0 +1,7 @@ +# textdomain: ontime_clocks +Green digital clock= +Red digital clock= +White clock= +Frameless clock= +Frameless gold clock= +Frameless white clock= diff --git a/ontime_clocks/mod.conf b/ontime_clocks/mod.conf index f6afbde..144b266 100644 --- a/ontime_clocks/mod.conf +++ b/ontime_clocks/mod.conf @@ -2,4 +2,3 @@ name = ontime_clocks title = Ontime Clocks description = Clocks displaing real ingame time depends = default,dye,display_api -optional_depends = intllib diff --git a/ontime_clocks/nodes.lua b/ontime_clocks/nodes.lua index 107d2e9..dcdcbdd 100644 --- a/ontime_clocks/nodes.lua +++ b/ontime_clocks/nodes.lua @@ -18,7 +18,18 @@ along with ontime_clocks. If not, see . --]] -local S = ontime_clocks.intllib +local S = ontime_clocks.S + +local function clock_on_construct(pos) + local timer = minetest.get_node_timer(pos) + timer:start(5) + display_api.on_construct(pos) +end + +local function clock_on_timer(pos) + display_api.update_entities(pos) + return true +end -- Green digital clock minetest.register_node("ontime_clocks:green_digital", { @@ -30,9 +41,9 @@ minetest.register_node("ontime_clocks:green_digital", { drawtype = "nodebox", node_box = { type = "wallmounted", - wall_side = { -0.5, -3/16, -7/16, -13/32, 7/32, 7/16 }, - wall_top = { -7/16, 0.5, -7/32, 7/16, 13/32, 3/16 }, - wall_bottom = { -7/16, -0.5, -3/16, 7/16, -13/32, 7/32 }, + wall_side = {-0.5, -3/16, -7/16, -13/32, 7/32, 7/16}, + wall_bottom = {-7/16, -0.5, -3/16, 7/16, -13/32, 7/32}, + wall_top = {-7/16, 0.5, -7/32, 7/16, 13/32, 3/16} }, tiles = {"ontime_clocks_digital.png"}, groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1}, @@ -46,17 +57,12 @@ minetest.register_node("ontime_clocks:green_digital", { end }, }, on_place = display_api.on_place, - on_construct = display_api.on_construct, + on_construct = clock_on_construct, on_destruct = display_api.on_destruct, on_rotate = display_api.on_rotate, + on_timer = clock_on_timer, }) -minetest.register_abm({ - nodenames = {"ontime_clocks:green_digital"}, - interval = 5, - chance = 1, - action = display_api.update_entities, -}) -- Red digital clock minetest.register_node("ontime_clocks:red_digital", { @@ -68,9 +74,9 @@ minetest.register_node("ontime_clocks:red_digital", { drawtype = "nodebox", node_box = { type = "wallmounted", - wall_side = { -0.5, -3/16, -7/16, -13/32, 7/32, 7/16 }, - wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }, - wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } + wall_side = {-0.5, -3/16, -7/16, -13/32, 7/32, 7/16}, + wall_bottom = {-7/16, -0.5, -3/16, 7/16, -13/32, 7/32}, + wall_top = {-7/16, 0.5, -7/32, 7/16, 13/32, 3/16} }, tiles = {"ontime_clocks_digital.png"}, groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1}, @@ -84,16 +90,10 @@ minetest.register_node("ontime_clocks:red_digital", { end }, }, on_place = display_api.on_place, - on_construct = display_api.on_construct, + on_construct = clock_on_construct, on_destruct = display_api.on_destruct, on_rotate = display_api.on_rotate, -}) - -minetest.register_abm({ - nodenames = {"ontime_clocks:red_digital"}, - interval = 5, - chance = 1, - action = display_api.update_entities, + on_timer = clock_on_timer, }) @@ -122,17 +122,12 @@ minetest.register_node("ontime_clocks:white", { end }, }, on_place = display_api.on_place, - on_construct = display_api.on_construct, + on_construct = clock_on_construct, on_destruct = display_api.on_destruct, on_rotate = display_api.on_rotate, + on_timer = clock_on_timer, }) -minetest.register_abm({ - nodenames = {"ontime_clocks:white"}, - interval = 5, - chance = 1, - action = display_api.update_entities, -}) minetest.register_node("ontime_clocks:frameless_black", { description = S("Frameless clock"), @@ -159,17 +154,12 @@ minetest.register_node("ontime_clocks:frameless_black", { end }, }, on_place = display_api.on_place, - on_construct = display_api.on_construct, + on_construct = clock_on_construct, on_destruct = display_api.on_destruct, on_rotate = display_api.on_rotate, + on_timer = clock_on_timer, }) -minetest.register_abm({ - nodenames = {"ontime_clocks:frameless_black"}, - interval = 5, - chance = 1, - action = display_api.update_entities, -}) minetest.register_node("ontime_clocks:frameless_gold", { description = S("Frameless gold clock"), @@ -196,17 +186,12 @@ minetest.register_node("ontime_clocks:frameless_gold", { end }, }, on_place = display_api.on_place, - on_construct = display_api.on_construct, + on_construct = clock_on_construct, on_destruct = display_api.on_destruct, on_rotate = display_api.on_rotate, + on_timer = clock_on_timer, }) -minetest.register_abm({ - nodenames = {"ontime_clocks:frameless_gold"}, - interval = 5, - chance = 1, - action = display_api.update_entities, -}) minetest.register_node("ontime_clocks:frameless_white", { description = S("Frameless white clock"), @@ -233,14 +218,20 @@ minetest.register_node("ontime_clocks:frameless_white", { end }, }, on_place = display_api.on_place, - on_construct = display_api.on_construct, + on_construct = clock_on_construct, on_destruct = display_api.on_destruct, on_rotate = display_api.on_rotate, + on_timer = clock_on_timer, }) -minetest.register_abm({ - nodenames = {"ontime_clocks:frameless_white"}, - interval = 5, - chance = 1, - action = display_api.update_entities, + +minetest.register_lbm({ + name = "ontime_clocks:nodetimer_init", + nodenames = {"ontime_clocks:green_digital", "ontime_clocks:red_digital", "ontime_clocks:white", + "ontime_clocks:frameless_black", "ontime_clocks:frameless_gold", "ontime_clocks:frameless_white"}, + run_at_every_load = false, + action = function(pos) + local timer = minetest.get_node_timer(pos) + timer:start(5) + end }) diff --git a/ontime_clocks/textures/ontime_clocks_green_digital_inventory.png b/ontime_clocks/textures/ontime_clocks_green_digital_inventory.png index 2bf9043..5bd3d60 100644 Binary files a/ontime_clocks/textures/ontime_clocks_green_digital_inventory.png and b/ontime_clocks/textures/ontime_clocks_green_digital_inventory.png differ diff --git a/ontime_clocks/tools/updatepo.sh b/ontime_clocks/tools/updatepo.sh deleted file mode 100755 index feb2504..0000000 --- a/ontime_clocks/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 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 . --]] -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 . - --- 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 , 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 \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) , 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 \n" -"Language-Team: Malay \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 , 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 \n" -"Language-Team: LANGUAGE \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 . --]] -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 diff --git a/signs_api/init.lua b/signs_api/init.lua index 1bd00d6..325ba78 100644 --- a/signs_api/init.lua +++ b/signs_api/init.lua @@ -22,10 +22,9 @@ signs_api = {} signs_api.name = minetest.get_current_modname() signs_api.path = minetest.get_modpath(signs_api.name) --- Load support for intllib. -local S, NS = dofile(signs_api.path.."/intllib.lua") -signs_api.intllib = S -local F = function(...) return minetest.formspec_escape(S(...)) end +-- Translation support +local S = minetest.get_translator(signs_api.name) +local FS = function(...) return minetest.formspec_escape(S(...)) end function signs_api.set_display_text(pos, text, font) local meta = minetest.get_meta(pos) @@ -50,22 +49,22 @@ function signs_api.set_formspec(pos) local fs, y if maxlines == 1 then - fs = "field[0.5,0.7;5.5,1;display_text;"..F("Text").. + fs = "field[0.5,0.7;5.5,1;display_text;"..FS("Text").. ";${display_text}]" y = 1.2 else local extralabel = "" if maxlines then - extralabel = F(" (first %s lines only)"):format(maxlines) + extralabel = FS(" (first @1 lines only)", maxlines) end - fs = "textarea[0.5,0.7;5.5,2;display_text;"..F("Text").."".. + fs = "textarea[0.5,0.7;5.5,2;display_text;"..FS("Text").."".. extralabel..";${display_text}]" y = 2.4 end - fs = fs.."button[1,"..y..";2,1;font;"..F("Font").."]" - fs = fs.."button_exit[3,"..y..";2,1;ok;"..F("Write").."]" + fs = fs.."button[1,"..y..";2,1;font;"..FS("Font").."]" + fs = fs.."button_exit[3,"..y..";2,1;ok;"..FS("Write").."]" y = y + 0.8 fs = "size[6,"..y.."]"..default.gui_bg.. default.gui_bg_img..default.gui_slots..fs @@ -91,7 +90,6 @@ end function signs_api.on_place_direction(itemstack, placer, pointed_thing) local name = itemstack:get_name() local ndef = minetest.registered_nodes[name] - local restriction = display_api.is_rotation_restricted() local bdir = { x = pointed_thing.under.x - pointed_thing.above.x, @@ -102,33 +100,25 @@ function signs_api.on_place_direction(itemstack, placer, pointed_thing) local ndir, test - if ndef.paramtype2 == "facedir" then - -- If legacy mode, only accept upright nodes - if restriction and bdir.x == 0 and bdir.z == 0 then - -- Ceiling or floor pointed (facedir chosen from player dir) - ndir = minetest.dir_to_facedir({x=pdir.x, y=0, z=pdir.z}) - else - -- Wall pointed or no rotation restriction - ndir = minetest.dir_to_facedir(bdir, not restriction) - end + if ndef and ndef.paramtype2 == "facedir" then + -- Wall pointed + ndir = minetest.dir_to_facedir(bdir, true) test = { [0]=-pdir.x, pdir.z, pdir.x, -pdir.z, -pdir.x, [8]=pdir.x } end - if ndef.paramtype2 == "wallmounted" then + if ndef and ndef.paramtype2 == "wallmounted" then ndir = minetest.dir_to_wallmounted(bdir) - -- If legacy mode, only accept upright nodes - if restriction and (ndir == 0 or ndir == 1) then - ndir = minetest.dir_to_wallmounted({x=pdir.x, y=0, z=pdir.z}) - end test = { [0]=-pdir.x, -pdir.x, pdir.z, -pdir.z, -pdir.x, pdir.x} end -- Only for direction signs -- TODO:Maybe improve ground and ceiling placement in every directions - if ndef.signs_other_dir then - if test[ndir] > 0 then + if ndef and ndef.signs_other_dir then + if not test[ndir] then -- https://github.com/pyrollo/display_modpack/issues/48 + return itemstack + elseif test[ndir] > 0 then itemstack:set_name(ndef.signs_other_dir) end itemstack = minetest.item_place(itemstack, placer, pointed_thing, ndir) @@ -141,13 +131,12 @@ function signs_api.on_place_direction(itemstack, placer, pointed_thing) end -- Handles screwdriver rotation --- (see "if" block below for rotation restriction mode). signs_api.on_rotate = function(pos, node, player, mode, new_param2) -- If rotation mode is 1 and sign is directional, swap direction between -- each rotation. if mode == 1 then local ndef = minetest.registered_nodes[node.name] - if ndef.signs_other_dir then + if ndef and ndef.signs_other_dir then -- Switch direction node = {name = ndef.signs_other_dir, param1 = node.param1, param2 = node.param2} @@ -165,25 +154,6 @@ signs_api.on_rotate = function(pos, node, player, mode, new_param2) return display_api.on_rotate(pos, node, player, mode, new_param2) end --- Legacy mode with rotation restriction --- TODO:When MT < 5.0 no more in use, to be removed -if display_api.is_rotation_restricted() then - signs_api.on_rotate = function(pos, node, player, mode, new_param2) - -- If rotation mode is 2 and sign is directional, swap direction. - -- Otherwise use display_api's on_rotate function. - if mode == 2 then - local ndef = minetest.registered_nodes[node.name] - if ndef.signs_other_dir then - minetest.swap_node(pos, {name = ndef.signs_other_dir, - param1 = node.param1, param2 = node.param2}) - display_api.update_entities(pos) - return true - end - end - return display_api.on_rotate(pos, node, player, mode, new_param2) - end -end - function signs_api.register_sign(mod, name, model) -- Default fields local fields = { @@ -212,7 +182,7 @@ function signs_api.register_sign(mod, name, model) on_construct = function(pos) local ndef = minetest.registered_nodes[minetest.get_node(pos).name] local meta = minetest.get_meta(pos) - meta:set_string("font", ndef.display_entities.font_name or + meta:set_string("font", ndef and ndef.display_entities.font_name or font_api.get_default_font_name()) signs_api.set_formspec(pos) display_api.on_construct(pos) diff --git a/signs_api/intllib.lua b/signs_api/intllib.lua deleted file mode 100644 index 6669d72..0000000 --- a/signs_api/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/signs_api/locale/fr.po b/signs_api/locale/fr.po deleted file mode 100644 index e490d1b..0000000 --- a/signs_api/locale/fr.po +++ /dev/null @@ -1,49 +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. -# -msgid "" -msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-02-01 05:56+0100\n" -"PO-Revision-Date: 2017-05-08 07:08+0200\n" -"Last-Translator: Peppy \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 -msgid "Text" -msgstr "Texte" - -#: common.lua -msgid "Write" -msgstr "Écrire" - -#: common.lua -#, lua-format -msgid " (first %s lines only)" -msgstr " (uniquement les %s premières lignes)" - -#~ msgid "Title" -#~ msgstr "Titre" - -#~ msgid "Close" -#~ msgstr "Fermer" - -#~ msgid "(right-click to read more text)" -#~ msgstr "(Clic-droit pour afficher le texte entier)" - -#~ msgid "Wooden direction sign" -#~ msgstr "Panneau de direction en bois" - -#~ msgid "Poster" -#~ msgstr "Affiche" - -#~ msgid "Textd" -#~ msgstr "Texte" diff --git a/signs_api/locale/ms.po b/signs_api/locale/ms.po deleted file mode 100644 index 0d90222..0000000 --- a/signs_api/locale/ms.po +++ /dev/null @@ -1,46 +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) , 2017. -msgid "" -msgstr "" -"Project-Id-Version: Display Modpack\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-02-01 05:56+0100\n" -"PO-Revision-Date: 2020-07-05 11:31+0000\n" -"Last-Translator: Yaya MNH48 \n" -"Language-Team: Malay \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 -msgid "Text" -msgstr "Teks" - -#: common.lua -msgid "Write" -msgstr "Tulis" - -#: common.lua -#, lua-format -msgid " (first %s lines only)" -msgstr " (%s baris pertama sahaja)" - -#~ msgid "Title" -#~ msgstr "Tajuk" - -#~ msgid "Close" -#~ msgstr "Tutup" - -#~ msgid "(right-click to read more text)" -#~ msgstr "(klik-kanan untuk baca teks penuh)" - -#~ msgid "Wooden direction sign" -#~ msgstr "Papan tanda arah kayu" - -#~ msgid "Poster" -#~ msgstr "Poster" diff --git a/signs_api/locale/signs_api.de.tr b/signs_api/locale/signs_api.de.tr new file mode 100644 index 0000000..12a389f --- /dev/null +++ b/signs_api/locale/signs_api.de.tr @@ -0,0 +1,5 @@ +# textdomain: signs_api +Text=Text + (first @1 lines only)= (nur die ersten @1 Zeilen) +Font=Schriftart +Write=Schreiben diff --git a/signs_api/locale/signs_api.fr.tr b/signs_api/locale/signs_api.fr.tr new file mode 100644 index 0000000..e47ecc9 --- /dev/null +++ b/signs_api/locale/signs_api.fr.tr @@ -0,0 +1,5 @@ +# textdomain: signs_api +Text=Texte + (first @1 lines only)= (uniquement les @1 premières lignes) +Font= +Write=Écrire diff --git a/signs_api/locale/signs_api.ms.tr b/signs_api/locale/signs_api.ms.tr new file mode 100644 index 0000000..76f95f1 --- /dev/null +++ b/signs_api/locale/signs_api.ms.tr @@ -0,0 +1,5 @@ +# textdomain: signs_api +Text=Teks + (first @1 lines only)= (@1 baris pertama sahaja) +Font= +Write=Tulis diff --git a/signs_api/locale/template.pot b/signs_api/locale/template.pot deleted file mode 100644 index 6004024..0000000 --- a/signs_api/locale/template.pot +++ /dev/null @@ -1,31 +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-02-01 05:56+0100\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" - -#: common.lua -msgid "Text" -msgstr "" - -#: common.lua -msgid "Write" -msgstr "" - -#: common.lua -#, lua-format -msgid " (first %s lines only)" -msgstr "" diff --git a/signs_api/locale/template.txt b/signs_api/locale/template.txt new file mode 100644 index 0000000..a3993b2 --- /dev/null +++ b/signs_api/locale/template.txt @@ -0,0 +1,5 @@ +# textdomain: signs_api +Text= + (first @1 lines only)= +Font= +Write= diff --git a/signs_api/mod.conf b/signs_api/mod.conf index f4f91b7..cdc6a10 100644 --- a/signs_api/mod.conf +++ b/signs_api/mod.conf @@ -2,4 +2,3 @@ name = signs_api title = Signs API description = A library providing various helper functions for registereing signs with text display depends = default,display_api,font_api -optional_depends = intllib diff --git a/signs_api/tools/updatepo.sh b/signs_api/tools/updatepo.sh deleted file mode 100755 index feb2504..0000000 --- a/signs_api/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 diff --git a/signs_road/crafts.lua b/signs_road/crafts.lua index 314a91a..e20f3a2 100644 --- a/signs_road/crafts.lua +++ b/signs_road/crafts.lua @@ -195,7 +195,8 @@ minetest.register_craft({ }) minetest.register_craft({ - type = "shapeless", - output = 'signs_road:large_street_sign', - recipe = {'signs_road:white_street_sign', 'signs_road:white_street_sign', 'signs_road:white_street_sign', 'signs_road:white_street_sign'}, + type = "shapeless", + output = 'signs_road:large_street_sign', + recipe = {'signs_road:white_street_sign', 'signs_road:white_street_sign', + 'signs_road:white_street_sign', 'signs_road:white_street_sign'}, }) diff --git a/signs_road/init.lua b/signs_road/init.lua index cd95c6c..67991ae 100644 --- a/signs_road/init.lua +++ b/signs_road/init.lua @@ -23,9 +23,8 @@ signs_road = {} signs_road.name = minetest.get_current_modname() signs_road.path = minetest.get_modpath(signs_road.name) --- Load support for intllib. -local S, NS = dofile(signs_road.path.."/intllib.lua") -signs_road.intllib = S +-- Translation support +signs_road.S = minetest.get_translator(signs_road.name) dofile(signs_road.path.."/nodes.lua") dofile(signs_road.path.."/crafts.lua") diff --git a/signs_road/intllib.lua b/signs_road/intllib.lua deleted file mode 100644 index 6669d72..0000000 --- a/signs_road/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/signs_road/locale/fr.po b/signs_road/locale/fr.po deleted file mode 100644 index 833f115..0000000 --- a/signs_road/locale/fr.po +++ /dev/null @@ -1,56 +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. -# -msgid "" -msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-08-26 11:26+0200\n" -"PO-Revision-Date: 2017-05-08 06:40+0200\n" -"Last-Translator: Peppy \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" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#: nodes.lua -msgid "Blue street sign" -msgstr "Plaque de rue bleue" - -#: nodes.lua -msgid "Red and white town sign" -msgstr "Panneau de ville rouge et blanc" - -#: nodes.lua -msgid "White street sign" -msgstr "Panneau blanc" - -#: nodes.lua -msgid "Green street sign" -msgstr "Panneau vert" - -#: nodes.lua -msgid "Yellow street sign" -msgstr "Panneau jaune" - -#: nodes.lua -msgid "Black direction sign" -msgstr "Panneau de direction noir" - -#: nodes.lua -msgid "Green direction sign" -msgstr "Panneau de direction vert" - -#: nodes.lua -msgid "Yellow direction sign" -msgstr "Panneau de direction jaune" - -#: nodes.lua -msgid "White direction sign" -msgstr "Panneau de direction blanc" - diff --git a/signs_road/locale/ms.po b/signs_road/locale/ms.po deleted file mode 100644 index 30ba158..0000000 --- a/signs_road/locale/ms.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. -# Yaya (Nurul Azeera Hidayah @ Muhammad Nur Hidayat) , 2017. -msgid "" -msgstr "" -"Project-Id-Version: Display Modpack\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-08-26 11:28+0200\n" -"PO-Revision-Date: 2020-07-05 11:32+0000\n" -"Last-Translator: Yaya MNH48 \n" -"Language-Team: Malay \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" - -#: nodes.lua -msgid "Blue street sign" -msgstr "Papan tanda jalan biru" - -#: nodes.lua -msgid "Red and white town sign" -msgstr "Papan tanda bandar merah dan putih" - -#: nodes.lua -msgid "White street sign" -msgstr "Papan tanda jalan putih" - -#: nodes.lua -msgid "Green street sign" -msgstr "Papan tanda jalan hijau" - -#: nodes.lua -msgid "Yellow street sign" -msgstr "Papan tanda jalan kuning" - -#: nodes.lua -msgid "Black direction sign" -msgstr "Papan tanda arah hitam" - -#: nodes.lua -msgid "Green direction sign" -msgstr "Papan tanda arah hijau" - -#: nodes.lua -msgid "Yellow direction sign" -msgstr "Papan tanda arah kuning" - -#: nodes.lua -msgid "White direction sign" -msgstr "Papan tanda arah putih" diff --git a/signs_road/locale/signs_road.de.tr b/signs_road/locale/signs_road.de.tr new file mode 100644 index 0000000..324ace2 --- /dev/null +++ b/signs_road/locale/signs_road.de.tr @@ -0,0 +1,15 @@ +# textdomain: signs_road +Blue street sign=Blaues Straßenschild +Large banner=Großes Banner +Red and white town sign=Rot-weißes Ortsschild +White street sign=Weißes Straßenschild +Blue road sign=Blaues Straßenschild +Green road sign=Grünes Straßenschild +Yellow road sign=Gelbes Straßenschild +Red road sign=Rotes Straßenschild +Black direction sign=Schwarzer Wegweiser +White direction sign=Weißer Wegweiser +Blue direction sign=Blauer Wegweiser +Green direction sign=Grüner Wegweiser +Yellow direction sign=Gelber Wegweiser +Red direction sign=Roter Wegweiser diff --git a/signs_road/locale/signs_road.fr.tr b/signs_road/locale/signs_road.fr.tr new file mode 100644 index 0000000..221a511 --- /dev/null +++ b/signs_road/locale/signs_road.fr.tr @@ -0,0 +1,15 @@ +# textdomain: signs_road +Blue street sign=Plaque de rue bleue +Large banner= +Red and white town sign=Panneau de ville rouge et blanc +White street sign=Panneau blanc +Blue road sign= +Green road sign= +Yellow road sign= +Red road sign= +Black direction sign=Panneau de direction noir +White direction sign=Panneau de direction blanc +Blue direction sign= +Green direction sign=Panneau de direction vert +Yellow direction sign=Panneau de direction jaune +Red direction sign= diff --git a/signs_road/locale/signs_road.ms.tr b/signs_road/locale/signs_road.ms.tr new file mode 100644 index 0000000..90e5bec --- /dev/null +++ b/signs_road/locale/signs_road.ms.tr @@ -0,0 +1,15 @@ +# textdomain: signs_road +Blue street sign=Papan tanda jalan biru +Large banner= +Red and white town sign=Papan tanda bandar merah dan putih +White street sign=Papan tanda jalan putih +Blue road sign= +Green road sign= +Yellow road sign= +Red road sign= +Black direction sign=Papan tanda arah hitam +White direction sign=Papan tanda arah putih +Blue direction sign= +Green direction sign=Papan tanda arah hijau +Yellow direction sign=Papan tanda arah kuning +Red direction sign= diff --git a/signs_road/locale/template.pot b/signs_road/locale/template.pot deleted file mode 100644 index b15ce94..0000000 --- a/signs_road/locale/template.pot +++ /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 , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-08-26 11:28+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" - -#: nodes.lua -msgid "Blue street sign" -msgstr "" - -#: nodes.lua -msgid "Red and white town sign" -msgstr "" - -#: nodes.lua -msgid "White street sign" -msgstr "" - -#: nodes.lua -msgid "Green street sign" -msgstr "" - -#: nodes.lua -msgid "Yellow street sign" -msgstr "" - -#: nodes.lua -msgid "Black direction sign" -msgstr "" - -#: nodes.lua -msgid "Green direction sign" -msgstr "" - -#: nodes.lua -msgid "Yellow direction sign" -msgstr "" - -#: nodes.lua -msgid "White direction sign" -msgstr "" diff --git a/signs_road/locale/template.txt b/signs_road/locale/template.txt new file mode 100644 index 0000000..3a2611b --- /dev/null +++ b/signs_road/locale/template.txt @@ -0,0 +1,15 @@ +# textdomain: signs_road +Blue street sign= +Large banner= +Red and white town sign= +White street sign= +Blue road sign= +Green road sign= +Yellow road sign= +Red road sign= +Black direction sign= +White direction sign= +Blue direction sign= +Green direction sign= +Yellow direction sign= +Red direction sign= diff --git a/signs_road/mod.conf b/signs_road/mod.conf index ae93f5a..6db7bcf 100644 --- a/signs_road/mod.conf +++ b/signs_road/mod.conf @@ -2,4 +2,3 @@ name = signs_road title = Signs Road description = Various road signs with text display using signs_api depends = default,dye,signs_api -optional_depends = intllib diff --git a/signs_road/nodes.lua b/signs_road/nodes.lua index 74eca23..1fc8061 100644 --- a/signs_road/nodes.lua +++ b/signs_road/nodes.lua @@ -19,7 +19,7 @@ along with signs_road. If not, see . --]] -local S = signs_road.intllib +local S = signs_road.S local models = { blue_street_sign = { diff --git a/signs_road/tools/updatepo.sh b/signs_road/tools/updatepo.sh deleted file mode 100755 index feb2504..0000000 --- a/signs_road/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 diff --git a/steles/config.lua b/steles/config.lua index 551429d..e53d9be 100644 --- a/steles/config.lua +++ b/steles/config.lua @@ -18,13 +18,13 @@ along with steles. If not, see . --]] -local S = steles.intllib +local S = steles.S steles.materials = { - 'default:stone', - 'default:sandstone', + 'default:stone', + 'default:sandstone', 'default:desert_stone', - 'technic:marble', + 'technic:marble', 'technic:granite', } diff --git a/steles/init.lua b/steles/init.lua index e5d2430..43d9eed 100644 --- a/steles/init.lua +++ b/steles/init.lua @@ -22,9 +22,8 @@ steles = {} steles.name = minetest.get_current_modname() steles.path = minetest.get_modpath(steles.name) --- Load support for intllib. -local S, NS = dofile(steles.path.."/intllib.lua") -steles.intllib = S +-- Translation support +steles.S = minetest.get_translator(steles.name) dofile(steles.path.."/config.lua") dofile(steles.path.."/nodes.lua") diff --git a/steles/intllib.lua b/steles/intllib.lua deleted file mode 100644 index 6669d72..0000000 --- a/steles/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/steles/locale/fr.po b/steles/locale/fr.po deleted file mode 100644 index 1785d8a..0000000 --- a/steles/locale/fr.po +++ /dev/null @@ -1,47 +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. -# -msgid "" -msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-08-05 10:06+0200\n" -"PO-Revision-Date: 2017-08-05 09:03+0200\n" -"Last-Translator: fat115 \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" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#: config.lua -msgid "Stone Stele" -msgstr "Stèle en pierre" - -#: config.lua -msgid "Sandstone Stele" -msgstr "Stèle en grès" - -#: config.lua -msgid "Desert Stone Stele" -msgstr "Stèle en pierre du désert" - -#: config.lua -msgid "Marble Stele" -msgstr "Stèle en marbre" - -#: config.lua -msgid "Granite Stele" -msgstr "Stèle en granit" - -#: nodes.lua -msgid "Displayed text (3 lines max)" -msgstr "Texte à afficher (3 lignes maxi.)" - -#: nodes.lua -msgid "Write" -msgstr "Écrire" diff --git a/steles/locale/ms.po b/steles/locale/ms.po deleted file mode 100644 index 1c58983..0000000 --- a/steles/locale/ms.po +++ /dev/null @@ -1,46 +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) , 2017. -msgid "" -msgstr "" -"Project-Id-Version: Display Modpack\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-08-26 11:29+0200\n" -"PO-Revision-Date: 2020-07-05 11:34+0000\n" -"Last-Translator: Yaya MNH48 \n" -"Language-Team: Malay \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" - -#: config.lua -msgid "Stone Stele" -msgstr "Tulisan Batu" - -#: config.lua -msgid "Sandstone Stele" -msgstr "Tulisan Batu Pasir" - -#: config.lua -msgid "Desert Stone Stele" -msgstr "Tulisan Batu Gurun" - -#: config.lua -msgid "Marble Stele" -msgstr "Tulisan Marmar" - -#: config.lua -msgid "Granite Stele" -msgstr "Tulisan Granit" - -#: nodes.lua -msgid "Displayed text (3 lines max)" -msgstr "Teks terpapar (maksimum 3 baris)" - -#: nodes.lua -msgid "Write" -msgstr "Tulis" diff --git a/steles/locale/steles.de.tr b/steles/locale/steles.de.tr new file mode 100644 index 0000000..10c32d6 --- /dev/null +++ b/steles/locale/steles.de.tr @@ -0,0 +1,9 @@ +# textdomain: steles +Stone Stele=Stein Stele +Sandstone Stele=Sandstein Stele +Desert Stone Stele=Wüstenstein Stele +Marble Stele=Mamor Stele +Granite Stele=Granit Stele +Displayed text (3 lines max)=Angezeigter Text (max. 3 Zeilen) +Font=Schriftart +Write=Schreiben diff --git a/steles/locale/steles.fr.tr b/steles/locale/steles.fr.tr new file mode 100644 index 0000000..7b0f91d --- /dev/null +++ b/steles/locale/steles.fr.tr @@ -0,0 +1,9 @@ +# textdomain: steles +Stone Stele=Stèle en pierre +Sandstone Stele=Stèle en grès +Desert Stone Stele=Stèle en pierre du désert +Marble Stele=Stèle en marbre +Granite Stele=Stèle en granit +Displayed text (3 lines max)= +Font= +Write= diff --git a/steles/locale/steles.ms.tr b/steles/locale/steles.ms.tr new file mode 100644 index 0000000..38d3b15 --- /dev/null +++ b/steles/locale/steles.ms.tr @@ -0,0 +1,9 @@ +# textdomain: steles +Stone Stele=Tulisan Batu +Sandstone Stele=Tulisan Batu Pasir +Desert Stone Stele=Tulisan Batu Gurun +Marble Stele=Tulisan Marmar +Granite Stele=Tulisan Granit +Displayed text (3 lines max)= +Font= +Write= diff --git a/steles/locale/template.pot b/steles/locale/template.pot deleted file mode 100644 index 0144ace..0000000 --- a/steles/locale/template.pot +++ /dev/null @@ -1,46 +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: 2017-08-26 11:29+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" - -#: config.lua -msgid "Stone Stele" -msgstr "" - -#: config.lua -msgid "Sandstone Stele" -msgstr "" - -#: config.lua -msgid "Desert Stone Stele" -msgstr "" - -#: config.lua -msgid "Marble Stele" -msgstr "" - -#: config.lua -msgid "Granite Stele" -msgstr "" - -#: nodes.lua -msgid "Displayed text (3 lines max)" -msgstr "" - -#: nodes.lua -msgid "Write" -msgstr "" diff --git a/steles/locale/template.txt b/steles/locale/template.txt new file mode 100644 index 0000000..a8925b2 --- /dev/null +++ b/steles/locale/template.txt @@ -0,0 +1,9 @@ +# textdomain: steles +Stone Stele= +Sandstone Stele= +Desert Stone Stele= +Marble Stele= +Granite Stele= +Displayed text (3 lines max)= +Font= +Write= diff --git a/steles/mod.conf b/steles/mod.conf index b3d5264..cfbc038 100644 --- a/steles/mod.conf +++ b/steles/mod.conf @@ -2,4 +2,4 @@ name = steles title = Steles description = Stone steles with text display on them depends = default,display_api,font_api -optional_depends = intllib,technic +optional_depends = technic diff --git a/steles/nodes.lua b/steles/nodes.lua index 2245e20..a2aaa7d 100644 --- a/steles/nodes.lua +++ b/steles/nodes.lua @@ -18,8 +18,8 @@ along with steles. If not, see . --]] -local S = steles.intllib -local F = function(...) return minetest.formspec_escape(S(...)) end +local S = steles.S +local FS = function(...) return minetest.formspec_escape(S(...)) end display_api.register_display_entity("steles:text") @@ -69,8 +69,8 @@ for i, material in ipairs(steles.materials) do button[1,3;2,1;font;%s] button_exit[3,3;2,1;ok;%s]]=], default.gui_bg, default.gui_bg_img, default.gui_slots, - F("Displayed text (3 lines max)"), - F("Font"), F("Write"))) + FS("Displayed text (3 lines max)"), + FS("Font"), FS("Write"))) display_api.on_construct(pos) end, on_destruct = display_api.on_destruct, diff --git a/steles/tools/updatepo.sh b/steles/tools/updatepo.sh deleted file mode 100755 index feb2504..0000000 --- a/steles/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