mirror of
https://github.com/minetest-mods/intllib.git
synced 2025-03-22 12:11:44 +01:00
Add priority language for load_catalogs method
This commit is contained in:
parent
7b818cb4af
commit
da26ea7cf8
16
gettext.lua
16
gettext.lua
@ -209,9 +209,19 @@ 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
|
||||||
local cat = load_catalog(path.."/"..lang..".po")
|
local cat = load_catalog(path.."/"..lang..".po")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user