Multi-language support

This commit is contained in:
nearbyplayer
2017-08-22 00:46:41 -04:00
parent 6d69f2182e
commit 2163d0c8d9
6 changed files with 104 additions and 51 deletions
+7 -1
View File
@@ -1,8 +1,14 @@
server_scripts {
'@es_extended/locale.lua',
'locales/en.lua',
'locales/fr.lua',
'server/main.lua'
}
client_scripts {
'@es_extended/locale.lua',
'locales/en.lua',
'locales/fr.lua',
'config.lua',
'client/main.lua'
}
}
+18 -18
View File
@@ -40,14 +40,14 @@ function OpenLSMenu(elems, menuname, menutitle, parent)
local found = false
for k,v in pairs(Config.Menus) do
if k == data.current.modType or isRimMod then
if data.current.label == "Par défaut" or string.match(data.current.label, "Installé") then
ESX.ShowNotification("Vous possédez déjà: ~b~" .. data.current.label)
if data.current.label == _U('by_default') or string.match(data.current.label, _U('installed')) then
ESX.ShowNotification(_U('already_own') .. data.current.label)
else
if isRimMod then
TriggerServerEvent("esx_lscustom:buyMod", data.current.price)
else
TriggerServerEvent("esx_lscustom:buyMod", v.price)
end
end
end
menu.close()
found = true
@@ -64,7 +64,7 @@ function OpenLSMenu(elems, menuname, menutitle, parent)
if parent == nil then
lsMenuIsShowed = false
local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
FreezeEntityPosition(vehicle, false)
FreezeEntityPosition(vehicle, false)
myCar = nil
end
end,
@@ -122,16 +122,16 @@ function GetAction(data)
if v.modType ~= nil then
if v.modType == 22 then
table.insert(elements, {label = " Par défaut", modType = k, modNum = false})
table.insert(elements, {label = " " .. _U('by_default'), modType = k, modNum = false})
else
table.insert(elements, {label = " Par défaut", modType = k, modNum = -1})
table.insert(elements, {label = " " .. _U('by_default'), modType = k, modNum = -1})
end
if v.modType == 14 then -- HORNS
for j = 0, 51, 1 do
local _label = ''
if j == currentMods.modHorns then
_label = GetHornName(j) .. ' - <span style="color:cornflowerblue;">Installé</span>'
_label = GetHornName(j) .. ' - <span style="color:cornflowerblue;">'.. _U('installed') ..'</span>'
else
_label = GetHornName(j) .. ' - <span style="color:green;">$' .. v.price .. ' </span>'
end
@@ -141,7 +141,7 @@ function GetAction(data)
for j = 0, 4, 1 do
local _label = ''
if j == currentMods.plateIndex then
_label = GetPlatesName(j) .. ' - <span style="color:cornflowerblue;">Installé</span>'
_label = GetPlatesName(j) .. ' - <span style="color:cornflowerblue;">'.. _U('installed') ..'</span>'
else
_label = GetPlatesName(j) .. ' - <span style="color:green;">$' .. v.price .. ' </span>'
end
@@ -150,7 +150,7 @@ function GetAction(data)
elseif v.modType == 22 then -- XENON
local _label = ''
if currentMods.modXenon then
_label = 'Xénon - <span style="color:cornflowerblue;">Installé</span>'
_label = 'Xénon - <span style="color:cornflowerblue;">'.. _U('installed') ..'</span>'
else
_label = 'Xénon - <span style="color:green;">$' .. v.price .. ' </span>'
end
@@ -177,7 +177,7 @@ function GetAction(data)
for j = 1, 5, 1 do
local _label = ''
if j == currentMods.modHorns then
_label = GetWindowName(j) .. ' - <span style="color:cornflowerblue;">Installé</span>'
_label = GetWindowName(j) .. ' - <span style="color:cornflowerblue;">'.. _U('installed') ..'</span>'
else
_label = GetWindowName(j) .. ' - <span style="color:green;">$' .. v.price .. ' </span>'
end
@@ -195,7 +195,7 @@ function GetAction(data)
if modName ~= nil then
local _label = ''
if j == currentMods.modFrontWheels then
_label = GetLabelText(modName) .. ' - <span style="color:cornflowerblue;">Installé</span>'
_label = GetLabelText(modName) .. ' - <span style="color:cornflowerblue;">'.. _U('installed') ..'</span>'
else
_label = GetLabelText(modName) .. ' - <span style="color:green;">$' .. v.price .. ' </span>'
end
@@ -207,7 +207,7 @@ function GetAction(data)
for j = 0, modCount-1, 1 do
local _label = ''
if j == currentMods[k] then
_label = 'Niveau ' .. j .. ' - <span style="color:cornflowerblue;">Installé</span>'
_label = 'Niveau ' .. j .. ' - <span style="color:cornflowerblue;">'.. _U('installed') ..'</span>'
else
_label = 'Niveau ' .. j .. ' - <span style="color:green;">$' .. v.price .. ' </span>'
end
@@ -220,7 +220,7 @@ function GetAction(data)
if modName ~= nil then
local _label = ''
if j == currentMods[k] then
_label = GetLabelText(modName) .. ' - <span style="color:cornflowerblue;">Installé</span>'
_label = GetLabelText(modName) .. ' - <span style="color:cornflowerblue;">'.. _U('installed') ..'</span>'
else
_label = GetLabelText(modName) .. ' - <span style="color:green;">$' .. v.price .. ' </span>'
end
@@ -236,12 +236,12 @@ function GetAction(data)
elseif data.value == 'secondaryRespray' then
table.insert(elements, {label = Config.Colors[i].label, value = 'color2', color = Config.Colors[i].value})
elseif data.value == 'pearlescentRespray' then
table.insert(elements, {label = Config.Colors[i].label, value = 'pearlescentColor', color = Config.Colors[i].value})
table.insert(elements, {label = Config.Colors[i].label, value = 'pearlescentColor', color = Config.Colors[i].value})
elseif data.value == 'modFrontWheelsColor' then
table.insert(elements, {label = Config.Colors[i].label, value = 'wheelColor', color = Config.Colors[i].value})
end
end
else
else
for l,w in pairs(v) do
if l ~= 'label' and l ~= 'parent' then
table.insert(elements, {label = w, value = l})
@@ -298,12 +298,12 @@ Citizen.CreateThread(function()
end
end
if IsControlJustReleased(0, 38) and not lsMenuIsShowed and isInLSMarker then
if IsControlJustReleased(0, 38) and not lsMenuIsShowed and isInLSMarker then
lsMenuIsShowed = true
local vehicle = GetVehiclePedIsIn(playerPed, false)
--SetVehicleUndriveable(vehicle, true)
--SetVehicleUndriveable(vehicle, true)
FreezeEntityPosition(vehicle, true)
myCar = ESX.Game.GetVehicleProperties(vehicle)
@@ -335,4 +335,4 @@ end)
--_GET_LABEL_TEXT to get the part name in the games language
--local Veh = GetVehiclePedIsIn(GetPlayerPed(-1), true)
--local VehType = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(Veh)))
--local VehType = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(Veh)))
+31 -30
View File
@@ -1,14 +1,15 @@
Config = {}
Config.DrawDistance = 100.0
Config.Locale = 'fr'
Config.Zones = {
Config.Zones = {
ls1 = {
Pos = { x = -362.7962, y = -132.4005, z = 38.25239},
Size = {x = 3.0, y = 3.0, z = 0.2},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Name = "LS CUSTOM",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour personnaliser le véhicule."
Hint = _U('press_custom')
}
}
@@ -31,7 +32,7 @@ Config.Colors = {
function GetColors(color)
local colors = {}
if color == 'black' then
colors = {
colors = {
{ index = 0, label = 'Noir'},
{ index = 1, label = 'Graphite'},
{ index = 2, label = 'Noir Métallisé'},
@@ -41,10 +42,10 @@ function GetColors(color)
{ index = 15, label = 'Nuit Sombre'},
{ index = 16, label = 'Noir Profond'},
{ index = 21, label = 'Pétrol'},
{ index = 147, label = 'Carbon'}
{ index = 147, label = 'Carbon'}
}
elseif color == 'white' then
colors = {
colors = {
{ index = 106, label = 'Vanille'},
{ index = 107, label = 'Crème'},
{ index = 111, label = 'Blanc'},
@@ -54,10 +55,10 @@ function GetColors(color)
{ index = 122, label = 'Neige'},
{ index = 131, label = 'Coton'},
{ index = 132, label = 'Albâtre'},
{ index = 134, label = 'Blanc Pure'}
{ index = 134, label = 'Blanc Pure'}
}
elseif color == 'grey' then
colors = {
colors = {
{ index = 4, label = 'Argenté'},
{ index = 5, label = 'Gris Métallisé'},
{ index = 6, label = 'Acier Laminé'},
@@ -79,10 +80,10 @@ function GetColors(color)
{ index = 66, label = 'Acier Bleui'},
{ index = 93, label = 'Champagne'},
{ index = 144, label = 'Gris Chasseur'},
{ index = 156, label = 'Gris'}
}
{ index = 156, label = 'Gris'}
}
elseif color == 'red' then
colors = {
colors = {
{ index = 27, label = 'Rouge'},
{ index = 28, label = 'Rouge Turin'},
{ index = 29, label = 'Coquelicot'},
@@ -98,16 +99,16 @@ function GetColors(color)
{ index = 44, label = 'Rouge Brillant'},
{ index = 46, label = 'Rouge Pale'},
{ index = 143, label = 'Rouge Vin'},
{ index = 150, label = 'Volcano'}
{ index = 150, label = 'Volcano'}
}
elseif color == 'pink' then
colors = {
colors = {
{ index = 135, label = 'Rose Electrique'},
{ index = 136, label = 'Rose Saumon'},
{ index = 137, label = 'Rose Dragée'}
}
{ index = 137, label = 'Rose Dragée'}
}
elseif color == 'blue' then
colors = {
colors = {
{ index = 54, label = 'Topaze'},
{ index = 60, label = 'Bleu Clair'},
{ index = 61, label = 'Bleu Galaxy'},
@@ -137,17 +138,17 @@ function GetColors(color)
{ index = 141, label = 'Bleu Minuit'},
{ index = 146, label = 'Bleu Interdit'},
{ index = 157, label = 'Bleu Glacier'}
}
}
elseif color == 'yellow' then
colors = {
colors = {
{ index = 42, label = 'Jaune'},
{ index = 88, label = 'Jaune Blé'},
{ index = 89, label = 'Jaune Rally'},
{ index = 91, label = 'Jaune Clair'},
{ index = 126, label = 'Jaune Pale'}
}
{ index = 126, label = 'Jaune Pale'}
}
elseif color == 'green' then
colors = {
colors = {
{ index = 49, label = 'Vert Foncé'},
{ index = 50, label = 'Vert Rally'},
{ index = 51, label = 'Vert Sapin'},
@@ -164,20 +165,20 @@ function GetColors(color)
{ index = 133, label = 'Vert Army'},
{ index = 151, label = 'Vert Sombre'},
{ index = 152, label = 'Vert Chasseur'},
{ index = 155, label = 'Amarylisse'}
{ index = 155, label = 'Amarylisse'}
}
elseif color == 'orange' then
colors = {
colors = {
{ index = 36, label = 'Tangerine'},
{ index = 38, label = 'Orange'},
{ index = 41, label = 'Orange Mat'},
{ index = 123, label = 'Orange Clair'},
{ index = 124, label = 'Pèche'},
{ index = 130, label = 'Citrouille'},
{ index = 138, label = 'Orange Lambo'}
{ index = 138, label = 'Orange Lambo'}
}
elseif color == 'brown' then
colors = {
colors = {
{ index = 45, label = 'Cuivre'},
{ index = 47, label = 'Marron clair'},
{ index = 48, label = 'Marron Foncé'},
@@ -202,7 +203,7 @@ function GetColors(color)
{ index = 116, label = 'Blond'},
{ index = 129, label = 'Gravillon'},
{ index = 153, label = 'Terre Foncé'},
{ index = 154, label = 'Désert'}
{ index = 154, label = 'Désert'}
}
elseif color == 'purple' then
colors = {
@@ -213,7 +214,7 @@ function GetColors(color)
{ index = 142, label = 'Violet Mystique'},
{ index = 145, label = 'Violet Métallisé'},
{ index = 148, label = 'Vilot Mat'},
{ index = 149, label = 'Violet Profond Mat'}
{ index = 149, label = 'Violet Profond Mat'}
}
elseif color == 'chrome' then
colors = {
@@ -229,7 +230,7 @@ function GetColors(color)
{ index = 159, label = 'Or Brossé'},
{ index = 160, label = 'Or Clair'}
}
end
end
return colors
end
@@ -361,7 +362,7 @@ end
function GetNeons()
local neons = {
{ label = "white", r = 255, g = 255, b = 255},
{ label = "white", r = 255, g = 255, b = 255},
{ label = "slate_gray", r = 112, g = 128, b = 144},
{ label = "blue", r = 0, g = 0, b = 255},
{ label = "light_blue", r = 0, g = 150, b = 255},
@@ -538,7 +539,7 @@ Config.Menus = {
wheelType = 7,
price = 500
},
modFrontWheelsColor = {
modFrontWheelsColor = {
label = 'Peinture Jantes',
parent = 'wheels'
},
@@ -693,4 +694,4 @@ Config.Menus = {
price = 500
}
}
}
+23
View File
@@ -0,0 +1,23 @@
Locales['en'] = {
['by_default'] = 'by default',
['installed'] = 'installed',
['already_own'] = 'you already own: ~b~',
['not_enough_money'] = 'you do not have enough money!',
['purchased'] = 'purchased!',
['press_custom'] = 'press ~INPUT_PICKUP~ to personalize your vehicle.',
['black'] = 'black',
['white'] = 'white',
['grey'] = 'grey',
['red'] = 'red',
['pink'] = 'pink',
['blue'] = 'blue',
['yellow'] = 'yellow',
['green'] = 'green',
['orange'] = 'orange',
['brown'] = 'brown',
['purple'] = 'purple',
['chrome'] = 'chrome',
['gold'] = 'gold',
}
+23
View File
@@ -0,0 +1,23 @@
Locales['fr'] = {
['by_default'] = 'par défaut',
['installed'] = 'installé',
['already_own'] = 'vous possédez déjà: ~b~',
['not_enough_money'] = 'vous n\'avez pas assez d\'argent !',
['purchased'] = 'achat effectué !',
['press_custom'] = 'appuyez sur ~INPUT_PICKUP~ pour personnaliser le véhicule.',
['black'] = 'noir',
['white'] = 'blanc',
['grey'] = 'gris',
['red'] = 'rouge',
['pink'] = 'rose',
['blue'] = 'bleu',
['yellow'] = 'jaune',
['green'] = 'vert',
['orange'] = 'orange',
['brown'] = 'marron',
['purple'] = 'violet',
['chrome'] = 'chrome',
['gold'] = 'or',
}
+2 -2
View File
@@ -8,10 +8,10 @@ AddEventHandler('esx_lscustom:buyMod', function(price)
price = tonumber(price)
if price > xPlayer.getMoney() then
TriggerClientEvent('esx_lscustom:cancelInstallMod', _source)
TriggerClientEvent('esx:showNotification', _source, "Vous n'avez pas assez d'argent !")
TriggerClientEvent('esx:showNotification', _source, _U('not_enough_money'))
else
xPlayer.removeMoney(price)
TriggerClientEvent('esx_lscustom:installMod', _source)
TriggerClientEvent('esx:showNotification', _source, "Achat effectué !")
TriggerClientEvent('esx:showNotification', _source, _U('purchased'))
end
end)