Permalink
Browse files

make ui translatable

  • Loading branch information...
robn committed Oct 9, 2012
1 parent 627cadd commit b11161f3dec200d146fe9af0680bb95d919621df
Showing with 13 additions and 12 deletions.
  1. +4 −3 data/ui/FileDialog.lua
  2. +9 −9 data/ui/MainMenu.lua
View
@@ -2,13 +2,14 @@
-- Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
local ui = Engine.ui
+local t = Translate:GetTranslator()
ui.templates.FileDialog = function (args)
- local title = args.title or "Select file..."
+ local title = args.title or t("Select file...")
local root = args.root or "USER"
local path = args.path or ""
- local selectLabel = args.selectLabel or "Select"
- local cancelLabel = args.cancelLabel or "Cancel"
+ local selectLabel = args.selectLabel or t("Select")
+ local cancelLabel = args.cancelLabel or t("Cancel")
local onSelect = args.onSelect or function (name) end
local onCancel = args.onCancel or function () end
View
@@ -2,7 +2,7 @@
-- Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
local ui = Engine.ui
-local l = Lang.GetDictionary()
+local t = Translate:GetTranslator()
local setupPlayerEagle = function ()
Game.player:SetShipType("eagle_lrf")
@@ -27,22 +27,22 @@ end
local doLoadDialog = function ()
ui:SetInnerWidget(
ui.templates.FileDialog({
- title = "Select game to load...",
+ title = t("Select game to load..."),
path = "savefiles",
- selectLabel = "Load game",
+ selectLabel = t("Load game"),
onSelect = function (filename) Game.LoadGame(filename) end,
onCancel = function () ui:SetInnerWidget(ui.templates.MainMenu()) end
})
)
end
local buttonDefs = {
- { "Start at Earth", function () Game.StartGame(SystemPath.New(0,0,0,0,9)) setupPlayerEagle() end },
- { "Start at New Hope", function () Game.StartGame(SystemPath.New(1,-1,-1,0,4)) setupPlayerEagle() end },
- { "Start at Lave", function () Game.StartGame(SystemPath.New(-2,1,90,0,2)) setupPlayerCobra() end },
- { "Load Game", doLoadDialog },
- { "Options", function () Engine.SettingsView() end },
- { "Quit", function () Engine.Quit() end },
+ { t("Start at Earth"), function () Game.StartGame(SystemPath.New(0,0,0,0,9)) setupPlayerEagle() end },
+ { t("Start at New Hope"), function () Game.StartGame(SystemPath.New(1,-1,-1,0,4)) setupPlayerEagle() end },
+ { t("Start at Lave"), function () Game.StartGame(SystemPath.New(-2,1,90,0,2)) setupPlayerCobra() end },
+ { t("Load game"), doLoadDialog },
+ { t("Options"), function () Engine.SettingsView() end },
+ { t("Quit"), function () Engine.Quit() end },
}

0 comments on commit b11161f

Please sign in to comment.