mirror of
https://github.com/pyrollo/display_modpack.git
synced 2025-07-11 20:40:31 +02:00
replace intllib
This commit is contained in:
@ -22,9 +22,8 @@ ontime_clocks = {}
|
||||
ontime_clocks.name = minetest.get_current_modname()
|
||||
ontime_clocks.path = minetest.get_modpath(ontime_clocks.name)
|
||||
|
||||
-- Load support for intllib.
|
||||
local S, NS = dofile(ontime_clocks.path.."/intllib.lua")
|
||||
ontime_clocks.intllib = S
|
||||
-- Translation support
|
||||
ontime_clocks.S = minetest.get_translator(ontime_clocks.name)
|
||||
|
||||
dofile(ontime_clocks.path.."/common.lua")
|
||||
dofile(ontime_clocks.path.."/nodes.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
|
7
ontime_clocks/locale/ontime_clocks.de.tr
Normal file
7
ontime_clocks/locale/ontime_clocks.de.tr
Normal file
@ -0,0 +1,7 @@
|
||||
# textdomain: ontime_clocks
|
||||
Green digital clock=Grüne Digitaluhr
|
||||
Red digital clock=Rote Digitaluhr
|
||||
White clock=Weiße Uhr
|
||||
Frameless clock=Rahmenlose Uhr
|
||||
Frameless gold clock=Rahmenlose goldene Uhr
|
||||
Frameless white clock=Rahmenlose weiße Uhr
|
@ -2,4 +2,3 @@ name = ontime_clocks
|
||||
title = Ontime Clocks
|
||||
description = Clocks displaing real ingame time
|
||||
depends = default,dye,display_api
|
||||
optional_depends = intllib
|
||||
|
@ -18,7 +18,7 @@
|
||||
along with ontime_clocks. If not, see <http://www.gnu.org/licenses/>.
|
||||
--]]
|
||||
|
||||
local S = ontime_clocks.intllib
|
||||
local S = ontime_clocks.S
|
||||
|
||||
local function clock_on_construct(pos)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
|
Reference in New Issue
Block a user