From 0b13a560716719a0ea97874d3a4862945cedda9a Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Tue, 14 May 2024 18:19:26 +1000 Subject: [PATCH] fix(package/locale): sync behaviour with Lua --- imports/locale/shared.lua | 2 +- package/shared/resource/locale/index.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/imports/locale/shared.lua b/imports/locale/shared.lua index 02a2c05..e78d54d 100644 --- a/imports/locale/shared.lua +++ b/imports/locale/shared.lua @@ -52,7 +52,7 @@ end local table = lib.table ---Loads the ox_lib locale module. Prefer using fxmanifest instead (see [docs](https://overextended.dev/ox_lib#usage)). ----@param key string +---@param key? string function lib.locale(key) local lang = key or lib.getLocaleKey() local locales = loadLocale('en') diff --git a/package/shared/resource/locale/index.ts b/package/shared/resource/locale/index.ts index 5a75f31..fe242bc 100644 --- a/package/shared/resource/locale/index.ts +++ b/package/shared/resource/locale/index.ts @@ -29,6 +29,8 @@ export const locale = (str: string, ...args: any[]) => { return lstr; } + + return str; }; export const getLocales = () => dict; @@ -55,7 +57,7 @@ function loadLocale(key: string): typeof dict { } export const initLocale = (key?: string) => { - const lang = key || GetConvar('ox:locale', 'en'); + const lang = key || exports.ox_lib.getLocaleKey(); let locales = loadLocale('en'); if (lang !== 'en') Object.assign(locales, loadLocale(lang));