Skip to content

Commit

Permalink
Multi-language support
Browse files Browse the repository at this point in the history
Updated readme with proper clone link, and moved it to the front directory.
  • Loading branch information
nearbyplayer committed Aug 15, 2017
1 parent 3eb0647 commit d95ac08
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 10 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion esx_weashops/README.md → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FXServer ESX Weapon Shops
1) CD in your resources/[esx] folder
2) Clone the repository
```
git clone https://github.com/FXServer-ESX/fxserver-esx_weashops.git esx_weashops
```
3) Import esx_weashops.sql in your database
4) Add this in your server.cfg :
Expand Down
6 changes: 6 additions & 0 deletions esx_weashops/__resource.lua → __resource.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
description 'ESX Mecano Job'

client_scripts {
'@es_extended/locale.lua',
'locales/en.lua',
'locales/fr.lua',
'config.lua',
'client/main.lua'
}

server_scripts {
'@es_extended/locale.lua',
'locales/en.lua',
'locales/fr.lua',
'@mysql-async/lib/MySQL.lua',
'config.lua',
'server/main.lua'
Expand Down
8 changes: 4 additions & 4 deletions esx_weashops/client/main.lua → client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function OpenShopMenu(zone)
ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'shop',
{
title = 'Magasin',
title = _U('shop'),
elements = elements
},
function(data, menu)
Expand All @@ -56,7 +56,7 @@ function OpenShopMenu(zone)
menu.close()

CurrentAction = 'shop_menu'
CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au magasin.'
CurrentActionMsg = _U('shop_menu')
CurrentActionData = {zone = zone}
end
)
Expand All @@ -65,7 +65,7 @@ end
AddEventHandler('esx_weashop:hasEnteredMarker', function(zone)

CurrentAction = 'shop_menu'
CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au magasin.'
CurrentActionMsg = _U('shop_menu')
CurrentActionData = {zone = zone}

end)
Expand All @@ -89,7 +89,7 @@ Citizen.CreateThread(function()
SetBlipColour (blip, 2)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("GunShop")
AddTextComponentString(_U('map_blip'))
EndTextCommandSetBlipName(blip)
end
end
Expand Down
1 change: 1 addition & 0 deletions esx_weashops/config.lua → config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Config.DrawDistance = 100
Config.Size = {x = 1.5, y = 1.5, z = 1.5}
Config.Color = {r = 0, g = 128, b = 255}
Config.Type = 1
Config.Locale = 'en'

Config.Zones = {

Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions locales/en.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Locales ['en'] = {

['buy'] = 'you bought',
['not_enough_black'] = 'you do not have enough dirty money',
['not_enough'] = 'you do not have enough money',
['shop'] = 'shop',
['shop_menu'] = 'Press ~INPUT_CONTENT~ to access the shop.',
['map_blip'] = 'gun shop',

}
10 changes: 10 additions & 0 deletions locales/fr.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Locales ['fr'] = {

['buy'] = 'vous avez acheté ~b~1x ',
['not_enough_black'] = 'Vous n\'avez ~r~pas assez~s~ d\'argent sale',
['not_enough'] = 'vous n\'avez ~r~pas assez~s~ d\'argent',
['shop'] = 'magasin',
['shop_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder au magasin.',
['map_blip'] = 'armurerie',

}
10 changes: 5 additions & 5 deletions esx_weashops/server/main.lua → server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ESX.RegisterServerCallback('esx_weashop:requestDBItems', function(source, cb)
end)

RegisterServerEvent('esx_weashop:buyItem')
AddEventHandler('esx_weashop:buyItem', function(itemName, price,zone)
AddEventHandler('esx_weashop:buyItem', function(itemName, price, zone)

local _source = source
local xPlayer = ESX.GetPlayerFromId(source)
Expand All @@ -61,21 +61,21 @@ AddEventHandler('esx_weashop:buyItem', function(itemName, price,zone)

xPlayer.removeAccountMoney('black_money', price)
xPlayer.addWeapon(itemName, 42)
TriggerClientEvent('esx:showNotification', _source, 'Vous avez acheté ~b~1x ' .. ItemsLabels[itemName])
TriggerClientEvent('esx:showNotification', _source, _U('buy') .. ItemsLabels[itemName])

else
TriggerClientEvent('esx:showNotification', _source, 'Vous n\'avez ~r~pas assez~s~ d\'argent sale')
TriggerClientEvent('esx:showNotification', _source, _U('not_enough_black'))
end

else if xPlayer.get('money') >= price then

xPlayer.removeMoney(price)
xPlayer.addWeapon(itemName, 42)

TriggerClientEvent('esx:showNotification', _source, 'Vous avez acheté ~b~1x ' .. ItemsLabels[itemName])
TriggerClientEvent('esx:showNotification', _source, _U('buy') .. ItemsLabels[itemName])

else
TriggerClientEvent('esx:showNotification', _source, 'Vous n\'avez ~r~pas assez~s~ d\'argent.')
TriggerClientEvent('esx:showNotification', _source, _U('not_enough'))
end
end

Expand Down

0 comments on commit d95ac08

Please sign in to comment.