* luci/i18n: rename *.pt_br.* to *.pt-br.*, extend luci.i18n to convert "_" to "-" in language tags

This commit is contained in:
Jo-Philipp Wich 2008-10-05 16:08:33 +00:00
parent 97fcc6df3f
commit 255449a1e2
41 changed files with 5 additions and 5 deletions

View file

@ -45,7 +45,7 @@ end
-- @param force Force reload even if already loaded (optional) -- @param force Force reload even if already loaded (optional)
-- @return Success status -- @return Success status
function load(file, lang, force) function load(file, lang, force)
lang = lang or "" lang = lang and lang:gsub("_", "-") or ""
if force or not loaded[lang] or not loaded[lang][file] then if force or not loaded[lang] or not loaded[lang][file] then
local f = loadfile(i18ndir .. file .. "." .. lang .. ".lua") local f = loadfile(i18ndir .. file .. "." .. lang .. ".lua")
if f then if f then
@ -75,7 +75,7 @@ end
--- Set the context default translation language. --- Set the context default translation language.
-- @param lang Two-letter language code -- @param lang Two-letter language code
function setlanguage(lang) function setlanguage(lang)
context.lang = lang context.lang = lang:gsub("_", "-")
end end
--- Return the translated value for a specific translation key. --- Return the translated value for a specific translation key.