Skip to content

Commit

Permalink
feat: ox locales
Browse files Browse the repository at this point in the history
  • Loading branch information
Swellington-Soares authored Oct 4, 2024
1 parent 01e1dd2 commit 84c6a0c
Show file tree
Hide file tree
Showing 34 changed files with 471 additions and 561 deletions.
46 changes: 23 additions & 23 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ local function getDeliveryLocation()
if dist < 20 then
DrawMarker(2, sharedConfig.npcLocations.deliverLocations[NpcData.CurrentDeliver].x, sharedConfig.npcLocations.deliverLocations[NpcData.CurrentDeliver].y, sharedConfig.npcLocations.deliverLocations[NpcData.CurrentDeliver].z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.3, 255, 255, 255, 255, false, false, 0, true, nil, nil, false)
if dist < 5 then
qbx.drawText3d({text = Lang:t('info.drop_off_npc'), coords = sharedConfig.npcLocations.deliverLocations[NpcData.CurrentDeliver].xyz})
qbx.drawText3d({text = locale('info.drop_off_npc'), coords = sharedConfig.npcLocations.deliverLocations[NpcData.CurrentDeliver].xyz})
if IsControlJustPressed(0, 38) then
TaskLeaveVehicle(NpcData.Npc, cache.vehicle, 0)
SetEntityAsMissionEntity(NpcData.Npc, false, true)
Expand All @@ -120,7 +120,7 @@ local function getDeliveryLocation()
SendNUIMessage({
action = 'resetMeter'
})
exports.qbx_core:Notify(Lang:t('info.person_was_dropped_off'), 'success')
exports.qbx_core:Notify(locale('info.person_was_dropped_off'), 'success')
if NpcData.DeliveryBlip then
RemoveBlip(NpcData.DeliveryBlip)
end
Expand Down Expand Up @@ -171,7 +171,7 @@ local function callNpcPoly()
ClearPedTasksImmediately(NpcData.Npc)
FreezeEntityPosition(NpcData.Npc, false)
TaskEnterVehicle(NpcData.Npc, veh, -1, freeSeat, 1.0, 0)
exports.qbx_core:Notify(Lang:t('info.go_to_location'), 'inform')
exports.qbx_core:Notify(locale('info.go_to_location'), 'inform')
if NpcData.NpcBlip then
RemoveBlip(NpcData.NpcBlip)
end
Expand All @@ -190,7 +190,7 @@ end
local function onEnterCallZone()
if whitelistedVehicle() and not isInsidePickupZone and not NpcData.NpcTaken then
isInsidePickupZone = true
lib.showTextUI(Lang:t('info.call_npc'), {position = 'left-center'})
lib.showTextUI(locale('info.call_npc'), {position = 'left-center'})
callNpcPoly()
end
end
Expand Down Expand Up @@ -277,7 +277,7 @@ end
local function onEnterDropZone()
if whitelistedVehicle() and not isInsideDropZone and NpcData.NpcTaken then
isInsideDropZone = true
lib.showTextUI(Lang:t('info.drop_off_npc'), {position = 'left-center'})
lib.showTextUI(locale('info.drop_off_npc'), {position = 'left-center'})
dropNpcPoly()
end
end
Expand Down Expand Up @@ -321,7 +321,7 @@ function dropNpcPoly()
SendNUIMessage({
action = 'resetMeter'
})
exports.qbx_core:Notify(Lang:t('info.person_was_dropped_off'), 'success')
exports.qbx_core:Notify(locale('info.person_was_dropped_off'), 'success')
if NpcData.DeliveryBlip ~= nil then
RemoveBlip(NpcData.DeliveryBlip)
end
Expand Down Expand Up @@ -351,14 +351,14 @@ local function setLocationsBlip()
SetBlipAsShortRange(taxiBlip, true)
SetBlipColour(taxiBlip, 5)
BeginTextCommandSetBlipName('STRING')
AddTextComponentSubstringPlayerName(Lang:t('info.blip_name'))
AddTextComponentSubstringPlayerName(locale('info.blip_name'))
EndTextCommandSetBlipName(taxiBlip)
end

local function taxiGarage()
local registeredMenu = {
id = 'garages_depotlist',
title = Lang:t('menu.taxi_menu_header'),
title = locale('menu.taxi_menu_header'),
options = {}
}
local options = {}
Expand Down Expand Up @@ -390,14 +390,14 @@ local function setupGarageZone()
type = 'client',
event = 'qb-taxijob:client:requestcab',
icon = 'fa-solid fa-taxi',
label = Lang:t('info.request_taxi_target'),
label = locale('info.request_taxi_target'),
job = 'taxi',
}
})
else
local function onEnter()
if not cache.vehicle then
lib.showTextUI(Lang:t('info.request_taxi'))
lib.showTextUI(locale('info.request_taxi'))
end
end

Expand Down Expand Up @@ -447,12 +447,12 @@ function setupTaxiParkingZone()
meterActive = false
end
DeleteVehicle(cache.vehicle)
exports.qbx_core:Notify(Lang:t('info.taxi_returned'), 'success')
exports.qbx_core:Notify(locale('info.taxi_returned'), 'success')
end
end
end,
onEnter = function()
lib.showTextUI(Lang:t('info.vehicle_parking'))
lib.showTextUI(locale('info.vehicle_parking'))
end,
onExit = function()
lib.hideTextUI()
Expand All @@ -478,10 +478,10 @@ RegisterNetEvent('qb-taxi:client:TakeVehicle', function(data)
SetVehicleFuelLevel(veh, 100.0)
SetVehicleEngineOn(veh, true, true, false)
else
exports.qbx_core:Notify(Lang:t('info.no_spawn_point'), 'error')
exports.qbx_core:Notify(locale('info.no_spawn_point'), 'error')
end
else
exports.qbx_core:Notify(Lang:t('info.no_spawn_point'), 'error')
exports.qbx_core:Notify(locale('info.no_spawn_point'), 'error')
return
end
end)
Expand All @@ -508,7 +508,7 @@ RegisterNetEvent('qb-taxi:client:DoTaxiNpc', function()
if NpcData.NpcBlip ~= nil then
RemoveBlip(NpcData.NpcBlip)
end
exports.qbx_core:Notify(Lang:t('info.npc_on_gps'), 'success')
exports.qbx_core:Notify(locale('info.npc_on_gps'), 'success')

-- added checks to disable distance checking if polyzone option is used
if config.useTarget then
Expand All @@ -534,7 +534,7 @@ RegisterNetEvent('qb-taxi:client:DoTaxiNpc', function()
DrawMarker(2, sharedConfig.npcLocations.takeLocations[NpcData.CurrentNpc].x, sharedConfig.npcLocations.takeLocations[NpcData.CurrentNpc].y, sharedConfig.npcLocations.takeLocations[NpcData.CurrentNpc].z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.3, 255, 255, 255, 255, false, false, 0, true, nil, nil, false)

if dist < 5 then
qbx.drawText3d({text = Lang:t('info.call_npc'), coords = sharedConfig.npcLocations.takeLocations[NpcData.CurrentNpc].xyz})
qbx.drawText3d({text = locale('info.call_npc'), coords = sharedConfig.npcLocations.takeLocations[NpcData.CurrentNpc].xyz})
if IsControlJustPressed(0, 38) then
local maxSeats, freeSeat = GetVehicleMaxNumberOfPassengers(cache.vehicle), 0

Expand All @@ -559,7 +559,7 @@ RegisterNetEvent('qb-taxi:client:DoTaxiNpc', function()
ClearPedTasksImmediately(NpcData.Npc)
FreezeEntityPosition(NpcData.Npc, false)
TaskEnterVehicle(NpcData.Npc, cache.vehicle, -1, freeSeat, 1.0, 0)
exports.qbx_core:Notify(Lang:t('info.go_to_location'), 'inform')
exports.qbx_core:Notify(locale('info.go_to_location'), 'inform')
if NpcData.NpcBlip ~= nil then
RemoveBlip(NpcData.NpcBlip)
end
Expand All @@ -574,10 +574,10 @@ RegisterNetEvent('qb-taxi:client:DoTaxiNpc', function()
end)
end
else
exports.qbx_core:Notify(Lang:t('error.already_mission'), 'error')
exports.qbx_core:Notify(locale('error.already_mission'), 'error')
end
else
exports.qbx_core:Notify(Lang:t('error.not_in_taxi'), 'error')
exports.qbx_core:Notify(locale('error.not_in_taxi'), 'error')
end
end)

Expand All @@ -599,10 +599,10 @@ RegisterNetEvent('qb-taxi:client:toggleMeter', function()
meterIsOpen = false
end
else
exports.qbx_core:Notify(Lang:t('error.missing_meter'), 'error')
exports.qbx_core:Notify(locale('error.missing_meter'), 'error')
end
else
exports.qbx_core:Notify(Lang:t('error.no_vehicle'), 'error')
exports.qbx_core:Notify(locale('error.no_vehicle'), 'error')
end
end)

Expand All @@ -612,7 +612,7 @@ RegisterNetEvent('qb-taxi:client:enableMeter', function()
action = 'toggleMeter'
})
else
exports.qbx_core:Notify(Lang:t('error.not_active_meter'), 'error')
exports.qbx_core:Notify(locale('error.not_active_meter'), 'error')
end
end)

Expand All @@ -624,7 +624,7 @@ RegisterNetEvent('qb-taxi:client:toggleMuis', function()
mouseActive = true
end
else
exports.qbx_core:Notify(Lang:t('error.no_meter_sight'), 'error')
exports.qbx_core:Notify(locale('error.no_meter_sight'), 'error')
end
end)

Expand Down
2 changes: 1 addition & 1 deletion config/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ return {
debugPoly = false,
useBlips = true,
allowedVehicles = {
{ model = 'taxi', label = Lang:t('info.taxi_label_1') }
{ model = 'taxi', label = locale('info.taxi_label_1') }
},
meter = {
defaultPrice = 125.0, -- price per mile
Expand Down
10 changes: 4 additions & 6 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ version '1.0.0'

shared_scripts {
'@ox_lib/init.lua',
'@qbx_core/modules/lib.lua',
'@qbx_core/shared/locale.lua',
'locales/en.lua',
'locales/*.lua'
'@qbx_core/modules/lib.lua'
}

client_scripts {
Expand All @@ -29,11 +26,12 @@ files {
'html/reset.css',
'html/g5-meter.png',
'config/client.lua',
'config/shared.lua'
'config/shared.lua',
'locales/*.json'
}

provide 'qb-taxijob'
lua54 'yes'
use_experimental_fxv2_oal 'yes'

ox_lib 'locale'
dependency 'qbx_core'
26 changes: 26 additions & 0 deletions locales/ar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"error": {
"already_mission": "أنت تقوم بالفعل بمهمة نقل السكان الاصلين",
"not_in_taxi": "أنت لست في سيارة أجرة",
"missing_meter": "هذه السيارة لا تحتوي على عداد سيارات الأجرة",
"no_vehicle": "أنت لست في سيارة",
"not_active_meter": "عداد سيارة الأجرة غير نشط",
"no_meter_sight": "لا يوجد عداد سيارات الأجرة في الأفق"
},
"success": {},
"info": {
"person_was_dropped_off": "تم إنزال الشخص",
"npc_on_gps": "تم الاشاة لك في الخريطة عن المكان",
"go_to_location": "إحضار إلى الموقع المحدد",
"vehicle_parking": "[~g~E~w~] - ﺕﺍﺭﺍﻳﺳﻟﺍ ﺝﺍﺭﻏ",
"job_vehicles": "[~g~E~w~] - ﻞﻤﻌﻟﺍ ﺝﺍﺭﻏ",
"drop_off_npc": "[~g~E~w~] - ﺎﻨﻠﺻﻭ",
"call_npc": "[~g~E~w~] - ﺐﻛﺭﺍ",
"blip_name": "ﻲﺴﻛﺎﺘﻟﺍ ﺰﻛﺮﻣ",
"taxi_label_1": "تاكسي"
},
"menu": {
"taxi_menu_header": "سيارات التاكسي",
"close_menu": "⬅ إغلاق"
}
}
34 changes: 0 additions & 34 deletions locales/ar.lua

This file was deleted.

31 changes: 31 additions & 0 deletions locales/cs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"error": {
"already_mission": "Již provádíš NPC misi",
"not_in_taxi": "Nejsi v taxíku",
"missing_meter": "Toto vozidlo nemá taxametr",
"no_vehicle": "Nejsi v vozidle",
"not_active_meter": "Taxametr není aktivní",
"no_meter_sight": "Žádný taxametr není v dohledu"
},
"success": {},
"info": {
"person_was_dropped_off": "Osoba byla vysazena!",
"npc_on_gps": "NPC je označeno na tvém GPS",
"go_to_location": "Doveď NPC na určené místo",
"vehicle_parking": "[E] Parkování vozidla",
"job_vehicles": "[E] Pracovní vozidla",
"drop_off_npc": "[E] Vysadit NPC",
"call_npc": "[E] Zavolat NPC",
"blip_name": "Downtown Cab",
"taxi_label_1": "Standardní taxi",
"no_spawn_point": "Nepodařilo se najít místo pro zaparkování taxíku",
"taxi_returned": "Taxík zaparkován",
"request_taxi": "🚕 Objednat taxík",
"take_vehicle": "Vezmi naše "
},
"menu": {
"taxi_menu_header": "Taxi vozidla",
"close_menu": "⬅ Zavřít menu",
"boss_menu": "Menu šéfa"
}
}
40 changes: 0 additions & 40 deletions locales/cs.lua

This file was deleted.

26 changes: 26 additions & 0 deletions locales/da.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"error": {
"already_mission": "Du laver allerede en NPC Mission",
"not_in_taxi": "Du er ikke i en taxa",
"missing_meter": "Dette køretøj har intet taxameter",
"no_vehicle": "Du er ikke i et køretøj",
"not_active_meter": "Taxameteret er ikke aktivt",
"no_meter_sight": "Intet taxameter at se"
},
"success": {},
"info": {
"person_was_dropped_off": "Personen blev sat af!",
"npc_on_gps": "En NPC er markeret på din GPS",
"go_to_location": "Kør en NPC til lokationen",
"vehicle_parking": "[E] Køretøjs parkering",
"job_vehicles": "[E] Job køretøjer",
"drop_off_npc": "[E] Sæt NPC af",
"call_npc": "[E] Kald en NPC",
"blip_name": "Midtby taxa",
"taxi_label_1": "Standart taxa"
},
"menu": {
"taxi_menu_header": "Taxa køretøjer",
"close_menu": "⬅ Luk menuen"
}
}
Loading

0 comments on commit 84c6a0c

Please sign in to comment.