Tracking Issue for rustc's translatable diagnostics infrastructure
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
This is a tracking issue for rustc's translatable diagnostics infrastructure, which is related to #100717 but reflects the current status.
Current status
Unfortunately, we have found that the current implementation of diagnostic translation infrastructure causes significant friction for compiler contributors when trying to work on diagnostics, including but not limited to:
- Having to edit multiple files (fluent file,
errors.rsand the emission site, etc.) - The diagnostics derive DSL is quite complex and exhibits some quirks
- Fluent DSL also has its own quirks
- Sometimes not sufficiently flexible to accommodate diagnostic needs, e.g. see
rustc_const_evalor other not-migrated examples.
[!IMPORTANT]
Based on these friction points, we want to downgrade the internal lintsuntranslatable_diagnostic/diagnostic_outside_of_implrequiring usage of current translatable diagnostic infra fromdenytoallow.
If someone wants to continue the translatable diagnostics effort, then they will need to come up with a better redesign that causes less friction for compiler contributors.
Related discussions
- https://github.com/rust-lang/rust/issues/112618
- https://github.com/rust-lang/rust/issues/121077
- https://github.com/rust-lang/rust/issues/137223
Implementation steps
Relaxing the current restrictions
- Downgrade
untranslatable_diagnosticanddiagnostic_outside_of_implfromdenytoallow. - Update rustc-dev-guide to reflect current status of translatable diagnostics infrastructure.
Come up with a redesign
Note: this is not currently being actively worked on AFAICT, please speak with wg-diagnostics and T-compiler if you wish to pursue this. See specifically https://rust-lang.zulipchat.com/#narrow/channel/336883-i18n/topic/.23100717.20diag.20translation/near/472701978.
- A redesign of the translatable diagnostics infra will need to address the needs of both compiler contributors and translation teams. In particular, it cannot cause significant burden or friction for compiler contributors.
Further steps are presently unclear.
Unresolved questions
- What do we do with the current diagnostic translation infrastructure?
- It's a lot of work and churn to rip it out, as well.
- What about the Pontoon infrastructure?
- What about translation teams?
Implementation / experimentation history
This listing is moreso focused on diagnostic infra itself, not migration efforts. Please see the closed PRs for what concrete issues they have ran into.
- https://github.com/rust-lang/rust/pull/121334
- https://github.com/rust-lang/rust/pull/117867
- https://github.com/rust-lang/rust/pull/125208
More discussions
- https://rust-lang.zulipchat.com/#narrow/channel/336883-i18n/topic/.23100717.20diag.20translation/near/472701978
- https://github.com/rust-lang/rust/pull/117867#issuecomment-2262552506
- https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Localization.20infra.20interferes.20with.20grepping.20for.20error
cc @rust-lang/wg-diagnostics
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the current-status and unresolved-questions sections, then review the linked discussions and implementation PRs. Consult wg-diagnostics and T-compiler before proceeding, since the issue says the work is not actively assigned. Done requires an agreed redesign that reduces contributor friction while supporting translation teams and addresses the listed infrastructure questions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, internationalization, localization
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100