Skip to content

Commit

Permalink
fix(init): move locale loading
Browse files Browse the repository at this point in the history
That had some unintended consequences, apparently.
  • Loading branch information
thelindat committed Dec 31, 2021
1 parent 4b14922 commit b9181bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions modules/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,12 @@ function ox.warning(...) ox.print('^3[warning]^7', ...) end
function ox.error(...) error('\n^1[error] '.. ... ..'^7', 2) end

function data(name)
if ox.ready == nil then return {} end
if ox.server and ox.ready == nil then return {} end
local func, err = load(LoadResourceFile(ox.resource, ('data/%s.lua'):format(name)))
if err then error('^1'..err..'^0', 0) end
return func()
end

local Locales = data('locales/'..ox.locale)
function ox.locale(string, ...)
if not string then return Locales end
if Locales[string] then return Locales[string]:format(...) end
return string
end

do
if not SetInterval or not import then
ox.error('Ox Inventory requires the pe-lualib resource, refer to the documentation.')
Expand All @@ -43,4 +36,11 @@ if ox.qtarget and GetResourceState('qtarget') ~= 'started' then
ox.info('qtarget is not running; disabled compatibility mode')
end

ox.ready = false
if ox.server then ox.ready = false end

local Locales = data('locales/'..ox.locale)
function ox.locale(string, ...)
if not string then return Locales end
if Locales[string] then return Locales[string]:format(...) end
return string
end
2 changes: 1 addition & 1 deletion web/src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const App: React.FC = () => {
fetchNui('uiLoaded', {});

useNuiEvent<{
sentry: boolean;
// sentry: boolean;
locale: { [key: string]: string };
items: typeof Items;
leftInventory: Inventory;
Expand Down

0 comments on commit b9181bd

Please sign in to comment.