projects
/
project
/
luci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* Core translation part 2
[project/luci.git]
/
libs
/
web
/
luasrc
/
i18n.lua
diff --git
a/libs/web/luasrc/i18n.lua
b/libs/web/luasrc/i18n.lua
index
3a8a9a6
..
7ace708
100644
(file)
--- a/
libs/web/luasrc/i18n.lua
+++ b/
libs/web/luasrc/i18n.lua
@@
-29,6
+29,7
@@
require("luci.sys")
table = {}
i18ndir = luci.sys.libpath() .. "/i18n/"
table = {}
i18ndir = luci.sys.libpath() .. "/i18n/"
+loaded = {}
-- Clears the translation table
function clear()
-- Clears the translation table
function clear()
@@
-36,14
+37,19
@@
function clear()
end
-- Loads a translation and copies its data into the global translation table
end
-- Loads a translation and copies its data into the global translation table
-function load(file)
- local f = loadfile(i18ndir .. file)
- if f then
- setfenv(f, table)
- f()
- return true
+function load(file, force)
+ if force or not loaded[file] then
+ local f = loadfile(i18ndir .. file)
+ if f then
+ setfenv(f, table)
+ f()
+ loaded[file] = true
+ return true
+ else
+ return false
+ end
else
else
- return
fals
e
+ return
tru
e
end
end
end
end