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
+29 -19

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"
} }
} }
+24 -19
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
local test = Language.Locale("target.interact")
CreateThread(function()
while DoesEntityExist(entity) do while DoesEntityExist(entity) do
Wait(sleep) Wait(sleep)
local distance = #(coords - GetEntityCoords(PlayerPedId())) local distance = #(coords - GetEntityCoords(PlayerPedId()))
if distance < 10 then if distance < 2 then
sleep = 0 sleep = 0
Utility.Draw3DHelpText(coords, "Press [E] To Interact", 0.35) Utility.Draw3DHelpText(coords, test, 0.35)
if IsControlJustPressed(0, 38) then if IsControlJustPressed(0, 38) then
Menu.Open(menuData, false) Menu.Open(menuData, false)
end end
else else
sleep = 3000 sleep = 1000
end 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()
while inZone do
Wait(sleep) Wait(sleep)
local distance = #(coords - GetEntityCoords(PlayerPedId())) local distance = #(coords - GetEntityCoords(PlayerPedId()))
if distance < 10 then if distance < 2 then
sleep = 0 sleep = 0
Utility.Draw3DHelpText(coords, "Press [E] To Interact", 0.35) Utility.Draw3DHelpText(coords, test, 0.35)
if IsControlJustPressed(0, 38) then if IsControlJustPressed(0, 38) then
Menu.Open(menuData, false) Menu.Open(menuData, false)
end end
else else
sleep = 3000 sleep = 1000
end end
end end
end)
end, end,
function() function()
Point.Remove(id) Point.Remove(id)