Multi-language support

This commit is contained in:
Unknown
2017-08-16 15:30:22 -04:00
parent 7f1a14be3d
commit 9b2852dc68
5 changed files with 40 additions and 12 deletions
+8
View File
@@ -4,9 +4,17 @@ description 'ESX Billing'
server_scripts {
'@mysql-async/lib/MySQL.lua',
'@es_extended/locale.lua',
'locales/en.lua',
'locales/fr.lua',
'config.lua',
'server/main.lua'
}
client_scripts {
'@es_extended/locale.lua',
'locales/en.lua',
'locales/fr.lua',
'config.lua',
'client/main.lua'
}
+2
View File
@@ -0,0 +1,2 @@
Config = {}
Config.Locale = 'fr'
+9
View File
@@ -0,0 +1,9 @@
Locales['en'] = {
['invoices'] = 'invoices',
['received_invoice'] = 'you ~r~received~s~ an invoice',
['paid_invoice'] = 'you ~g~paid~s~ an invoice of ~r~$',
['received_payment'] = 'you ~g~received~s~ a payment of ~r~$',
['player_not_logged'] = 'the player is not logged in',
}
+9
View File
@@ -0,0 +1,9 @@
Locales['fr'] = {
['invoices'] = 'factures',
['received_invoice'] = 'vous avez ~r~reçu~s~ une facture',
['paid_invoice'] = 'vous avez ~g~payé~s~ une facture de ~r~$',
['received_payment'] = 'vous avez ~g~reçu~s~ un paiement de ~g~$',
['player_not_logged'] = 'le joueur n\'est pas connecté',
}
+12 -12
View File
@@ -26,7 +26,7 @@ AddEventHandler('esx_billing:sendBill', function(playerId, sharedAccountName, la
['@amount'] = amount
},
function(rowsChanged)
TriggerClientEvent('esx:showNotification', v.source, 'Vous avez ~r~reçu~s~ une facture')
TriggerClientEvent('esx:showNotification', v.source, _U('received_invoice'))
end
)
@@ -51,7 +51,7 @@ AddEventHandler('esx_billing:sendBill', function(playerId, sharedAccountName, la
['@amount'] = amount
},
function(rowsChanged)
TriggerClientEvent('esx:showNotification', v.source, 'Vous avez ~r~reçu~s~ une facture')
TriggerClientEvent('esx:showNotification', v.source, _U('received_invoice'))
end
)
@@ -114,7 +114,7 @@ ESX.RegisterServerCallback('esx_billing:payBill', function(source, cb, id)
local target = result[1].target
local amount = result[1].amount
local xPlayers = ESX.GetPlayers()
local foundPlayer = nil
local foundPlayer = nil
for k,v in pairs(xPlayers) do
if v.identifier == sender then
@@ -126,7 +126,7 @@ ESX.RegisterServerCallback('esx_billing:payBill', function(source, cb, id)
if targetType == 'player' then
if foundPlayer ~= nil then
if xPlayer.get('money') >= amount then
MySQL.Async.execute(
@@ -139,8 +139,8 @@ ESX.RegisterServerCallback('esx_billing:payBill', function(source, cb, id)
xPlayer.removeMoney(amount)
foundPlayer.addMoney(amount)
TriggerClientEvent('esx:showNotification', xPlayer.source, 'Vous avez ~g~payé~s~ une facture de ~r~$' .. amount)
TriggerClientEvent('esx:showNotification', foundPlayer.source, 'Vous avez ~g~reçu~s~ un paiement de ~g~$' .. amount)
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('paid_invoice') .. amount)
TriggerClientEvent('esx:showNotification', foundPlayer.source, _U('received_payment') .. amount)
cb()
@@ -148,7 +148,7 @@ ESX.RegisterServerCallback('esx_billing:payBill', function(source, cb, id)
)
else
TriggerClientEvent('esx:showNotification', _source, 'Le joueur n\'est pas connecté')
TriggerClientEvent('esx:showNotification', _source, _U('player_not_logged'))
cb()
end
@@ -168,17 +168,17 @@ ESX.RegisterServerCallback('esx_billing:payBill', function(source, cb, id)
xPlayer.removeMoney(amount)
account.addMoney(amount)
TriggerClientEvent('esx:showNotification', xPlayer.source, 'Vous avez ~g~payé~s~ une facture de ~r~$' .. amount)
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('paid_invoice') .. amount)
if foundPlayer ~= nil then
TriggerClientEvent('esx:showNotification', foundPlayer.source, 'Vous avez ~g~reçu~s~ un paiement de ~g~$' .. amount)
TriggerClientEvent('esx:showNotification', foundPlayer.source, _U('received_payment') .. amount)
end
cb()
end
)
end)
end
@@ -186,4 +186,4 @@ ESX.RegisterServerCallback('esx_billing:payBill', function(source, cb, id)
end
)
end)
end)