mirror of
https://github.com/ExeVirus/algae
synced 2025-07-14 19:08:54 +02:00
Use builtin client-side translation support from minetest 5
This commit is contained in:
parent
58bd6997a5
commit
05934e36e9
@ -1 +0,0 @@
|
|||||||
default
|
|
16
init.lua
16
init.lua
@ -1,12 +1,12 @@
|
|||||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
-- Translation support
|
||||||
local S, NS = dofile(MP..'/intllib.lua')
|
local S = minetest.get_translator("algae")
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Algae
|
-- Algae
|
||||||
--
|
--
|
||||||
|
|
||||||
local algae_thin_def = {
|
local algae_thin_def = {
|
||||||
description = S("Algae_thin"),
|
description = S("Thin algae"),
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -51,7 +51,7 @@ local algae_thin_def = {
|
|||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(player_name, "Node is protected")
|
minetest.chat_send_player(player_name, S("Node is protected."))
|
||||||
minetest.record_protection_violation(pos, player_name)
|
minetest.record_protection_violation(pos, player_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -61,7 +61,7 @@ local algae_thin_def = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local algae_medium_def = {
|
local algae_medium_def = {
|
||||||
description = S("Algae_Medium"),
|
description = S("Medium algae"),
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -106,7 +106,7 @@ local algae_medium_def = {
|
|||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(player_name, "Node is protected")
|
minetest.chat_send_player(player_name, S("Node is protected."))
|
||||||
minetest.record_protection_violation(pos, player_name)
|
minetest.record_protection_violation(pos, player_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -116,7 +116,7 @@ local algae_medium_def = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local algae_thick_def = {
|
local algae_thick_def = {
|
||||||
description = S("Algae_thick"),
|
description = S("Thick algae"),
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -166,7 +166,7 @@ local algae_thick_def = {
|
|||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(player_name, "Node is protected")
|
minetest.chat_send_player(player_name, S("Node is protected."))
|
||||||
minetest.record_protection_violation(pos, player_name)
|
minetest.record_protection_violation(pos, player_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
45
intllib.lua
45
intllib.lua
@ -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
|
|
9
locale/template.txt
Normal file
9
locale/template.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# textdomain: algae
|
||||||
|
|
||||||
|
|
||||||
|
### init.lua ###
|
||||||
|
|
||||||
|
Medium algae=
|
||||||
|
Node is protected.=
|
||||||
|
Thick algae=
|
||||||
|
Thin algae=
|
Loading…
Reference in New Issue
Block a user