Skip to content

Add extend! macro to extend crate's translations - #143

Merged
huacnlee merged 11 commits into
mainfrom
feat/crate-locale-extensions
Jul 13, 2026
Merged

huacnlee merged 11 commits into
mainfrom
feat/crate-locale-extensions

Conversation

@huacnlee

@huacnlee huacnlee commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

Summary

  • add rust_i18n::extend!(crate_name) so applications can lazily merge a crate-scoped translation namespace into dependencies while dependencies keep using t!
  • let application values override the same locale/key, while omitted values continue to come from the dependency and then normal locale fallback
  • isolate each extension to the crate identifier passed to extend!, including Cargo aliases, without copying the application backend
  • add runnable examples for renamed (my_component) and default (ui_component) dependency names

Test Plan

  • cargo fmt --all -- --check
  • cargo test --workspace
  • cargo test --doc
  • cargo test -p extend-crate-app -p extend-crate-default-app
  • cargo run -p extend-crate-app
  • cargo run -p extend-crate-default-app

Note: cargo clippy --workspace --all-targets -- -D warnings reaches two pre-existing warnings outside this diff in crates/support/src/backend.rs:166 and crates/support/src/lib.rs:132.

huacnlee and others added 2 commits July 13, 2026 14:27
@huacnlee huacnlee changed the title feat: extend dependency translations by crate namespace Add extend! macro to extend dependency crate's translations Jul 13, 2026
huacnlee and others added 7 commits July 13, 2026 14:43
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
@huacnlee huacnlee changed the title Add extend! macro to extend dependency crate's translations Add extend! macro to extend crate's translations Jul 13, 2026
@huacnlee
huacnlee enabled auto-merge (squash) July 13, 2026 07:05
@huacnlee
huacnlee disabled auto-merge July 13, 2026 07:06
@huacnlee
huacnlee merged commit a8aadf7 into main Jul 13, 2026
2 checks passed
@huacnlee
huacnlee deleted the feat/crate-locale-extensions branch July 13, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant