Merge pull request #1026 from Gellipapa/main

fix(esx_core: Translate function) handle nil given parameter in Translate function
This commit is contained in:
Gergo
2023-04-28 12:05:13 +02:00
committed by GitHub
+5
View File
@@ -1,6 +1,11 @@
Locales = {}
function Translate(str, ...) -- Translate string
if not str then
local currentResourceName = GetCurrentResourceName()
print(("[^1ERROR^7] Resource ^5%s^7 You did not specify a parameter for the Translate function or the value is nil!"):format(currentResourceName))
return 'Given translate function parameter is nil!'
end
if Locales[Config.Locale] then
if Locales[Config.Locale][str] then
return string.format(Locales[Config.Locale][str], ...)