From 0fd1c60b958cd17355d38ea0df0081306cd3b6db Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 14 Apr 2019 17:59:03 +0200 Subject: [PATCH] examples/options : translate option menu --- examples/menus/options/init.lua | 6 +++--- examples/menus/options/widgets.lua | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/examples/menus/options/init.lua b/examples/menus/options/init.lua index f602d68..68aca6d 100644 --- a/examples/menus/options/init.lua +++ b/examples/menus/options/init.lua @@ -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) diff --git a/examples/menus/options/widgets.lua b/examples/menus/options/widgets.lua index eacbfea..7046bc8 100644 --- a/examples/menus/options/widgets.lua +++ b/examples/menus/options/widgets.lua @@ -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()