summaryrefslogtreecommitdiffhomepage
path: root/libs
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2008-10-05 16:08:33 +0000
committerJo-Philipp Wich <jow@openwrt.org>2008-10-05 16:08:33 +0000
commit255449a1e2c59265d4db0bb80e915eb1530d42b8 (patch)
tree90297799b5c504cff35a306b83e6b43f022c40c6 /libs
parent97fcc6df3f79925e330eea609a7c3c5a59102675 (diff)
* luci/i18n: rename *.pt_br.* to *.pt-br.*, extend luci.i18n to convert "_" to "-" in language tags
Diffstat (limited to 'libs')
-rw-r--r--libs/uvl/luasrc/i18n/uvl.pt-br.lua (renamed from libs/uvl/luasrc/i18n/uvl.pt_br.lua)0
-rw-r--r--libs/uvl/luasrc/i18n/uvl.pt-br.xml (renamed from libs/uvl/luasrc/i18n/uvl.pt_br.xml)0
-rw-r--r--libs/web/luasrc/i18n.lua10
3 files changed, 5 insertions, 5 deletions
diff --git a/libs/uvl/luasrc/i18n/uvl.pt_br.lua b/libs/uvl/luasrc/i18n/uvl.pt-br.lua
index baf789a78..baf789a78 100644
--- a/libs/uvl/luasrc/i18n/uvl.pt_br.lua
+++ b/libs/uvl/luasrc/i18n/uvl.pt-br.lua
diff --git a/libs/uvl/luasrc/i18n/uvl.pt_br.xml b/libs/uvl/luasrc/i18n/uvl.pt-br.xml
index a209fede6..a209fede6 100644
--- a/libs/uvl/luasrc/i18n/uvl.pt_br.xml
+++ b/libs/uvl/luasrc/i18n/uvl.pt-br.xml
diff --git a/libs/web/luasrc/i18n.lua b/libs/web/luasrc/i18n.lua
index 84a869539..4b3adf7eb 100644
--- a/libs/web/luasrc/i18n.lua
+++ b/libs/web/luasrc/i18n.lua
@@ -12,9 +12,9 @@ Copyright 2008 Steven Barth <steven@midlink.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@@ -45,7 +45,7 @@ end
-- @param force Force reload even if already loaded (optional)
-- @return Success status
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
local f = loadfile(i18ndir .. file .. "." .. lang .. ".lua")
if f then
@@ -75,7 +75,7 @@ end
--- Set the context default translation language.
-- @param lang Two-letter language code
function setlanguage(lang)
- context.lang = lang
+ context.lang = lang:gsub("_", "-")
end
--- Return the translated value for a specific translation key.
@@ -95,4 +95,4 @@ end
-- @return Translated and formatted string
function translatef(key, default, ...)
return translate(key, default):format(...)
-end \ No newline at end of file
+end