From 02a5f0d8affb9e68e5c1238a074dade7a4f0ede0 Mon Sep 17 00:00:00 2001 From: Lorraxs Date: Fri, 12 Jan 2024 17:45:08 +0700 Subject: [PATCH] add locale func --- config.lua | 10 +++++++++- main.lua | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/config.lua b/config.lua index f890043..afd41fe 100644 --- a/config.lua +++ b/config.lua @@ -1,6 +1,6 @@ Config = {} -Config.UISetting = { +Config.Settings = { locale = {} } @@ -21,3 +21,11 @@ Config.Nui = false Config.Dev = false Config.Framework = "custom" -- "qb" | "esx" | "custom" Config.ClientLazyLoad = false + +function L(key, ...) + if Config.Settings.locale[key] then + return string.format(Config.Settings.locale[key], ...) + else + return key + end +end diff --git a/main.lua b/main.lua index 96dadbc..431be57 100644 --- a/main.lua +++ b/main.lua @@ -20,7 +20,7 @@ if IsDuplicityVersion() then end else RegisterNUICallback('AppReady', function(data, cb) - cb(Config.UISetting or {}) + cb(Config.Settings or {}) NuiReady = true end) end