Skip to content

Commit

Permalink
Update JSlangLib.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerrrry123 authored Apr 18, 2023
1 parent 824a569 commit 429080c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/JSlangLib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,15 @@ local JSlang = {}
function JSlang.trans(txt)
if txt == nil or #txt < 1 then return '' end

local label = lang.find_registered(txt)
local label = lang.find_builtin(txt)
if label != 0 then
if lang.find_registered(txt) == 0 then
lang.register(txt)
end
return label
end

label = lang.find_registered(txt)
if label == 0 then
label = lang.register(txt)
end
Expand Down Expand Up @@ -145,7 +153,7 @@ for _, filePath in pairs(STRING_FILES) do
end

function JSlang.str_trans(string)
return lang.get_string(JSlang.trans(string), lang.get_current())
return lang.get_localised(JSlang.trans(string))
end

function JSlang.toast(string, ...)
Expand Down

0 comments on commit 429080c

Please sign in to comment.