mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:08:54 +00:00
handle nil given parameter in Translate function
This commit is contained in:
@@ -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], ...)
|
||||
|
||||
Reference in New Issue
Block a user