fix(locale): server hotload and "external" kvp

External kvp's don't exist for the server, so we have to export the proper language.
This commit is contained in:
Linden
2022-04-29 16:53:24 +10:00
parent 8af19bae42
commit 031cccd886
2 changed files with 7 additions and 1 deletions

View File

@@ -26,5 +26,6 @@ end
AddEventHandler('ox_lib:setLocale', loadLocale)
return function()
loadLocale(GetExternalKvpString('ox_lib', 'locale') or 'en-US')
local lang = IsDuplicityVersion() and lib.getServerLocale() or GetExternalKvpString('ox_lib', 'locale') or 'en-US'
loadLocale(lang)
end

View File

@@ -1,5 +1,10 @@
RegisterCommand('serverlocale', function(_, args, _)
if args?[1] then
SetResourceKvp('locale', args[1])
TriggerEvent('ox_lib:setLocale', args[1])
end
end, true)
function lib.getServerLocale()
return GetResourceKvpString('locale') or 'en-US'
end