Skip to content

Commit

Permalink
add translate eng and spanish and clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
jeann2013 committed Dec 26, 2023
1 parent b116f29 commit 0505c22
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
17 changes: 11 additions & 6 deletions client/job.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@ local FingerPrintSessionId = nil

function CreatePrompts()
for k,v in pairs(Config.Locations['duty']) do
exports['qbr-core']:createPrompt('duty_prompt_' .. k, v, 0xF3830D8E, 'Toggle duty status', {
exports['qbr-core']:createPrompt('duty_prompt_' .. k, v, 0xF3830D8E, Lang:t('prompt.toggle_duty_status'), {
type = 'client',
event = 'qb-policejob:ToggleDuty',
args = {},
})
end

for k,v in pairs(Config.Locations['evidence']) do
exports['qbr-core']:createPrompt('evidence_prompt_' .. k, v, 0xF3830D8E, 'Open Evidence Stash', {
exports['qbr-core']:createPrompt('evidence_prompt_' .. k, v, 0xF3830D8E, Lang:t('prompt.open_evidence_stash'), {
type = 'client',
event = 'police:client:EvidenceStashDrawer',
args = { k },
})
end

for k,v in pairs(Config.Locations['stash']) do
exports['qbr-core']:createPrompt('stash_prompt_' .. k, v, 0xF3830D8E, 'Open Personal Stash', {
exports['qbr-core']:createPrompt('stash_prompt_' .. k, v, 0xF3830D8E, Lang:t('prompt.open_personal_stash'), {
type = 'client',
event = 'police:client:OpenPersonalStash',
args = {},
})
end

for k,v in pairs(Config.Locations['armory']) do
exports['qbr-core']:createPrompt('armory_prompt_' .. k, v, 0xF3830D8E, 'Open Armory', {
exports['qbr-core']:createPrompt('armory_prompt_' .. k, v, 0xF3830D8E, Lang:t('prompt.open_armory'), {
type = 'client',
event = 'police:client:OpenArmory',
args = {},
Expand Down Expand Up @@ -91,13 +91,18 @@ local function IsArmoryWhitelist() -- being removed
end

local function SetWeaponSeries()
for k, v in pairs(Config.Items.items) do
for k, v in ipairs(Config.Items.items) do
if k < 6 then
Config.Items.items[k].info.serie = tostring(exports['qbr-core']:RandomInt(2) .. exports['qbr-core']:RandomStr(3) .. exports['qbr-core']:RandomInt(1) .. exports['qbr-core']:RandomStr(2) .. exports['qbr-core']:RandomInt(3) .. exports['qbr-core']:RandomStr(4))
local randomInt = exports['qbr-core']:RandomInt
local randomStr = exports['qbr-core']:RandomStr

local serie = tostring(randomInt(2) .. randomStr(3) .. randomInt(1) .. randomStr(2) .. randomInt(3) .. randomStr(4))
Config.Items.items[k].info.serie = serie
end
end
end


RegisterNetEvent('police:client:ImpoundVehicle', function(fullImpound, price)
local vehicle = exports['qbr-core']:GetClosestVehicle()
local bodyDamage = math.ceil(GetVehicleBodyHealth(vehicle))
Expand Down
6 changes: 6 additions & 0 deletions locales/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ local Translations = {
place_object = 'Placing object..',
remove_object = 'Removing object..',
},
prompt = {
toggle_duty_status = 'Toggle duty status',
open_evidence_stash = 'Open Evidence Stash',
open_personal_stash = 'Open Personal Stash',
open_armory = 'Open Armory',
},
}

Lang = Locale:new({
Expand Down
6 changes: 6 additions & 0 deletions locales/es.lua
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ local Translations = {
place_object = 'Colocando objeto..',
remove_object = 'Eliminando objeto..',
},
prompt = {
toggle_duty_status = 'Alternar estado de servicio',
open_evidence_stash = 'Abrir inventario de pruebas',
open_personal_stash = 'Abrir inventario personal',
open_armory = 'Armería Abierta',
},
}

if GetConvar('qbr_locale', 'en') == 'es' then
Expand Down

0 comments on commit 0505c22

Please sign in to comment.