Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
384 changes: 384 additions & 0 deletions claude-notes/plans/2026-07-17-localization-i18n-design.md

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion crates/quarto-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ quarto-highlight.workspace = true
# follow-up bd-754f review may replace it with a Q2-native scheme.
base64.workspace = true

# Compile-time embedding of `resources/language/` term files (bd-llhlzd7p).
# Deliberately NOT in the native-only section below: localization must work
# in the WASM preview pipeline too (LanguageResolveStage runs there), so the
# ~150KB of term YAML is embedded on both targets. The other in-tree
# `include_dir!` uses (knitr resources, builtin extensions) remain
# native-gated at their use sites.
include_dir = "0.7"

# Optional clap dep so types exposed to the CLI (e.g. `AttributionMode`)
# can carry `ValueEnum` derives without forcing clap into the WASM tree
# or other non-CLI consumers. The `quarto` crate enables this via
Expand All @@ -73,7 +81,6 @@ clap = ["dep:clap"]
# Native-only dependencies (for execution engines and resource extraction)
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tempfile = "3"
include_dir = "0.7"
which = "8"
regex = "1.12"
# `scraper` (CSS-selector HTML reader) for the L7 post-render upgrade
Expand Down
21 changes: 21 additions & 0 deletions crates/quarto-core/src/crossref/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,27 @@ const BUILTINS: &[(&str, &str)] = &[
];

impl RefTypeRegistry {
/// Localize built-in display names from the resolved language table
/// (bd-llhlzd7p): `kind` becomes the `crossref-<type>-title` term,
/// falling back to `crossref-<type>-prefix` for types that only define
/// a prefix (`sec`, `eq`). Only [`RefTypeSource::BuiltIn`] entries are
/// touched — `crossref.custom` display names are user config and win
/// over locale defaults, so call this *before*
/// [`Self::extend_from_metadata`].
pub fn localize_builtin_display_names(&mut self, terms: &crate::language::LanguageTerms) {
for def in self.entries.values_mut() {
if def.source != RefTypeSource::BuiltIn {
continue;
}
let localized = terms
.crossref_title(&def.ref_type)
.or_else(|| terms.get(&format!("crossref-{}-prefix", def.ref_type)));
if let Some(name) = localized {
def.kind = name.to_string();
}
}
}

/// Seed with built-ins only. Call [`Self::extend_from_metadata`] and
/// [`Self::extend_from_promised`] next to complete the registry.
pub fn builtin() -> Self {
Expand Down
Loading
Loading