liquid_feedback_frontend

annotate app/main/help/show.lua @ 775:c9d1dce78975

Updated german translation
author bsw
date Thu Jun 28 23:58:38 2012 +0200 (2012-06-28)
parents d0f99272f675
children
rev   line source
poelzi@133 1 local id = param.get_id(atom.string)
poelzi@133 2
poelzi@133 3 if not id then
poelzi@133 4 id = "index"
poelzi@133 5 else
poelzi@133 6 -- sanity check. Only allow letters, digits and _-
poelzi@133 7 id = string.match(id, "[%a%d_-]*")
poelzi@133 8 end
poelzi@133 9
poelzi@133 10 if not app.html_title.title then
poelzi@133 11 app.html_title.title = _("Help #{id}", { id = id })
poelzi@133 12 end
poelzi@133 13
poelzi@133 14 local basepath = request.get_app_basepath()
poelzi@133 15 local found_help = false
poelzi@133 16 -- we try to load any help file that fits best
poelzi@133 17 for x,lang in ipairs{locale.get("lang"), "en"} do
bsw@613 18 local file_name = basepath .. "/locale/help/" .. id .. "." .. lang .. ".txt.html"
bsw@613 19 local file = io.open(file_name)
bsw@613 20 if file ~= nil then
bsw@613 21 local help_text = file:read("*a")
bsw@613 22 if #help_text > 0 then
bsw@613 23 found_help = true
bsw@613 24 ui.container{
bsw@613 25 attr = { class = "wiki" },
bsw@613 26 content = function()
bsw@613 27 slot.put(help_text)
bsw@613 28 end
bsw@613 29 }
bsw@613 30 break
poelzi@133 31 end
poelzi@133 32 end
poelzi@133 33 end
poelzi@133 34
poelzi@133 35 if not found_help then
poelzi@133 36 ui.field.text{ value = _("Missing help text: #{id}.#{lang}.txt", { id = id, lang = locale.get("lang") }) }
poelzi@133 37 end

Impressum / About Us