From 78200cee9ffcae7cfe0420becb5e74fc7c83ae38 Mon Sep 17 00:00:00 2001 From: Gellipapa Date: Mon, 9 Jan 2023 22:47:23 +0100 Subject: [PATCH] fix nil value if change locales --- [esx]/es_extended/locale.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/[esx]/es_extended/locale.lua b/[esx]/es_extended/locale.lua index ed42aa76..c093979e 100644 --- a/[esx]/es_extended/locale.lua +++ b/[esx]/es_extended/locale.lua @@ -1,11 +1,10 @@ Locales = {} function Translate(str, ...) -- Translate string - if Locales[Config.Locale] then if Locales[Config.Locale][str] then return string.format(Locales[Config.Locale][str], ...) - elseif Config.Locale ~= 'en' and Locales['en'][str] then + elseif Config.Locale ~= 'en' and Locales['en'] and Locales['en'][str] then return string.format(Locales['en'][str], ...) else return 'Translation [' .. Config.Locale .. '][' .. str .. '] does not exist' @@ -22,4 +21,4 @@ function TranslateCap(str, ...) -- Translate string first char uppercase end _ = Translate -_U = TranslateCap \ No newline at end of file +_U = TranslateCap