about summary refs log tree commit diff
path: root/compiler/rustc_errors/src/translation.rs
AgeCommit message (Collapse)AuthorLines
2023-02-23Restore behavior when primary bundle is missingmejrs-4/+13
2023-02-22errors: fix translation's run-make testDavid Wood-2/+11
`run-make/translation` had some targets that weren't listed in `all` and thus weren't being tested - the behaviour that should have been being tested was basically correct fortunately. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-08Make translate_message return result and add testsmejrs-7/+8
2023-01-05Improve fluent error messagesmejrs-67/+41
2022-12-01Remove useless borrows and derefsMaybe Waffle-3/+3
2022-11-09Display help message when fluent arg was referenced incorrectlyNilstrieb-9/+29
The fluent argument syntax is a little special and easy to get wrong, so we emit a small help message when someone gets it wrong. Example: ``` parser_mismatched_closing_delimiter = mismatched closing delimiter: `${delimiter}` ``` panics with ``` thread 'rustc' panicked at 'Encountered errors while formatting message for `parser_mismatched_closing_delimiter` help: Argument `delimiter` exists but was not referenced correctly. Try using `{$delimiter}` instead attr: `None` args: `FluentArgs([("delimiter", String("}"))])` errors: `[ResolverError(Reference(Message { id: "delimiter", attribute: None }))]`', compiler/rustc_errors/src/translation.rs:123:21 ```
2022-10-10errors: `DiagnosticMessage::Eager`David Wood-1/+3
Add variant of `DiagnosticMessage` for eagerly translated messages (messages in the target language which don't need translated by the emitter during emission). Also adds `eager_subdiagnostic` function which is intended to be invoked by the diagnostic derive for subdiagnostic fields which are marked as needing eager translation. Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10errors: use `HashMap` to store diagnostic argsDavid Wood-9/+21
Eager translation will enable subdiagnostics to be translated multiple times with different arguments - this requires the ability to replace the value of one argument with a new value, which is better suited to a `HashMap` than the previous storage, a `Vec`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-30Use more `into_iter` rather than `drain(..)`Donough Liu-1/+1
2022-08-15errors: move translation logic into moduleDavid Wood-0/+103
Just moving code around so that triagebot can ping relevant parties when translation logic is modified. Signed-off-by: David Wood <david.wood@huawei.com>