2 -- Support the old multi-load method
3 intllib
= intllib
or {}
5 local MP
= minetest
.get_modpath("intllib")
11 local LANG
= minetest
.setting_get("language")
12 if not (LANG
and (LANG
~= "")) then LANG
= os
.getenv("LANG") end
13 if not (LANG
and (LANG
~= "")) then LANG
= "en" end
16 -- Support the old multi-load method
17 intllib
.getters
= intllib
.getters
or {}
21 local function noop_getter(s
)
25 function intllib
.Getter(modname
)
26 modname
= modname
or minetest
.get_current_modname()
27 if not intllib
.getters
[modname
] then
28 local modpath
= minetest
.get_modpath(modname
)
30 local filename
= modpath
.."/locale/"..LANG
..".txt"
31 local msgstr
= intllib
.load_strings(filename
)
32 intllib
.strings
[modname
] = msgstr
or false
34 intllib
.getters
[modname
] = function (s
)
35 if msgstr
[s
] and msgstr
[s
] ~= "" then
41 intllib
.getters
[modname
] = noop_getter
45 return intllib
.getters
[modname
]
48 function intllib
.get_strings(modname
)
49 modname
= modname
or minetest
.get_current_modname()
50 local msgstr
= intllib
.strings
[modname
]
52 local modpath
= minetest
.get_modpath(modname
)
53 msgstr
= intllib
.load_strings(modpath
.."/locale/"..LANG
..".txt")
54 intllib
.strings
[modname
] = msgstr