mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-19 07:56:02 +01:00
fix(shared/locale): only construct phrases for strings
This commit is contained in:
@@ -26,6 +26,7 @@ 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
|
||||||
|
if type(v) == 'string' then
|
||||||
for var in v:gmatch('${[%w%s%p]-}') do
|
for var in v:gmatch('${[%w%s%p]-}') do
|
||||||
local locale = locales[var:sub(3, -2)]
|
local locale = locales[var:sub(3, -2)]
|
||||||
|
|
||||||
@@ -33,6 +34,7 @@ function lib.loadLocale()
|
|||||||
v = v:gsub(var, locale:gsub('%%', '%%%%'))
|
v = v:gsub(var, locale:gsub('%%', '%%%%'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
dict[k] = v
|
dict[k] = v
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user