Fix locale
This commit is contained in:
parent
481d82d612
commit
cff9c609c6
|
@ -1,4 +1,3 @@
|
|||
Locales = {}
|
||||
Config = {}
|
||||
|
||||
Config.Dependencies = {} -- Reqired resources loaded to start
|
||||
|
|
|
@ -28,8 +28,9 @@ ui_page 'web/build/index.html'
|
|||
|
||||
shared_scripts {
|
||||
'@ox_lib/init.lua',
|
||||
"locales/L.lua",
|
||||
"locales/lang/*.lua",
|
||||
"config.lua",
|
||||
"locales/*.lua",
|
||||
"main.lua",
|
||||
"impl.lua",
|
||||
}
|
||||
|
|
15
locales/L.lua
Normal file
15
locales/L.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
Locales = {}
|
||||
|
||||
function L(key, args)
|
||||
if not args then args = {} end
|
||||
if type(args) ~= "table" then args = {} end
|
||||
if Config.Settings.locale[key] then
|
||||
local pattern = Config.Settings.locale[key]
|
||||
for k, v in pairs(args) do
|
||||
pattern = pattern:gsub(":{" .. k .. "}", v)
|
||||
end
|
||||
return pattern
|
||||
else
|
||||
return key
|
||||
end
|
||||
end
|
|
@ -1,3 +0,0 @@
|
|||
Locales['default'] = {
|
||||
['TEST'] = "Test"
|
||||
}
|
9
locales/lang/default.lua
Normal file
9
locales/lang/default.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
Locales['default'] = {
|
||||
['KILLED YOU'] = "ĐÃ HẠ BẠN",
|
||||
['KILLED BY'] = "BỊ HẠ GỤC BỞI",
|
||||
['OUTGOING'] = "GÂY RA",
|
||||
['COMBAT REPORT'] = "BÁO CÁO GIAO TRANH",
|
||||
['INCOMING'] = "NHẬN VÀO",
|
||||
}
|
||||
|
||||
print("Ádasd")
|
14
main.lua
14
main.lua
|
@ -411,17 +411,3 @@ Citizen.CreateThread(function()
|
|||
end
|
||||
main:InitImplAfterPlayerLoaded()
|
||||
end)
|
||||
|
||||
function L(key, args)
|
||||
if not args then args = {} end
|
||||
if type(args) ~= "table" then args = {} end
|
||||
if Config.Settings.locale[key] then
|
||||
local pattern = Config.Settings.locale[key]
|
||||
for k, v in pairs(args) do
|
||||
pattern = pattern:gsub(":{" .. k .. "}", v)
|
||||
end
|
||||
return pattern
|
||||
else
|
||||
return key
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user