mirror of
https://github.com/minetest-mods/intllib.git
synced 2025-01-09 01:20:25 +01:00
Switch to slightly cleaner compatibility method
This commit is contained in:
parent
2ef1abad55
commit
475711f7f7
16
init.lua
16
init.lua
@ -1,5 +1,12 @@
|
|||||||
-- Support the old multi-load method
|
|
||||||
intllib = rawget(_G, "intllib") or {}
|
-- Old multi-load method compatibility
|
||||||
|
if rawget(_G, "intllib") then return end
|
||||||
|
|
||||||
|
intllib = {
|
||||||
|
getters = {},
|
||||||
|
strings = {},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
local MP = minetest.get_modpath("intllib")
|
local MP = minetest.get_modpath("intllib")
|
||||||
|
|
||||||
@ -11,11 +18,6 @@ if not (LANG and (LANG ~= "")) then LANG = os.getenv("LANG") end
|
|||||||
if not (LANG and (LANG ~= "")) then LANG = "en" end
|
if not (LANG and (LANG ~= "")) then LANG = "en" end
|
||||||
LANG = LANG:sub(1, 2)
|
LANG = LANG:sub(1, 2)
|
||||||
|
|
||||||
-- Support the old multi-load method
|
|
||||||
intllib.getters = intllib.getters or {}
|
|
||||||
|
|
||||||
intllib.strings = {}
|
|
||||||
|
|
||||||
|
|
||||||
local INS_CHAR = intllib.INSERTION_CHAR
|
local INS_CHAR = intllib.INSERTION_CHAR
|
||||||
local insertion_pattern = "("..INS_CHAR.."?)"..INS_CHAR.."(%(?)(%d+)(%)?)"
|
local insertion_pattern = "("..INS_CHAR.."?)"..INS_CHAR.."(%(?)(%d+)(%)?)"
|
||||||
|
Loading…
Reference in New Issue
Block a user