fix(launcher): localize image-missing placeholder + drop dead icons.lua
- markdown.lua: M.render now accepts an optional `t` 6th arg (ctx.t). When present, the image-missing fallback string is looked up via the new `image_missing_fmt` key in strings.lua. Callers without t (the launcher-test bytecopy) get the hardcoded English string verbatim, matching previous behavior. - panels/detail.lua: both md.render call sites now thread ctx.t through. - strings.lua: add image_missing_fmt = "[image missing: %s]". - icons.lua: deleted. The v0.2.0 status-glyph helper was replaced by dep_glyph_* string keys in v0.3.0; grep confirmed no remaining refs. - manifest.module: bump 0.3.2 -> 0.3.3.
This commit is contained in:
10
markdown.lua
10
markdown.lua
@@ -176,7 +176,11 @@ local function render_spans(spans, x, y, max_w, size)
|
||||
return cur_y + line_h
|
||||
end
|
||||
|
||||
function M.render(blocks, x, y, max_w, module_id_for_imgs)
|
||||
-- `t` (optional, 6th arg) is the launcher's ctx.t string-lookup function.
|
||||
-- When present, M.render uses it to localize the image-missing placeholder
|
||||
-- via the `image_missing_fmt` key. Callers that don't have a t (e.g. tests)
|
||||
-- may pass nil; the hardcoded English fallback then renders verbatim.
|
||||
function M.render(blocks, x, y, max_w, module_id_for_imgs, t)
|
||||
local cur_y = y
|
||||
for _, b in ipairs(blocks) do
|
||||
if b.type == "h1" then
|
||||
@@ -216,7 +220,9 @@ function M.render(blocks, x, y, max_w, module_id_for_imgs)
|
||||
-- assume a 16:9 max_w-wide image for layout.
|
||||
cur_y = cur_y + math.floor(max_w * 9 / 16) + PARA_GAP
|
||||
else
|
||||
engine.render.draw_text("[image missing: " .. b.src .. "]",
|
||||
local missing_text = t and t("image_missing_fmt", b.src)
|
||||
or ("[image missing: " .. b.src .. "]")
|
||||
engine.render.draw_text(missing_text,
|
||||
x, cur_y, BODY_SIZE, COLOR_DIM)
|
||||
local _, h = engine.render.measure_text("[image]", BODY_SIZE)
|
||||
cur_y = cur_y + h + PARA_GAP
|
||||
|
||||
Reference in New Issue
Block a user