mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:08:54 +00:00
Merge pull request #829 from Gellipapa/fix-2
fix(ex_extended locales.lua) fix nil value if change locales
This commit is contained in:
@@ -1,11 +1,10 @@
|
|||||||
Locales = {}
|
Locales = {}
|
||||||
|
|
||||||
function Translate(str, ...) -- Translate string
|
function Translate(str, ...) -- Translate string
|
||||||
|
|
||||||
if Locales[Config.Locale] then
|
if Locales[Config.Locale] then
|
||||||
if Locales[Config.Locale][str] then
|
if Locales[Config.Locale][str] then
|
||||||
return string.format(Locales[Config.Locale][str], ...)
|
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], ...)
|
return string.format(Locales['en'][str], ...)
|
||||||
else
|
else
|
||||||
return 'Translation [' .. Config.Locale .. '][' .. str .. '] does not exist'
|
return 'Translation [' .. Config.Locale .. '][' .. str .. '] does not exist'
|
||||||
@@ -22,4 +21,4 @@ function TranslateCap(str, ...) -- Translate string first char uppercase
|
|||||||
end
|
end
|
||||||
|
|
||||||
_ = Translate
|
_ = Translate
|
||||||
_U = TranslateCap
|
_U = TranslateCap
|
||||||
|
|||||||
Reference in New Issue
Block a user