macros: translatable struct attrs and warnings
Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
f0de7df204
commit
d0fd8d7880
9 changed files with 729 additions and 276 deletions
|
@ -261,7 +261,7 @@ pub trait Emitter {
|
|||
message: &'a DiagnosticMessage,
|
||||
args: &'a FluentArgs<'_>,
|
||||
) -> Cow<'_, str> {
|
||||
trace!(?message);
|
||||
trace!(?message, ?args);
|
||||
let (identifier, attr) = match message {
|
||||
DiagnosticMessage::Str(msg) => return Cow::Borrowed(&msg),
|
||||
DiagnosticMessage::FluentIdentifier(identifier, attr) => (identifier, attr),
|
||||
|
@ -283,7 +283,13 @@ pub trait Emitter {
|
|||
let mut err = vec![];
|
||||
let translated = bundle.format_pattern(value, Some(&args), &mut err);
|
||||
trace!(?translated, ?err);
|
||||
debug_assert!(err.is_empty());
|
||||
debug_assert!(
|
||||
err.is_empty(),
|
||||
"identifier: {:?}, args: {:?}, errors: {:?}",
|
||||
identifier,
|
||||
args,
|
||||
err
|
||||
);
|
||||
translated
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue