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 uses title-block-* keys.
Add an example that uses crossref-*-title / crossref-*-prefix, and cross-link to the cross-references docs.
docs/authoring/cross-reference-options.qmd: clarify the relationship between crossref: { fig-title: ..., fig-prefix: ... } (per-document overrides) and language: { crossref-fig-title: ..., crossref-fig-prefix: ... } (locale-aware overrides), and list the supported keys.
docs/authoring/cross-references.qmd callout section / docs/authoring/_cross-references-callouts.qmd: add a localisation snippet showing how to translate callout prefixes such as crossref-nte-prefix.
docs/authoring/cross-references-custom.qmd: note that custom kinds inherit the same crossref-{type}-(title|prefix) localisation pattern.
- Optionally, add a reference page at
docs/reference/metadata/language.qmd similar to crossref.qmd.
Reference (for the docs author)
- Keys are defined in
src/config/constants.ts (kCrossref* constants) and enumerated in kLanguageDefaultsKeys.
- Defaults and translations live in
src/resources/language/_language*.yml.
- Pass-through happens in
src/command/render/filters.ts (languageFilterParams) via key.startsWith("crossref-"), plus the auto-derivation of crossref-{type}-prefix from crossref-{type}-title for the 11 float/theorem types.
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.ymland 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.: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 matchingcrossref-*-(title|prefix).For the 11 float/theorem types (
fig,tbl,lst,thm,lem,cor,prp,cnj,def,exm,exr),crossref-{type}-prefixdefaults tocrossref-{type}-titlewhen omitted.The per-language alternates pattern already documented for
title-block-*keys works forcrossref-*keys too: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 uses
crossref-*-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.docs/reference/metadata/language.qmdsimilar tocrossref.qmd.Reference (for the docs author)
src/config/constants.ts(kCrossref*constants) and enumerated inkLanguageDefaultsKeys.src/resources/language/_language*.yml.src/command/render/filters.ts(languageFilterParams) viakey.startsWith("crossref-"), plus the auto-derivation ofcrossref-{type}-prefixfromcrossref-{type}-titlefor the 11 float/theorem types.