mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 07:26:02 +01:00
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:
@@ -26,5 +26,6 @@ end
|
|||||||
AddEventHandler('ox_lib:setLocale', loadLocale)
|
AddEventHandler('ox_lib:setLocale', loadLocale)
|
||||||
|
|
||||||
return function()
|
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
|
end
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
RegisterCommand('serverlocale', function(_, args, _)
|
RegisterCommand('serverlocale', function(_, args, _)
|
||||||
if args?[1] then
|
if args?[1] then
|
||||||
SetResourceKvp('locale', args[1])
|
SetResourceKvp('locale', args[1])
|
||||||
|
TriggerEvent('ox_lib:setLocale', args[1])
|
||||||
end
|
end
|
||||||
end, true)
|
end, true)
|
||||||
|
|
||||||
|
function lib.getServerLocale()
|
||||||
|
return GetResourceKvpString('locale') or 'en-US'
|
||||||
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user