From fd2d18501ed80fe582279ccf789a6fd090db7014 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Sun, 16 Feb 2020 21:59:09 -0700 Subject: [PATCH] switch to internal translator --- depends.txt | 3 +- init.lua | 4 +- intllib.lua | 45 ----------------------- locale/template.pot | 89 --------------------------------------------- locale/template.txt | 14 +++++++ locale/update.bat | 6 --- mod.conf | 5 ++- 7 files changed, 20 insertions(+), 146 deletions(-) delete mode 100644 intllib.lua delete mode 100644 locale/template.pot create mode 100644 locale/template.txt delete mode 100644 locale/update.bat diff --git a/depends.txt b/depends.txt index e5122e9..92dd391 100644 --- a/depends.txt +++ b/depends.txt @@ -1,3 +1,2 @@ default -doc? -intllib? \ No newline at end of file +doc? \ No newline at end of file diff --git a/init.lua b/init.lua index 4096f06..66966f2 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,4 @@ --- internationalization boilerplate -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator(minetest.get_current_modname()) local print_settingtypes = false local CONFIG_FILE_PREFIX = "airtanks_" diff --git a/intllib.lua b/intllib.lua deleted file mode 100644 index 6669d72..0000000 --- a/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/locale/template.pot b/locale/template.pot deleted file mode 100644 index ac650dd..0000000 --- a/locale/template.pot +++ /dev/null @@ -1,89 +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-03-27 14:50-0600\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:32 -msgid "A tank containing compressed air." -msgstr "" - -#: init.lua:33 -#, lua-format -msgid "" -"If you're underwater and you're running out of breath, wield this item and " -"use it to replenish 5 bubbles on your breath bar. When fully charged this " -"tank has %i uses before it becomes empty." -msgstr "" - -#: init.lua:35 -msgid "A compressed air tank, currently empty." -msgstr "" - -#: init.lua:36 -#, lua-format -msgid "" -"This tank can be recharged with compressed air by using it on a compressor " -"block. When fully charged this tank has %i uses before it becomes empty." -msgstr "" - -#: init.lua:38 -msgid "A machine for filling air tanks with compressed air." -msgstr "" - -#: init.lua:39 -msgid "" -"Place this machine somewhere that it has access to air (one of its adjacent " -"nodes needs to have air in it). When you click on it with an empty or partly-" -"empty compressed air tank the tank will be refilled." -msgstr "" - -#: init.lua:41 -msgid "A breathing tube to allow automatic hands-free use of air tanks." -msgstr "" - -#: init.lua:42 -msgid "" -"If this item is present in your quick-use inventory then whenever your " -"breath bar goes below 5 it will automatically make use of any air tanks that " -"are present in your quick-use inventory to replenish your breath supply. " -"Note that it will not use air tanks that are present elsewhere in your " -"inventory, only ones in your quick-use bar." -msgstr "" - -#: init.lua:105 -msgid "Empty @1" -msgstr "" - -#: init.lua:152 -msgid "Steel Air Tank" -msgstr "" - -#: init.lua:153 -msgid "Copper Air Tank" -msgstr "" - -#: init.lua:154 -msgid "Bronze Air Tank" -msgstr "" - -#: init.lua:167 -msgid "Air Compressor" -msgstr "" - -#: init.lua:203 -msgid "Breathing Tube" -msgstr "" diff --git a/locale/template.txt b/locale/template.txt new file mode 100644 index 0000000..e9648b3 --- /dev/null +++ b/locale/template.txt @@ -0,0 +1,14 @@ +A breathing tube to allow automatic hands-free use of air tanks.= +A compressed air tank, currently empty.= +A machine for filling air tanks with compressed air.= +A tank containing compressed air.= +Air Compressor= +Breathing Tube= +Bronze Air Tank= +Copper Air Tank= +Empty @1= +If this item is present in your quick-use inventory then whenever your breath bar goes below 5 it will automatically make use of any air tanks that are present in your quick-use inventory to replenish your breath supply. Note that it will not use air tanks that are present elsewhere in your inventory, only ones in your quick-use bar.= +If you're underwater and you're running out of breath, wield this item and use it to replenish 5 bubbles on your breath bar. When fully charged this tank has %i uses before it becomes empty.= +Place this machine somewhere that it has access to air (one of its adjacent nodes needs to have air in it). When you click on it with an empty or partly-empty compressed air tank the tank will be refilled.= +Steel Air Tank= +This tank can be recharged with compressed air by using it on a compressor block. When fully charged this tank has %i uses before it becomes empty.= \ No newline at end of file diff --git a/locale/update.bat b/locale/update.bat deleted file mode 100644 index e87d44c..0000000 --- a/locale/update.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off -setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION -cd .. -set LIST= -for /r %%X in (*.lua) do set LIST=!LIST! %%X -..\intllib\tools\xgettext.bat %LIST% \ No newline at end of file diff --git a/mod.conf b/mod.conf index 79891b2..762f446 100644 --- a/mod.conf +++ b/mod.conf @@ -1 +1,4 @@ -name = airtanks \ No newline at end of file +name = airtanks +description = Provides pressurized air tanks for extended underwater excursions +depends = default +optional_depends = doc \ No newline at end of file