mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-01 00:19:33 +00:00
Implements a locales_utils file to handle language changes
This commit is contained in:
parent
7ed1e49888
commit
5dfbf87bba
1 changed files with 29 additions and 0 deletions
29
scripts/lua/modules/locales_utils.lua
Normal file
29
scripts/lua/modules/locales_utils.lua
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
--
|
||||
-- (C) 2014-17 - ntop.org
|
||||
--
|
||||
i18n = require "i18n"
|
||||
i18n.loadFile(dirs.installdir..'/scripts/locales/it.lua')
|
||||
i18n.loadFile(dirs.installdir..'/scripts/locales/en.lua')
|
||||
|
||||
local locales = {}
|
||||
|
||||
locales.default_locale = "en"
|
||||
|
||||
-- language is a global variable set from C that corresponds to the user default language
|
||||
-- it may be null when lua_utils are imported from periodic scripts
|
||||
if language == nil then
|
||||
language = locales.default_locale
|
||||
end
|
||||
|
||||
i18n.setLocale(language)
|
||||
|
||||
local available_locales = {
|
||||
{code="en", name=i18n("locales.en")},
|
||||
-- {code="it", name=i18n("locales.it")}
|
||||
}
|
||||
|
||||
function locales.getAvailableLocales()
|
||||
return available_locales
|
||||
end
|
||||
|
||||
return locales
|
||||
Loading…
Add table
Add a link
Reference in a new issue