mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-11-23 11:28:36 +00: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:
1 parent
8af19bae42
commit
031cccd886
2 files changed
+7
-1
No files matched your search
@@ -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