fix(locale): setLocale

This commit is contained in:
Linden
2022-10-19 04:14:36 +11:00
parent 671be5e7a2
commit ec18bbf34a
4 changed files with 20 additions and 15 deletions

View File

@@ -1,4 +1,3 @@
---@todo remove module and nui event
RegisterNUICallback('init', function(_, cb)
cb(1)
@@ -6,4 +5,11 @@ RegisterNUICallback('init', function(_, cb)
action = 'loadLocales',
data = {}
})
local JSON = LoadResourceFile(cache.resource, ('locales/%s.json'):format(GetConvar('ox:locale', 'en'))) or LoadResourceFile(cache.resource, 'locales/en.json')
SendNUIMessage({
action = 'setLocale',
data = JSON and json.decode(JSON) or {}
})
end)