Skip to content

Commit

Permalink
Move strings to translation system
Browse files Browse the repository at this point in the history
  • Loading branch information
impaktor authored and The-EG committed Jan 17, 2018
1 parent 9d09681 commit 3d8b96b
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 34 deletions.
72 changes: 72 additions & 0 deletions data/lang/ui-core/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"description" : "",
"message" : "Active"
},
"ADD_JUMP" : {
"description" : "UI-button: Add hyper jump to list of planned jumps",
"message" : "Add Jump"
},
"AFTER_TRADE_IN" : {
"description" : "",
"message" : "After trade-in"
Expand Down Expand Up @@ -35,6 +39,10 @@
"description" : "",
"message" : "Attempt to repair hull"
},
"AUTO_ROUTE" : {
"description" : "Automatically find shortest jump route (measured in time) in star map",
"message" : "Auto Route"
},
"AVAILABLE_FOR_PURCHASE" : {
"description" : "",
"message" : "Available for purchase"
Expand Down Expand Up @@ -111,6 +119,10 @@
"description" : "",
"message" : "Cash: {money}"
},
"CENTER_ON_SYSTEM" : {
"description" : "Center on selected star system",
"message" : "Center on System"
},
"CHANGE_BINDING" : {
"description" : "Key binding option",
"message" : "Change Binding"
Expand All @@ -135,6 +147,10 @@
"description" : "Clear an option in game settings/options menu",
"message" : "Clear"
},
"CLEAR_ROUTE" : {
"description" : "Clear a planned route of hyperjumps",
"message" : "Clear Route"
},
"CLIENT" : {
"description" : "",
"message" : "Client"
Expand Down Expand Up @@ -211,6 +227,14 @@
"description" : "Past crimes / crime history of character",
"message" : "Criminal record"
},
"CURRENT_FUEL" : {
"description" : "For hyperjump planner",
"message" : "Current Fuel:"
},
"CURRENT_SYSTEM" : {
"description" : "For hyperjump planner",
"message" : "Current system"
},
"DANGEROUS" : {
"description" : "Player combat rating",
"message" : "Dangerous"
Expand Down Expand Up @@ -351,6 +375,10 @@
"description" : "",
"message" : "Female"
},
"FINAL_TARGET" : {
"description" : "Hyperjump planner, referring to star system target",
"message" : "Final Target:"
},
"FORWARD_ACCEL" : {
"description" : "",
"message" : "Forward acceleration"
Expand Down Expand Up @@ -775,6 +803,10 @@
"description" : "",
"message" : "Hyperdrive fitted:"
},
"HYPERJUMP_ROUTE" : {
"description" : "",
"message" : "HyperJump Route"
},
"HYPERSPACE_RANGE" : {
"description" : "",
"message" : "Hyperspace range"
Expand Down Expand Up @@ -1019,6 +1051,14 @@
"description" : "",
"message" : "More info..."
},
"MOVE_DOWN" : {
"description" : "move selection down in list",
"message" : "Move Down"
},
"MOVE_UP" : {
"description" : "move selection up in list",
"message" : "Move Up"
},
"MOSTLY_HARMLESS" : {
"description" : "",
"message" : "Mostly Harmless"
Expand Down Expand Up @@ -1255,6 +1295,14 @@
"description" : "For player reputation",
"message" : "Reliable"
},
"REMOVE_JUMP" : {
"description" : "UI-button: remove hyper jump from list of planned jumps",
"message" : "Remove Jump"
},
"REMOVE_WHEN_COMPLETED" : {
"description" : "For UI hyperjump planner, referring to jump target system",
"message" : "Remove jump when completed"
},
"REPAIR_X_HULL_DAMAGE_FOR_X" : {
"description" : "",
"message" : "Repair {damage}% hull damage for {price}"
Expand All @@ -1263,6 +1311,10 @@
"description" : "",
"message" : "Reputation"
},
"REQUIRED_FUEL" : {
"description" : "Fuel usage for traveling to star system",
"message" : "Required Fuel:"
},
"REQUEST_LAUNCH" : {
"description" : "",
"message" : "Request Launch"
Expand Down Expand Up @@ -1291,6 +1343,14 @@
"description" : "",
"message" : "Reward"
},
"ROUTE_INFO" : {
"description" : "For hyperjump planner",
"message" : "Route Info"
},
"ROUTE_JUMPS" : {
"description" : "For hyperjump planner",
"message" : "Route Jumps"
},
"SAGITTARIUS_ARM" : {
"description" : "Arm of the Milky Way galaxy",
"message" : "Sagittarius arm"
Expand Down Expand Up @@ -1339,6 +1399,10 @@
"description" : "",
"message" : "Set destination as navigation target."
},
"SETTINGS" : {
"description" : "UI option",
"message" : "Settings"
},
"SHIP" : {
"description" : "",
"message" : "Ship"
Expand Down Expand Up @@ -1451,6 +1515,14 @@
"description" : "",
"message" : "Total: "
},
"TOTAL_DISTANCE" : {
"description" : "Total distance of a (possibly series) of hyper jump(s)",
"message" : "Total Distance:"
},
"TOTAL_DURATION" : {
"description" : "Total duration of a (possibly series) of hyper jump(s)",
"message" : "Total Duration:"
},
"TOTAL_MASS" : {
"description" : "",
"message" : "Total mass"
Expand Down
69 changes: 35 additions & 34 deletions data/pigui/modules/hyperjump-planner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ local Vector = import('Vector')
local Event = import('Event')
local Lang = import("Lang")
local lc = Lang.GetResource("core")
local lui = Lang.GetResource("ui-core");
local Equipment = import("Equipment")

local player = nil
Expand All @@ -26,9 +27,9 @@ local current_fuel
local remove_first_if_current = true

local function showSettings()
if ui.collapsingHeader("Settings", {"DefaultOpen"}) then
if ui.collapsingHeader(lui.SETTINGS, {"DefaultOpen"}) then
local changed
changed, remove_first_if_current = ui.checkbox("Remove jump when completed", remove_first_if_current)
changed, remove_first_if_current = ui.checkbox(lui.REMOVE_WHEN_COMPLETED, remove_first_if_current)
end
end -- showSettings

Expand Down Expand Up @@ -61,8 +62,8 @@ local function showJumpData(start, target, status, distance, fuel, duration, sho
end
end -- showJumpData

local function showInfo()
if ui.collapsingHeader("Route Info",{"DefaultOpen"}) then
local function showInfo()
if ui.collapsingHeader(lui.ROUTE_INFO,{"DefaultOpen"}) then
local total_fuel = 0
local total_duration = 0
local total_distance = 0
Expand All @@ -78,23 +79,23 @@ local function showInfo()

start = jump
end
ui.text("Current System: " .. current_system.name .. " (" .. current_path.sectorX .. "," .. current_path.sectorY .. "," .. current_path.sectorZ ..")")
ui.text("Final Target:")

ui.text(lui.CURRENT_SYSTEM .. ": " .. current_system.name .. " (" .. current_path.sectorX .. "," .. current_path.sectorY .. "," .. current_path.sectorZ ..")")
ui.text(lui.FINAL_TARGET)

if route_jumps > 0 then
local final_path = hyperjump_route[route_jumps]
local final_sys = final_path:GetStarSystem()
ui.sameLine()
ui.text(final_sys.name .. " (" .. final_path.sectorX .. "," .. final_path.sectorY .. "," .. final_path.sectorZ .. ")")
end
ui.text("Current Fuel: " .. current_fuel .. lc.UNIT_TONNES)
ui.text(lui.CURRENT_FUEL .. " " .. current_fuel .. lc.UNIT_TONNES)
ui.sameLine()
ui.text("Required Fuel: " .. total_fuel .. lc.UNIT_TONNES)
ui.text("Total Duration: "..ui.Format.Duration(total_duration, 2))
ui.text(lui.REQUIRED_FUEL .. " " .. total_fuel .. lc.UNIT_TONNES)

ui.text(lui.TOTAL_DURATION .. " " ..ui.Format.Duration(total_duration, 2))
ui.sameLine()
ui.text("Total Distance: " ..string.format("%.2f", total_distance) .. lc.UNIT_LY)
ui.text(lui.TOTAL_DISTANCE .. " " ..string.format("%.2f", total_distance) .. lc.UNIT_LY)
end
end -- showInfo

Expand All @@ -107,14 +108,14 @@ local function mainButton(icon, tooltip, callback)
end --mainButton

local function showJumpRoute()
if ui.collapsingHeader("Route Jumps", {"DefaultOpen"}) then
mainButton(icons.forward, "Add Jump",
if ui.collapsingHeader(lui.ROUTE_JUMPS, {"DefaultOpen"}) then
mainButton(icons.forward, lui.ADD_JUMP,
function()
Engine.SectorMapAddToRoute(map_selected_path)
end)
ui.sameLine()
mainButton(icons.current_line, "Remove Jump",

mainButton(icons.current_line, lui.REMOVE_JUMP,
function()
local new_route = {}
local new_count = 0
Expand All @@ -123,8 +124,8 @@ local function showJumpRoute()
end
end)
ui.sameLine()
mainButton(icons.current_periapsis, "Move Up",

mainButton(icons.current_periapsis, lui.MOVE_UP,
function()
if selected_jump then
if Engine.SectorMapMoveRouteItemUp(selected_jump) then
Expand All @@ -133,8 +134,8 @@ local function showJumpRoute()
end
end)
ui.sameLine()
mainButton(icons.current_apoapsis, "Move Down",

mainButton(icons.current_apoapsis, lui.MOVE_DOWN,
function()
if selected_jump then
if Engine.SectorMapMoveRouteItemDown(selected_jump) then
Expand All @@ -143,31 +144,31 @@ local function showJumpRoute()
end
end)
ui.sameLine()
mainButton(icons.retrograde_thin, "Clear Route",
function()

mainButton(icons.retrograde_thin, lui.CLEAR_ROUTE,
function()
Engine.SectorMapClearRoute()
selected_jump = nil
end)
ui.sameLine()
mainButton(icons.hyperspace, "Auto Route",
function()

mainButton(icons.hyperspace, lui.AUTO_ROUTE,
function()
Engine.SectorMapAutoRoute()

end)
ui.sameLine()
mainButton(icons.search_lens, "Zoom to System",

mainButton(icons.search_lens, lui.CENTER_ON_SYSTEM,
function()
if selected_jump then
Engine.SectorMapGotoSystemPath(hyperjump_route[selected_jump])
end
end)


ui.separator()

local start = current_path
local clicked
local running_fuel = 0
Expand Down Expand Up @@ -211,7 +212,7 @@ local function showHyperJumpPlannerWindow()
ui.withStyleColors({["WindowBg"] = colors.lightBlackBackground}, function()
ui.window("MapSectorViewHyperJumpPlanner", {"NoTitleBar", "NoResize", "NoFocusOnAppearing", "NoBringToFrontOnFocus"},
function()
ui.text("HyperJump Route")
ui.text(lui.HYPERJUMP_ROUTE)
ui.separator()
showInfo()
ui.separator()
Expand Down

0 comments on commit 3d8b96b

Please sign in to comment.