mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 23:46:03 +01:00
fix(shared/locale): only construct phrases for strings
This commit is contained in:
@@ -26,11 +26,13 @@ function lib.loadLocale()
|
|||||||
local locales = json.decode(LoadResourceFile(cache.resource, ('locales/%s.json'):format(GetConvar('ox:locale', 'en'))) or LoadResourceFile(cache.resource, 'locales/en.json') or '[]')
|
local locales = json.decode(LoadResourceFile(cache.resource, ('locales/%s.json'):format(GetConvar('ox:locale', 'en'))) or LoadResourceFile(cache.resource, 'locales/en.json') or '[]')
|
||||||
|
|
||||||
for k, v in pairs(locales) do
|
for k, v in pairs(locales) do
|
||||||
for var in v:gmatch('${[%w%s%p]-}') do
|
if type(v) == 'string' then
|
||||||
local locale = locales[var:sub(3, -2)]
|
for var in v:gmatch('${[%w%s%p]-}') do
|
||||||
|
local locale = locales[var:sub(3, -2)]
|
||||||
|
|
||||||
if locale then
|
if locale then
|
||||||
v = v:gsub(var, locale:gsub('%%', '%%%%'))
|
v = v:gsub(var, locale:gsub('%%', '%%%%'))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user