mainmenu: translate main menu
This commit is contained in:
parent
2affb1c789
commit
1cc44dd54f
1 changed files with 21 additions and 13 deletions
|
@ -36,15 +36,15 @@ function MainMenu:new()
|
||||||
self.assets:addImageFont("medium", "examples/mainmenu/assets/medium")
|
self.assets:addImageFont("medium", "examples/mainmenu/assets/medium")
|
||||||
|
|
||||||
self:addMenu("main", true)
|
self:addMenu("main", true)
|
||||||
self:addSubMenu("basic", "Basic Tests")
|
self:addSubMenu("basic", "basic")
|
||||||
self:addScene("basic", examples.Test, "Basic Test 1")
|
self:addScene("basic", examples.Test, "test1")
|
||||||
self:addScene("basic", examples.Test2, "Basic Test 2")
|
self:addScene("basic", examples.Test2, "test2")
|
||||||
self:addScene("basic", examples.TestMenu, "Basic Test Menu")
|
self:addScene("basic", examples.TestMenu, "testmenu")
|
||||||
self:addSubMenu("menus", "Menus Tests")
|
self:addSubMenu("menus", "menu")
|
||||||
self:addScene("menus", examples.Inventory, "Inventory")
|
self:addScene("menus", examples.Inventory, "inventory")
|
||||||
self:addScene("menus", examples.Options, "Options")
|
self:addScene("menus", examples.Options, "options")
|
||||||
self:addSubMenu("gameplay", "Games Examples")
|
self:addSubMenu("gameplay", "gameplay")
|
||||||
self:addScene("gameplay", examples.MovePlayer, "Movable Player")
|
self:addScene("gameplay", examples.MovePlayer, "movable")
|
||||||
|
|
||||||
ExitWidget(self, "main")
|
ExitWidget(self, "main")
|
||||||
self.menusystem:switchMenu("main")
|
self.menusystem:switchMenu("main")
|
||||||
|
@ -63,7 +63,7 @@ end
|
||||||
function MainMenu:addSubMenu(name, fullname)
|
function MainMenu:addSubMenu(name, fullname)
|
||||||
self:addMenu(name)
|
self:addMenu(name)
|
||||||
SubMenuWidget(self, "main", name, fullname)
|
SubMenuWidget(self, "main", name, fullname)
|
||||||
SubMenuWidget(self, name, "main", "< Back", 1)
|
SubMenuWidget(self, name, "main", "back", 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
function MainMenu:addScene(submenu, scene, fullname)
|
function MainMenu:addScene(submenu, scene, fullname)
|
||||||
|
@ -85,7 +85,13 @@ function SubMenuWidget:new(scene, menu, newmenu, fullname, order)
|
||||||
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.newmenu = newmenu
|
self.newmenu = newmenu
|
||||||
SubMenuWidget.super.new(self, widgetmenu, font, fullname)
|
local label = ""
|
||||||
|
if fullname == "back" then
|
||||||
|
label = core.lang:translate("commons", fullname)
|
||||||
|
else
|
||||||
|
label = core.lang:translate("mainmenu", fullname)
|
||||||
|
end
|
||||||
|
SubMenuWidget.super.new(self, widgetmenu, font, label)
|
||||||
self.order = order or 0
|
self.order = order or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -100,7 +106,8 @@ function SceneWidget:new(scene, menu, newscene, fullname)
|
||||||
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.newscene = newscene
|
self.newscene = newscene
|
||||||
SceneWidget.super.new(self, widgetmenu, font, fullname)
|
local label = core.lang:translate("mainmenu", fullname)
|
||||||
|
SceneWidget.super.new(self, widgetmenu, font, label)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SceneWidget:action()
|
function SceneWidget:action()
|
||||||
|
@ -114,7 +121,8 @@ function ExitWidget: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"]
|
||||||
SceneWidget.super.new(self, widgetmenu, font, "Exit")
|
local label = core.lang:translate("commons", "exit")
|
||||||
|
SceneWidget.super.new(self, widgetmenu, font, label)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ExitWidget:action()
|
function ExitWidget:action()
|
||||||
|
|
Loading…
Reference in a new issue