Skip to content

Commit

Permalink
fix(locale/shared): phrase-construction for strings without placeholders
Browse files Browse the repository at this point in the history
string.gsub returns two variables, the updated string and the pattern occurrences.
The outer string.gsub would replace n occurrences, or nothing if the string did not
contain '%'.
  • Loading branch information
thelindat committed Jan 31, 2023
1 parent 8b11d29 commit a8b9f8c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion imports/locale/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ function lib.loadLocale()
local locale = locales[var:sub(3, -2)]

if locale then
v = v:gsub(var, locale:gsub('%%', '%%%%'))
locale = locale:gsub('%%', '%%%%')
v = v:gsub(var, locale)
end
end
end
Expand Down

0 comments on commit a8b9f8c

Please sign in to comment.