switch to built-in translator, remove redundant chime sound

This commit is contained in:
FaceDeer 2020-02-16 01:27:19 -07:00
parent 5e02e17c83
commit 47f4a38257
10 changed files with 25 additions and 108 deletions

View File

@ -1,7 +1,6 @@
if magma_conduits.config.glowing_rock then
local modpath = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(modpath.."/intllib.lua")
local S = magma_conduits.S
local simple_copy
simple_copy = function(t)

View File

@ -1,6 +1,10 @@
magma_conduits = {}
local modpath = minetest.get_modpath(minetest.get_current_modname())
local modname = minetest.get_current_modname()
magma_conduits.S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname)
dofile(modpath.."/config.lua")
dofile(modpath.."/voxelarea_iterator.lua")
dofile(modpath.."/hot_rock.lua")

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

@ -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 <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-22 00:26-0600\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"
#: hot_rock.lua:7
msgid "Hot Cobble"
msgstr ""
#: hot_rock.lua:8
msgid "Hot stone riven with cracks and seeping traces of lava."
msgstr ""
#: hot_rock.lua:9
msgid ""
"When normal stone is heated by lava it is converted into this. Beware when "
"digging here!"
msgstr ""
#: hot_rock.lua:19
msgid "Hot Obsidian"
msgstr ""
#: hot_rock.lua:20
msgid "Obsidian heated to a dull red glow."
msgstr ""
#: hot_rock.lua:21
msgid ""
"When normal obsidian is heated by lava it is converted into this. Beware "
"when digging here!"
msgstr ""

12
locale/template.txt Normal file
View File

@ -0,0 +1,12 @@
Allows players to use a console command to find volcanoes=
Hot @1=
Hot Cobble=
Hot Obsidian=
Hot stone riven with cracks and seeping traces of lava.=
No volcanoes near @1=
Obsidian heated to a dull red glow.=
When normal obsidian is heated by lava it is converted into this. Beware when digging here!=
When normal stone is heated by lava it is converted into this. Beware when digging here!=
You need the findvolcano privilege to use this command.=
a volcano=
find the volcanoes near the player's map region, or in the map region containing pos if provided=

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,4 @@
name = magma_conduits
description = Removes default mapgen lava and adds widely-spaced volcanoes and lava "veins".
depends = default
optional_depends = namegen, intllib, doc, named_waypoints
optional_depends = namegen, doc, named_waypoints

View File

@ -1 +0,0 @@
magma_conduits_chime01.ogg is from https://freesound.org/people/Andromadax24/sounds/186719/ by Andromadax24 under the CC-BY-3.0 license

Binary file not shown.

View File

@ -7,7 +7,7 @@
local modpath = minetest.get_modpath(minetest.get_current_modname())
dofile(modpath .. "/volcano_lava.lua") -- https://github.com/minetest/minetest/issues/7864, https://github.com/minetest/minetest/issues/7878
local S, NS = dofile(modpath.."/intllib.lua")
local S = magma_conduits.S
local named_waypoints_modpath = minetest.get_modpath("named_waypoints")
if named_waypoints_modpath then
@ -382,7 +382,7 @@ end)
----------------------------------------------------------------------------------------------
-- Debugging and sightseeing commands
minetest.register_privilege("findvolcano", { description = "Allows players to use a console command to find volcanoes", give_to_singleplayer = false})
minetest.register_privilege("findvolcano", { description = S("Allows players to use a console command to find volcanoes"), give_to_singleplayer = false})
function round(val, decimal)
if (decimal) then
@ -430,7 +430,7 @@ end
minetest.register_chatcommand("findvolcano", {
params = "pos", -- Short parameter description
description = "find the volcanoes near the player's map region, or in the map region containing pos if provided",
description = S("find the volcanoes near the player's map region, or in the map region containing pos if provided"),
func = function(name, param)
if minetest.check_player_privs(name, {findvolcano = true}) then
local pos = {}
@ -440,7 +440,7 @@ minetest.register_chatcommand("findvolcano", {
pos.z = tonumber(pos.z)
if pos.x and pos.y and pos.z then
if not send_nearby_states(pos, name) then
minetest.chat_send_player(name, "No volcanoes near " .. minetest.pos_to_string(pos))
minetest.chat_send_player(name, S("No volcanoes near @1", minetest.pos_to_string(pos)))
end
return true
else
@ -450,12 +450,12 @@ minetest.register_chatcommand("findvolcano", {
pos.x = math.floor(pos.x)
pos.y = math.floor(pos.y)
pos.z = math.floor(pos.z)
minetest.chat_send_player(name, "No volcanoes near " .. minetest.pos_to_string(pos))
minetest.chat_send_player(name, S("No volcanoes near @1", minetest.pos_to_string(pos)))
end
return true
end
else
return false, "You need the findvolcano privilege to use this command."
return false, S("You need the findvolcano privilege to use this command.")
end
end,
})