Localize target menu and interaction prompts

Replaced hardcoded target menu titles, descriptions, and interaction prompts with localized strings from en.json. Updated client.lua to use Language.Locale for menu and help text, improving internationalization and consistency.
This commit is contained in:
MrNewb committed 2025-09-10 21:47:58 -04:00
1 parent a15a79603b
commit 3dfbaa8573
2 files changed
+44 -34

No files matched your search

+5
View File
@@ -33,5 +33,10 @@
"rotate_clockwise": "[%s] Rotate Clockwise \n", "rotate_clockwise": "[%s] Rotate Clockwise \n",
"rotate_counter_clockwise": "[%s] Rotate Counter-Clockwise \n", "rotate_counter_clockwise": "[%s] Rotate Counter-Clockwise \n",
"depth_modifier": "[%s] Depth Control Modifier \n" "depth_modifier": "[%s] Depth Control Modifier \n"
},
"target": {
"interact": "[E] Interact",
"title": "Options",
"description": "No Description"
} }
} }
+39 -34
View File
@@ -76,13 +76,12 @@ Target.AddLocalEntity = function(entities, _options)
end end
for _, entity in pairs(entities) do for _, entity in pairs(entities) do
local id = Ids.RandomString() local id = Ids.RandomString()
local menuData = { id = id, title = "Options", options = {} } local title = Language.Locale("target.title")
local menuData = { id = id, title = title, options = {} }
for k, v in pairs(fixedOptions) do for k, v in pairs(fixedOptions) do
table.insert(menuData.options, { table.insert(menuData.options, {
title = ("Option " .. k), title = title .. " " .. k,
description = "No Description", description = Language.Locale("target.description"),
icon = v.icon or "fas fa-code-pull-request",
args = {},
onSelect = function(selected, secondary, args) onSelect = function(selected, secondary, args)
if v.onSelect then if v.onSelect then
v.onSelect(selected, secondary, args) v.onSelect(selected, secondary, args)
@@ -90,23 +89,25 @@ Target.AddLocalEntity = function(entities, _options)
end end
}) })
end end
Point.Register(id, entity, 5, args, Point.Register(id, entity, 5, nil, function()
function()
local coords = GetEntityCoords(entity) local coords = GetEntityCoords(entity)
local sleep = 3000 local sleep = 3000
while DoesEntityExist(entity) do local test = Language.Locale("target.interact")
Wait(sleep) CreateThread(function()
local distance = #(coords - GetEntityCoords(PlayerPedId())) while DoesEntityExist(entity) do
if distance < 10 then Wait(sleep)
sleep = 0 local distance = #(coords - GetEntityCoords(PlayerPedId()))
Utility.Draw3DHelpText(coords, "Press [E] To Interact", 0.35) if distance < 2 then
if IsControlJustPressed(0, 38) then sleep = 0
Menu.Open(menuData, false) Utility.Draw3DHelpText(coords, test, 0.35)
if IsControlJustPressed(0, 38) then
Menu.Open(menuData, false)
end
else
sleep = 1000
end end
else
sleep = 3000
end end
end end)
end, end,
function() function()
Point.Remove(id) Point.Remove(id)
@@ -123,11 +124,12 @@ end
Target.AddBoxZone = function(name, coords, size, heading, options) Target.AddBoxZone = function(name, coords, size, heading, options)
local fixedOptions = Target.FixOptions(_options) local fixedOptions = Target.FixOptions(_options)
local id = Ids.RandomString() local id = Ids.RandomString()
local menuData = { id = id, title = "Options", options = {} } local title = Language.Locale("target.title")
local menuData = { id = id, title = title, options = {} }
for k, v in pairs(fixedOptions) do for k, v in pairs(fixedOptions) do
table.insert(menuData.options, { table.insert(menuData.options, {
title = ("Option " .. k), title = title .. " " .. k,
description = "No Description", description = Language.Locale("target.description"),
onSelect = function(selected, secondary, args) onSelect = function(selected, secondary, args)
if v.onSelect then if v.onSelect then
v.onSelect(selected, secondary, args) v.onSelect(selected, secondary, args)
@@ -135,22 +137,25 @@ Target.AddBoxZone = function(name, coords, size, heading, options)
end end
}) })
end end
Point.Register(id, coords, 5, args, local inZone = false
function() local test = Language.Locale("target.interact")
Point.Register(id, coords, 5, nil, function()
local sleep = 3000 local sleep = 3000
while true do CreateThread(function()
Wait(sleep) while inZone do
local distance = #(coords - GetEntityCoords(PlayerPedId())) Wait(sleep)
if distance < 10 then local distance = #(coords - GetEntityCoords(PlayerPedId()))
sleep = 0 if distance < 2 then
Utility.Draw3DHelpText(coords, "Press [E] To Interact", 0.35) sleep = 0
if IsControlJustPressed(0, 38) then Utility.Draw3DHelpText(coords, test, 0.35)
Menu.Open(menuData, false) if IsControlJustPressed(0, 38) then
Menu.Open(menuData, false)
end
else
sleep = 1000
end end
else
sleep = 3000
end end
end end)
end, end,
function() function()
Point.Remove(id) Point.Remove(id)