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