diff --git a/src/resources/filters/customnodes/floatreftarget.lua b/src/resources/filters/customnodes/floatreftarget.lua index b6845baf13..0723290f21 100644 --- a/src/resources/filters/customnodes/floatreftarget.lua +++ b/src/resources/filters/customnodes/floatreftarget.lua @@ -988,7 +988,7 @@ end, function(float) -- luacov: enable end local kind = "quarto-float-" .. ref - local supplement = info.name + local supplement = titleString('fig', info.name) -- FIXME: custom numbering doesn't work yet -- local numbering = "" -- if float.parent_id then diff --git a/src/resources/filters/customnodes/theorem.lua b/src/resources/filters/customnodes/theorem.lua index 805c9e2bae..b1f028da65 100644 --- a/src/resources/filters/customnodes/theorem.lua +++ b/src/resources/filters/customnodes/theorem.lua @@ -100,7 +100,7 @@ local function ensure_typst_theorems(reftype) letted_typst_theorem[reftype] = true local theorem_type = theorem_types[reftype] quarto.doc.include_text("in-header", "#let " .. theorem_type.env .. " = thmbox(\"" .. - theorem_type.env .. "\", \"" .. theorem_type.title .. "\")") + theorem_type.env .. "\", \"" .. titleString(reftype, theorem_type.title) .. "\")") end end diff --git a/src/resources/filters/layout/pandoc3_figure.lua b/src/resources/filters/layout/pandoc3_figure.lua index 1bb2f54261..ad4924e93c 100644 --- a/src/resources/filters/layout/pandoc3_figure.lua +++ b/src/resources/filters/layout/pandoc3_figure.lua @@ -161,7 +161,7 @@ function render_pandoc3_figure() caption = figure.caption.long[1], kind = "quarto-float-fig", caption_location = crossref.categories.by_ref_type["fig"].caption_location, - supplement = "Figure", + supplement = titleString('fig', 'Figure'), }) end } diff --git a/src/resources/filters/layout/typst.lua b/src/resources/filters/layout/typst.lua index 2556e2770c..b4643af935 100644 --- a/src/resources/filters/layout/typst.lua +++ b/src/resources/filters/layout/typst.lua @@ -95,7 +95,7 @@ end, function(layout) return float.content -- luacov: enable end - local supplement = info.name + local supplement = titleString(ref, info.name) -- typst output currently only supports a single grid -- as output, so no rows of varying columns, etc. @@ -133,12 +133,12 @@ end, function(layout) _quarto.format.typst.as_typst_content(cells) }, false)) else - result:insert(make_typst_figure { + result:extend(make_typst_figure { content = cells, caption_location = caption_location, caption = layout.float.caption_long, kind = kind, - supplement = info.prefix, + supplement = titleString(ref, info.prefix), numbering = info.numbering, identifier = layout.float.identifier }) diff --git a/src/resources/formats/typst/pandoc/quarto/typst-template.typ b/src/resources/formats/typst/pandoc/quarto/typst-template.typ index 97b7f1c908..7ca01bfac5 100644 --- a/src/resources/formats/typst/pandoc/quarto/typst-template.typ +++ b/src/resources/formats/typst/pandoc/quarto/typst-template.typ @@ -61,7 +61,7 @@ if abstract != none { block(inset: 2em)[ - #text(weight: "semibold")[Abstract] #h(1em) #abstract + #text(weight: "semibold")[$labels.abstract$] #h(1em) #abstract ] } diff --git a/tests/docs/smoke-all/typst/typst-i18n.qmd b/tests/docs/smoke-all/typst/typst-i18n.qmd new file mode 100644 index 0000000000..a2c4de256e --- /dev/null +++ b/tests/docs/smoke-all/typst/typst-i18n.qmd @@ -0,0 +1,56 @@ +--- +title: "Typst internationalization" +lang: es +abstract: Escribo algo. +format: + typst: + keep-typ: true +_quarto: + tests: + typst: + ensureTypstFileRegexMatches: + - ['Resumen', 'Nota', 'Conjetura'] + - [] + ensurePdfRegexMatches: + - ['Figura 1', 'Figura 2', 'Figura 3', 'Figura 4', 'Figura 5', 'Figura 6'] + - ['Figure 1', 'Figure 2', 'Figure 3', 'Figure 4', 'Figure 5', 'Figure 6'] +--- + +![Marcador]({{< placeholder 300 >}}){#fig-marcador} + +![Marcador desconocido]({{< placeholder 300 >}}) + +::: {#fig-panel layout-ncol=2} + +![Marcador]({{< placeholder 200 >}}){#fig-layout-a} + +![Marcador]({{< placeholder 200 >}}){#fig-layout-b} + +Panels + +::: + +::: {#fig-panel2 layout-ncol=2} + +![Marcador]({{< placeholder 200 >}}) + +![Marcador]({{< placeholder 200 >}}) + +Panels + +::: + + +::: {.callout-note} + +InformaciĆ³n + +::: + +::: {#cnj-redondo} + +# Redondo + +El mundo es redondo. + +:::