forked from minetest-mods/unified_inventory
Bags: Code cleanup and per-bag trash slot.
* Turn page creation into a loop. * Add per-bag trash slot. * Changed i18n to allow replacements.
This commit is contained in:
12
init.lua
12
init.lua
@ -2,7 +2,15 @@
|
||||
|
||||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
local worldpath = minetest.get_worldpath()
|
||||
local mygettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
|
||||
local mygettext
|
||||
if rawget(_G, "intllib") then
|
||||
mygettext = intllib.Getter()
|
||||
else
|
||||
function mygettext(s, ...)
|
||||
local t = { ... }
|
||||
return (s:gsub("@(%d+)", function(n) return t[tonumber(n)] end))
|
||||
end
|
||||
end
|
||||
|
||||
-- Data tables definitions
|
||||
unified_inventory = {
|
||||
@ -33,7 +41,7 @@ unified_inventory = {
|
||||
|
||||
-- intllib
|
||||
gettext = mygettext,
|
||||
fgettext = function(s) return minetest.formspec_escape(mygettext(s)) end,
|
||||
fgettext = function(...) return minetest.formspec_escape(mygettext(...)) end,
|
||||
|
||||
-- "Lite" mode
|
||||
lite_mode = minetest.setting_getbool("unified_inventory_lite"),
|
||||
|
Reference in New Issue
Block a user