Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
zbraniecki committed Apr 26, 2021
2 parents 25809c3 + 933304a commit f36df87
Show file tree
Hide file tree
Showing 7 changed files with 410 additions and 69 deletions.
22 changes: 20 additions & 2 deletions fluent-fallback/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ pub enum LocalizationError {
},
MissingMessage {
id: String,
locale: Option<LanguageIdentifier>,
},
MissingValue {
id: String,
locale: Option<LanguageIdentifier>,
},
SyncRequestInAsyncMode,
}
Expand All @@ -41,8 +43,24 @@ impl std::fmt::Display for LocalizationError {
errors.join(", ")
)
}
Self::MissingMessage { id } => write!(f, "[fluent] Missing message: {}", id),
Self::MissingValue { id } => write!(f, "[fluent] Missing value in message: {}", id),
Self::MissingMessage {
id,
locale: Some(locale),
} => write!(f, "[fluent] Missing message in locale {}: {}", locale, id),
Self::MissingMessage { id, locale: None } => {
write!(f, "[fluent] Couldn't find a message: {}", id)
}
Self::MissingValue {
id,
locale: Some(locale),
} => write!(
f,
"[fluent] Message has no value in locale {}: {}",
locale, id
),
Self::MissingValue { id, locale: None } => {
write!(f, "[fluent] Couldn't find a message with value: {}", id)
}
Self::SyncRequestInAsyncMode => {
write!(f, "Triggered synchronous format while in async mode")
}
Expand Down
1 change: 1 addition & 0 deletions fluent-fallback/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,5 @@ mod localization;
mod pin_cell;
pub mod types;

pub use errors::LocalizationError;
pub use localization::Localization;
Loading

0 comments on commit f36df87

Please sign in to comment.