mirror of
https://github.com/minetest-mods/intllib.git
synced 2025-03-23 12:40:38 +01:00
Add priority language for load_catalogs method
This commit is contained in:
parent
7b818cb4af
commit
da26ea7cf8
14
gettext.lua
14
gettext.lua
@ -209,8 +209,18 @@ local function load_catalog(filename)
|
|||||||
return data
|
return data
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.load_catalogs(path)
|
function M.load_catalogs(path, first_lang)
|
||||||
local langs = intllib.get_detected_languages()
|
|
||||||
|
-- add selected first lang
|
||||||
|
if first_lang then
|
||||||
|
langs = {}
|
||||||
|
table.insert(langs, first_lang)
|
||||||
|
for _, lang in ipairs(intllib.get_detected_languages()) do
|
||||||
|
langs[#langs+1] = lang
|
||||||
|
end
|
||||||
|
else
|
||||||
|
langs = intllib.get_detected_languages()
|
||||||
|
end
|
||||||
|
|
||||||
local cats = { }
|
local cats = { }
|
||||||
for _, lang in ipairs(langs) do
|
for _, lang in ipairs(langs) do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user