switch to native translator for legacy nodes

This commit is contained in:
FaceDeer 2020-02-17 22:31:58 -07:00
parent 4b0ae3bce7
commit 2ad5864a11
8 changed files with 19 additions and 125 deletions

View File

@ -1,45 +0,0 @@
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.
-- Get the latest version of this file at:
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
local function format(str, ...)
local args = { ... }
local function repl(escape, open, num, close)
if escape == "" then
local replacement = tostring(args[tonumber(num)])
if open == "" then
replacement = replacement..close
end
return replacement
else
return "@"..open..num..close
end
end
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end
local gettext, ngettext
if minetest.get_modpath("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
gettext, ngettext = intllib.make_gettext_pair()
else
-- Old method using text files.
gettext = intllib.Getter()
end
end
-- Fill in missing functions.
gettext = gettext or function(msgid, ...)
return format(msgid, ...)
end
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
return format(n==1 and msgid or msgid_plural, ...)
end
return gettext, ngettext

View File

@ -5,8 +5,11 @@ local enable_legacy = minetest.settings:get_bool("subterrane_enable_legacy_drips
if enable_legacy then
local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
subterrane.register_stalagmite_nodes("subterrane:dry_stal", {
description = "Dry Dripstone",
description = S("Dry Dripstone"),
tiles = {
"default_stone.png^[brighten",
},
@ -15,7 +18,7 @@ subterrane.register_stalagmite_nodes("subterrane:dry_stal", {
})
minetest.register_node("subterrane:dry_flowstone", {
description = "Dry Flowstone",
description = S("Dry Flowstone"),
tiles = {"default_stone.png^[brighten"},
groups = {cracky = 3, stone = 1},
drop = 'default:cobble',
@ -25,7 +28,7 @@ minetest.register_node("subterrane:dry_flowstone", {
-----------------------------------------------
subterrane.register_stalagmite_nodes("subterrane:wet_stal", {
description = "Wet Dripstone",
description = S("Wet Dripstone"),
tiles = {
"default_stone.png^[brighten^subterrane_dripstone_streaks.png",
},
@ -34,7 +37,7 @@ subterrane.register_stalagmite_nodes("subterrane:wet_stal", {
}, "subterrane:dry_stal")
minetest.register_node("subterrane:wet_flowstone", {
description = "Wet Flowstone",
description = S("Wet Flowstone"),
tiles = {"default_stone.png^[brighten^subterrane_dripstone_streaks.png"},
groups = {cracky = 3, stone = 1, subterrane_wet_dripstone = 1},
drop = 'default:cobble',

View File

@ -1,34 +0,0 @@
# German translations for PACKAGE package.
# Copyright (C) 2017 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# LNJ <git@lnj.li>, 2017.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-14 20:07+0200\n"
"PO-Revision-Date: 2017-04-14 20:08+0200\n"
"Last-Translator: LNJ <git@lnj.li>\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: nodes.lua
msgid "Dry Dripstone"
msgstr "Trockener Tropfstein"
#: nodes.lua
msgid "Dry Flowstone"
msgstr "Trockener Fließstein"
#: nodes.lua
msgid "Wet Dripstone"
msgstr "Nasser Tropfstein"
#: nodes.lua
msgid "Wet Flowstone"
msgstr "Nasser Fließstein"

7
locale/subterrane.de.tr Normal file
View File

@ -0,0 +1,7 @@
# textdomain: subterrane
Dry Dripstone=Trockener Tropfstein
Dry Flowstone=Trockener Fließstein
Wet Dripstone=Nasser Tropfstein
Wet Flowstone=Nasser Fließstein
##### not used anymore #####

View File

@ -1,34 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-14 20:13+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: nodes.lua
msgid "Dry Dripstone"
msgstr ""
#: nodes.lua
msgid "Dry Flowstone"
msgstr ""
#: nodes.lua
msgid "Wet Dripstone"
msgstr ""
#: nodes.lua
msgid "Wet Flowstone"
msgstr ""

4
locale/template.txt Normal file
View File

@ -0,0 +1,4 @@
Dry Dripstone=
Dry Flowstone=
Wet Dripstone=
Wet Flowstone=

View File

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

View File

@ -1,4 +1,3 @@
name = subterrane
description = A mapgen helper mod that facilitates the creation of vast underground caverns
depends = default, mapgen_helper
optional_depends = intllib
depends = default, mapgen_helper