mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46:03 +01:00
fix(locale): setLocale
This commit is contained in:
@@ -23,8 +23,7 @@ function lib.getLocales()
|
||||
end
|
||||
|
||||
function lib.loadLocale()
|
||||
local locale = GetConvar('ox:locale', 'en')
|
||||
local JSON = LoadResourceFile(cache.resource, ('locales/%s.json'):format(locale)) or LoadResourceFile(cache.resource, ('locales/en.json'):format(locale))
|
||||
local JSON = LoadResourceFile(cache.resource, ('locales/%s.json'):format(GetConvar('ox:locale', 'en'))) or LoadResourceFile(cache.resource, 'locales/en.json')
|
||||
dict = JSON and json.decode(JSON) or {}
|
||||
end
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"language": "繁體中文",
|
||||
"ui": {
|
||||
"settings": {
|
||||
"title": "設置",
|
||||
"language": "語言"
|
||||
},
|
||||
"cancel": "取消",
|
||||
"close": "關閉",
|
||||
"confirm": "確認"
|
||||
}
|
||||
}
|
||||
{
|
||||
"language": "繁體中文",
|
||||
"ui": {
|
||||
"settings": {
|
||||
"title": "設置",
|
||||
"language": "語言"
|
||||
},
|
||||
"cancel": "取消",
|
||||
"close": "關閉",
|
||||
"confirm": "確認"
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user