Add priority language for load_catalogs method

This commit is contained in:
BrunoMine 2017-07-16 12:37:31 -03:00
parent 7b818cb4af
commit da26ea7cf8
1 changed files with 13 additions and 3 deletions

View File

@ -209,9 +209,19 @@ local function load_catalog(filename)
return data
end
function M.load_catalogs(path)
local langs = intllib.get_detected_languages()
function M.load_catalogs(path, first_lang)
-- 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 = { }
for _, lang in ipairs(langs) do
local cat = load_catalog(path.."/"..lang..".po")