examples/options : translate option menu
This commit is contained in:
parent
a224021726
commit
0fd1c60b95
2 changed files with 15 additions and 9 deletions
|
@ -34,8 +34,8 @@ function OptionsMenu:new()
|
||||||
self:addMenu("main", true)
|
self:addMenu("main", true)
|
||||||
self:addSubMenu("video", "video")
|
self:addSubMenu("video", "video")
|
||||||
self:addSubMenu("audio", "audio")
|
self:addSubMenu("audio", "audio")
|
||||||
self:addSubMenu("lang", "lang")
|
self:addSubMenu("langs", "langs")
|
||||||
self:addSubMenu("input", "input")
|
self:addSubMenu("inputs", "inputs")
|
||||||
|
|
||||||
Widgets.Resolution(self, "video")
|
Widgets.Resolution(self, "video")
|
||||||
Widgets.Switch(self, "video", "fullscreen")
|
Widgets.Switch(self, "video", "fullscreen")
|
||||||
|
@ -59,7 +59,7 @@ end
|
||||||
function OptionsMenu:addSubMenu(name, fullname)
|
function OptionsMenu:addSubMenu(name, fullname)
|
||||||
self:addMenu(name)
|
self:addMenu(name)
|
||||||
Widgets.SubMenu(self, "main", name, fullname)
|
Widgets.SubMenu(self, "main", name, fullname)
|
||||||
Widgets.SubMenu(self, name, "main", "Back", 1, "<")
|
Widgets.SubMenu(self, name, "main", "back", 1, "<")
|
||||||
end
|
end
|
||||||
|
|
||||||
function OptionsMenu:addScene(submenu, scene, fullname)
|
function OptionsMenu:addScene(submenu, scene, fullname)
|
||||||
|
|
|
@ -56,9 +56,10 @@ function widgets.SubMenu:new(scene, menu, newmenu, fullname, order, label2)
|
||||||
self.scene = scene
|
self.scene = scene
|
||||||
local widgetmenu = self.scene.menusystem.menus[menu]
|
local widgetmenu = self.scene.menusystem.menus[menu]
|
||||||
local font = self.scene.assets.fonts["medium"]
|
local font = self.scene.assets.fonts["medium"]
|
||||||
|
local label = core.lang:translate("options", fullname)
|
||||||
local label2 = label2 or ">"
|
local label2 = label2 or ">"
|
||||||
self.newmenu = newmenu
|
self.newmenu = newmenu
|
||||||
widgets.SubMenu.super.new(self, widgetmenu, font, fullname, label2)
|
widgets.SubMenu.super.new(self, widgetmenu, font, label, label2)
|
||||||
self.order = order or 0
|
self.order = order or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -85,6 +86,7 @@ function widgets.Exit:new(scene, menu)
|
||||||
self.scene = scene
|
self.scene = scene
|
||||||
local widgetmenu = self.scene.menusystem.menus[menu]
|
local widgetmenu = self.scene.menusystem.menus[menu]
|
||||||
local font = self.scene.assets.fonts["medium"]
|
local font = self.scene.assets.fonts["medium"]
|
||||||
|
local label = core.lang:translate("commons", "exit")
|
||||||
widgets.Exit.super.new(self, widgetmenu, font, "Exit")
|
widgets.Exit.super.new(self, widgetmenu, font, "Exit")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -102,8 +104,9 @@ function widgets.Switch:new(scene, menu, keyname)
|
||||||
local widgetmenu = self.scene.menusystem.menus[menu]
|
local widgetmenu = self.scene.menusystem.menus[menu]
|
||||||
local font = self.scene.assets.fonts["medium"]
|
local font = self.scene.assets.fonts["medium"]
|
||||||
self.keyname = keyname
|
self.keyname = keyname
|
||||||
|
local label = core.lang:translate("options", keyname)
|
||||||
local label2 = self:getLabel()
|
local label2 = self:getLabel()
|
||||||
widgets.Switch.super.new(self, widgetmenu, font, keyname, label2)
|
widgets.Switch.super.new(self, widgetmenu, font, label, label2)
|
||||||
self.order = order or 0
|
self.order = order or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -131,11 +134,14 @@ end
|
||||||
|
|
||||||
function widgets.Switch:getLabel()
|
function widgets.Switch:getLabel()
|
||||||
self:getKey()
|
self:getKey()
|
||||||
|
local label = ""
|
||||||
if (self.key) then
|
if (self.key) then
|
||||||
return "true"
|
label = "true"
|
||||||
else
|
else
|
||||||
return "false"
|
label = "false"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return core.lang:translate("commons", label)
|
||||||
end
|
end
|
||||||
|
|
||||||
function widgets.Switch:action()
|
function widgets.Switch:action()
|
||||||
|
@ -151,9 +157,9 @@ function widgets.Resolution:new(scene, menu)
|
||||||
self.scene = scene
|
self.scene = scene
|
||||||
local widgetmenu = self.scene.menusystem.menus[menu]
|
local widgetmenu = self.scene.menusystem.menus[menu]
|
||||||
local font = self.scene.assets.fonts["medium"]
|
local font = self.scene.assets.fonts["medium"]
|
||||||
local keyname = "resolution"
|
local label = core.lang:translate("options", "resolution")
|
||||||
local label2 = self:getLabel()
|
local label2 = self:getLabel()
|
||||||
widgets.Resolution.super.new(self, widgetmenu, font, keyname, label2)
|
widgets.Resolution.super.new(self, widgetmenu, font, label, label2)
|
||||||
end
|
end
|
||||||
|
|
||||||
function widgets.Resolution:getLabel()
|
function widgets.Resolution:getLabel()
|
||||||
|
|
Loading…
Reference in a new issue