mirror of
https://codeberg.org/metamuffin/abrechenbarkeit.git
synced 2024-12-29 16:14:36 +00:00
partially fix format
This commit is contained in:
parent
c78ca2592d
commit
0f69e739a8
3 changed files with 8 additions and 4 deletions
|
@ -91,10 +91,12 @@ local stylesheet = io.open("style.css"):read("a")
|
||||||
local script = io.open("script.js"):read("a")
|
local script = io.open("script.js"):read("a")
|
||||||
|
|
||||||
local function format(template, params)
|
local function format(template, params)
|
||||||
return string.gsub(template, "{([%w\\.!]+)}", function(n)
|
params = params or {}
|
||||||
|
if template == nil then return "NIL TEMPLATE" end
|
||||||
|
return string.gsub(template, "{([%w_\\.!]+)}", function(n)
|
||||||
local raw = n:sub(1, 1) ~= "!"
|
local raw = n:sub(1, 1) ~= "!"
|
||||||
if raw then n = n:sub(2) end
|
if not raw then n = n:sub(2) end
|
||||||
local s = format(params[n] or translations[n] or "NIL TEMPLATE", params)
|
local s = format(params[n] or translations[n] or "NIL PARAM", params)
|
||||||
return raw and s or escape(s)
|
return raw and s or escape(s)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
[abrechenbarkeit]
|
||||||
appname=Abrechenbarkeit
|
appname=Abrechenbarkeit
|
||||||
about=Über
|
about=Über
|
||||||
field.amount=Menge
|
field.amount=Menge
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
[abrechenbarkeit]
|
||||||
appname=Abrechenbarkeit
|
appname=Abrechenbarkeit
|
||||||
about=About
|
about=About
|
||||||
field.amount=Amount
|
field.amount=Amount
|
||||||
|
|
Loading…
Reference in a new issue