From cf62312bbd3d1121fa9d6d6b71162cdd326e3add Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Fri, 17 Jan 2025 23:13:51 -0800 Subject: [PATCH] Use Luanti's built-in translator instead of deprecated intllib mod --- README | 1 - core.lua | 10 ++-------- depends.txt | 1 - formspecs.lua | 10 ++-------- hud.lua | 10 ++-------- locale/de.txt | 20 -------------------- locale/quests.de.tr | 22 ++++++++++++++++++++++ locale/template.txt | 42 ++++++++++++++++++++++-------------------- mod.conf | 2 +- 9 files changed, 51 insertions(+), 67 deletions(-) delete mode 100644 locale/de.txt create mode 100644 locale/quests.de.tr diff --git a/README b/README index 3857920..4fa8429 100644 --- a/README +++ b/README @@ -3,7 +3,6 @@ quests 1.1 quests is a simple quest framework for Luanti (Minetest) that lets you define your own quests and handles the representation. Dependencies: -intllib (optional) unified_inventory or inventory_plus (optional) central_message (optional) diff --git a/core.lua b/core.lua index 5ef629e..1d614c5 100644 --- a/core.lua +++ b/core.lua @@ -1,11 +1,5 @@ --- Boilerplate to support localized strings if intllib mod is installed. -local S -if core.get_modpath("intllib") then - S = intllib.Getter() -else - -- If you don't use insertions (@1, @2, etc) you can use this: - S = function(s) return s end -end + +local S = core.get_translator("quests") -- registers a quest for later use diff --git a/depends.txt b/depends.txt index 0650d90..0699494 100644 --- a/depends.txt +++ b/depends.txt @@ -1,4 +1,3 @@ -intllib? unified_inventory? inventory_plus? central_message? diff --git a/formspecs.lua b/formspecs.lua index 0ffae26..cbaa724 100644 --- a/formspecs.lua +++ b/formspecs.lua @@ -1,11 +1,5 @@ --- Boilerplate to support localized strings if intllib mod is installed. -local S -if core.get_modpath("intllib") then - S = intllib.Getter() -else - -- If you don't use insertions (@1, @2, etc) you can use this: - S = function(s) return s end -end + +local S = core.get_translator("quests") -- construct the questlog diff --git a/hud.lua b/hud.lua index 95806af..a396d3d 100644 --- a/hud.lua +++ b/hud.lua @@ -1,11 +1,5 @@ --- Boilerplate to support localized strings if intllib mod is installed. -local S -if core.get_modpath("intllib") then - S = intllib.Getter() -else - -- If you don't use insertions (@1, @2, etc) you can use this: - S = function(s) return s end -end + +local S = core.get_translator("quests") local show_max = 10 -- the maximum visible quests. diff --git a/locale/de.txt b/locale/de.txt deleted file mode 100644 index 10ca0d5..0000000 --- a/locale/de.txt +++ /dev/null @@ -1,20 +0,0 @@ -missing description = fehlende Beschreibung -missing title = fehlender Titel -Quests: = Quests: -No more Quests = Keine weiteren Quests -Abort quest = Quest abbrechen -Configure = Konfigurieren -Enable HUD = HUD einschalten -Autohide HUD = HUD automatisch verstecken -Exit = Verlassen -Failed quests = Gescheiterte Quests -Finished quests = Beendete Quests -Info = Info -No quest specified. = Keine Quest ausgewählt. -Open quests = Offene Quests -Return = Zurück -Show all open quests = Zeige alle offenen Quests -There are no quests in this category. = Es gibt keine Quests in dieser Kategorie. -New quest: = Neue Quest: -Quest completed: = Quest beendet: -Quest failed: = Quest gescheitert: diff --git a/locale/quests.de.tr b/locale/quests.de.tr new file mode 100644 index 0000000..679ef97 --- /dev/null +++ b/locale/quests.de.tr @@ -0,0 +1,22 @@ +# textdomain:quests + +missing description=fehlende Beschreibung +missing title=fehlender Titel +#Quests:= +No more Quests=Keine weiteren Quests +Abort quest=Quest abbrechen +Configure=Konfigurieren +Enable HUD=HUD einschalten +Autohide HUD=HUD automatisch verstecken +Exit=Verlassen +Failed quests=Gescheiterte Quests +Finished quests=Beendete Quests +Info=Info +No quest specified.=Keine Quest ausgewählt. +Open quests=Offene Quests +Return=Zurück +Show all open quests=Zeige alle offenen Quests +There are no quests in this category.=Es gibt keine Quests in dieser Kategorie. +New quest:=Neue Quest: +Quest completed:=Quest beendet: +Quest failed:=Quest gescheitert: diff --git a/locale/template.txt b/locale/template.txt index 76e1b77..2c14796 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -1,20 +1,22 @@ -missing description = -missing title = -Quests: = -No more Quests = -Abort quest = -Configure = -Enable HUD = -Autohide HUD = -Exit = -Failed quests = -Finished quests = -Info = -No quest specified. = -Open quests = -Return = -Show all open quests = -There are no quests in this category. = -New quest: = -Quest completed: = -Quest failed: = +# textdomain:quests + +missing description= +missing title= +Quests:= +No more Quests= +Abort quest= +Configure= +Enable HUD= +Autohide HUD= +Exit= +Failed quests= +Finished quests= +Info= +No quest specified.= +Open quests= +Return= +Show all open quests= +There are no quests in this category.= +New quest:= +Quest completed:= +Quest failed:= diff --git a/mod.conf b/mod.conf index 0fc125f..3db324b 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ name = quests description = Simple framework to define quests. author = TeTpaAka -optional_depends = intllib, unified_inventory, inventory_plus, central_message +optional_depends = unified_inventory, inventory_plus, central_message