update intllib to latest format

This commit is contained in:
FaceDeer 2017-02-02 20:03:24 -07:00
parent 0a71615571
commit 191c242816
6 changed files with 231 additions and 39 deletions

@ -1,6 +1,9 @@
-- define global -- define global
hopper = {} hopper = {}
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
local texture_resolution = minetest.setting_get("hopper_texture_size") local texture_resolution = minetest.setting_get("hopper_texture_size")
if texture_resolution == nil then if texture_resolution == nil then
texture_resolution = "16" texture_resolution = "16"
@ -11,14 +14,14 @@ if single_craftable_item == nil then
single_craftable_item = true single_craftable_item = true
end end
local hopper_long_desc = "Hopper to transfer items between neighboring blocks' inventories" local hopper_long_desc = S("Hopper to transfer items between neighboring blocks' inventories")
local hopper_usage = "Items are transfered from the block at the wide end of the hopper to the block at the narrow end of the hopper at a rate of one per second. Items can also be placed directly into the hopper's inventory, or they can be dropped into the space above a hopper and will be sucked into the hopper's inventory automatically.\n\n" local hopper_usage = S("Items are transfered from the block at the wide end of the hopper to the block at the narrow end of the hopper at a rate of one per second. Items can also be placed directly into the hopper's inventory, or they can be dropped into the space above a hopper and will be sucked into the hopper's inventory automatically.\n\n")
if single_craftable_item then if single_craftable_item then
hopper_usage = hopper_usage .. "Hopper blocks come in both 'vertical' and 'side' forms, but when in a player's inventory both are represented by a single generic item. The type of hopper block that will be placed when the player uses this item depends on what is pointed at - when the hopper item is pointed at the top or bottom face of a block a vertical hopper is placed, when aimed at the side of a block a side hopper is produced that connects to the clicked-on side.\n\n" hopper_usage = hopper_usage .. S("Hopper blocks come in both 'vertical' and 'side' forms, but when in a player's inventory both are represented by a single generic item. The type of hopper block that will be placed when the player uses this item depends on what is pointed at - when the hopper item is pointed at the top or bottom face of a block a vertical hopper is placed, when aimed at the side of a block a side hopper is produced that connects to the clicked-on side.\n\n")
else else
hopper_usage = hopper_usage .. "Hopper blocks come in both 'vertical' and 'side' forms. They can be interconverted between the two forms via the crafting grid.\n\n" hopper_usage = hopper_usage .. S("Hopper blocks come in both 'vertical' and 'side' forms. They can be interconverted between the two forms via the crafting grid.\n\n")
end end
hopper_usage = hopper_usage .. "When used with furnaces, vertical hoppers inject items into the furnace's \"raw material\" inventory slot and side hoppers inject items into the furnace's \"fuel\" inventory slot.\n\nItems that cannot be placed in a target block's inventory will remain in the hopper.\n\nHoppers have the same permissions as the player that placed them. Hoppers placed by you are allowed to take items from or put items into locked chests that you own, but hoppers placed by other players will be unable to do so. A hopper's own inventory is not not owner-locked, though, so you can use this as a way to allow other players to deposit items into your locked chests." hopper_usage = hopper_usage .. S("When used with furnaces, vertical hoppers inject items into the furnace's \"raw material\" inventory slot and side hoppers inject items into the furnace's \"fuel\" inventory slot.\n\nItems that cannot be placed in a target block's inventory will remain in the hopper.\n\nHoppers have the same permissions as the player that placed them. Hoppers placed by you are allowed to take items from or put items into locked chests that you own, but hoppers placed by other players will be unable to do so. A hopper's own inventory is not not owner-locked, though, so you can use this as a way to allow other players to deposit items into your locked chests.")
local containers = {} local containers = {}
local neighbors = {} local neighbors = {}
@ -42,19 +45,6 @@ function hopper:add_container(list)
end end
end end
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s, a, ...) a = {a, ...}
return s:gsub("@(%d+)", function(n)
return a[tonumber(n)]
end)
end
end
-- default containers ( from position [into hopper], from node, into node inventory ) -- default containers ( from position [into hopper], from node, into node inventory )
hopper:add_container({ hopper:add_container({
{"top", "hopper:hopper", "main"}, {"top", "hopper:hopper", "main"},

45
intllib.lua Normal file

@ -0,0 +1,45 @@
-- 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

89
locale/de.po Normal file

@ -0,0 +1,89 @@
# Internationalization template for Hopper mod.
# Copyright (C) 2017
# This file is distributed under the same license as the PACKAGE package.
# FaceDeer
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-02 19:39-0700\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: init.lua:17
msgid "Hopper to transfer items between neighboring blocks' inventories"
msgstr ""
#: init.lua:18
msgid ""
"Items are transfered from the block at the wide end of the hopper to the "
"block at the narrow end of the hopper at a rate of one per second. Items can "
"also be placed directly into the hopper's inventory, or they can be dropped "
"into the space above a hopper and will be sucked into the hopper's inventory "
"automatically.\n"
"\n"
msgstr ""
#: init.lua:20
msgid ""
"Hopper blocks come in both 'vertical' and 'side' forms, but when in a "
"player's inventory both are represented by a single generic item. The type "
"of hopper block that will be placed when the player uses this item depends "
"on what is pointed at - when the hopper item is pointed at the top or bottom "
"face of a block a vertical hopper is placed, when aimed at the side of a "
"block a side hopper is produced that connects to the clicked-on side.\n"
"\n"
msgstr ""
#: init.lua:22
msgid ""
"Hopper blocks come in both 'vertical' and 'side' forms. They can be "
"interconverted between the two forms via the crafting grid.\n"
"\n"
msgstr ""
#: init.lua:24
msgid ""
"When used with furnaces, vertical hoppers inject items into the furnace's "
"\"raw material\" inventory slot and side hoppers inject items into the "
"furnace's \"fuel\" inventory slot.\n"
"\n"
"Items that cannot be placed in a target block's inventory will remain in the "
"hopper.\n"
"\n"
"Hoppers have the same permissions as the player that placed them. Hoppers "
"placed by you are allowed to take items from or put items into locked chests "
"that you own, but hoppers placed by other players will be unable to do so. A "
"hopper's own inventory is not not owner-locked, though, so you can use this "
"as a way to allow other players to deposit items into your locked chests."
msgstr ""
#: init.lua:148
msgid "Hopper"
msgstr "Trichter"
#: init.lua:204 init.lua:292
msgid "@1 moves stuff in hopper at @2"
msgstr "@1 bewegt Dinge in einem Trichter bei @2"
#: init.lua:209 init.lua:297
msgid "@1 moves stuff to hopper at @2"
msgstr "@1 verlagert Dinge in einen Trichter bei @2"
#: init.lua:214 init.lua:302
msgid "@1 moves stuff from hopper at @2"
msgstr "@1 nimmt Dinge aus einem Trichter bei @2"
#: init.lua:230
msgid "Side Hopper"
msgstr "Seitentrichter"
#: init.lua:534
msgid "[MOD] Hopper loaded"
msgstr "[MOD] Trichter geladen"

@ -1,11 +0,0 @@
# Template for translations of hopper mod
# German translation by Xanthin
# last update: 1st February 2017
#init.lua
[MOD] Hopper loaded = [MOD] Trichter geladen
Hopper = Trichter
Side Hopper = Seitentrichter
@1 moves stuff in hopper at @2 = @1 bewegt Dinge in einem Trichter bei @2
@1 moves stuff to hopper at @2 = @1 verlagert Dinge in einen Trichter bei @2
@1 moves stuff from hopper at @2 = @1 nimmt Dinge aus einem Trichter bei @2

89
locale/template.pot Normal file

@ -0,0 +1,89 @@
# Internationalization template for Hopper mod.
# Copyright (C) 2017
# This file is distributed under the same license as the PACKAGE package.
# FaceDeer
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-02 19:39-0700\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: init.lua:17
msgid "Hopper to transfer items between neighboring blocks' inventories"
msgstr ""
#: init.lua:18
msgid ""
"Items are transfered from the block at the wide end of the hopper to the "
"block at the narrow end of the hopper at a rate of one per second. Items can "
"also be placed directly into the hopper's inventory, or they can be dropped "
"into the space above a hopper and will be sucked into the hopper's inventory "
"automatically.\n"
"\n"
msgstr ""
#: init.lua:20
msgid ""
"Hopper blocks come in both 'vertical' and 'side' forms, but when in a "
"player's inventory both are represented by a single generic item. The type "
"of hopper block that will be placed when the player uses this item depends "
"on what is pointed at - when the hopper item is pointed at the top or bottom "
"face of a block a vertical hopper is placed, when aimed at the side of a "
"block a side hopper is produced that connects to the clicked-on side.\n"
"\n"
msgstr ""
#: init.lua:22
msgid ""
"Hopper blocks come in both 'vertical' and 'side' forms. They can be "
"interconverted between the two forms via the crafting grid.\n"
"\n"
msgstr ""
#: init.lua:24
msgid ""
"When used with furnaces, vertical hoppers inject items into the furnace's "
"\"raw material\" inventory slot and side hoppers inject items into the "
"furnace's \"fuel\" inventory slot.\n"
"\n"
"Items that cannot be placed in a target block's inventory will remain in the "
"hopper.\n"
"\n"
"Hoppers have the same permissions as the player that placed them. Hoppers "
"placed by you are allowed to take items from or put items into locked chests "
"that you own, but hoppers placed by other players will be unable to do so. A "
"hopper's own inventory is not not owner-locked, though, so you can use this "
"as a way to allow other players to deposit items into your locked chests."
msgstr ""
#: init.lua:148
msgid "Hopper"
msgstr ""
#: init.lua:204 init.lua:292
msgid "@1 moves stuff in hopper at @2"
msgstr ""
#: init.lua:209 init.lua:297
msgid "@1 moves stuff to hopper at @2"
msgstr ""
#: init.lua:214 init.lua:302
msgid "@1 moves stuff from hopper at @2"
msgstr ""
#: init.lua:230
msgid "Side Hopper"
msgstr ""
#: init.lua:534
msgid "[MOD] Hopper loaded"
msgstr ""

@ -1,10 +0,0 @@
# Template for translations of hopper mod
# last update: 1st February 2017
#init.lua
[MOD] Hopper loaded =
Hopper (Place onto sides for side-hopper) =
Side Hopper (Place into crafting to return normal Hopper) =
@1 moves stuff in hopper at @2
@1 moves stuff to hopper at @2
@1 moves stuff from hopper at @2