Repository navigation
Description
What would you like to do?
Give feedback or suggest an improvement
Description
Follow-up to https://github.com/orgs/quarto-dev/discussions/14465.
The discussion confirmed that localisation of cross-reference titles and prefixes (for built-in floats, theorem environments, callouts, and custom kinds) is fully supported but not documented on https://quarto.org.
Users currently have to read _language.yml and infer the key naming convention from there.
What is supported but undocumented
Overriding cross-reference titles and prefixes for built-in floats and theorem environments via the language: key, e.g.:
---
lang: es
language:
crossref-fig-title: "Figura"
crossref-tbl-title: "Tabla"
crossref-eq-prefix: "Ecuación"
---The same mechanism works for callouts (crossref-nte-prefix, crossref-tip-prefix, crossref-wrn-prefix, crossref-imp-prefix, crossref-cau-prefix) and for any custom cross-reference kind, because the language filter passes through any key matching crossref-*-(title|prefix).
For the 11 float/theorem types (fig, tbl, lst, thm, lem, cor, prp, cnj, def, exm, exr), crossref-{type}-prefix defaults to crossref-{type}-title when omitted.
The per-language alternates pattern already documented for title-block-* keys works for crossref-* keys too:
lang: es
language:
es:
crossref-fig-title: "Figura"
fr:
crossref-fig-title: "Figure"Pages that need updating on quarto.org
docs/authoring/language.qmd(Alternate Language section): the only example currently usestitle-block-*keys.
Add an example that usescrossref-*-title/crossref-*-prefix, and cross-link to the cross-references docs.docs/authoring/cross-reference-options.qmd: clarify the relationship betweencrossref: { fig-title: ..., fig-prefix: ... }(per-document overrides) andlanguage: { crossref-fig-title: ..., crossref-fig-prefix: ... }(locale-aware overrides), and list the supported keys.docs/authoring/cross-references.qmdcallout section /docs/authoring/_cross-references-callouts.qmd: add a localisation snippet showing how to translate callout prefixes such ascrossref-nte-prefix.docs/authoring/cross-references-custom.qmd: note that custom kinds inherit the samecrossref-{type}-(title|prefix)localisation pattern.- Optionally, add a reference page at
docs/reference/metadata/language.qmdsimilar tocrossref.qmd.
Reference (for the docs author)
- Keys are defined in
src/config/constants.ts(kCrossref*constants) and enumerated inkLanguageDefaultsKeys. - Defaults and translations live in
src/resources/language/_language*.yml. - Pass-through happens in
src/command/render/filters.ts(languageFilterParams) viakey.startsWith("crossref-"), plus the auto-derivation ofcrossref-{type}-prefixfromcrossref-{type}-titlefor the 11 float/theorem types.
Activity