pub struct Localizable {
pub key: String,
pub args: Args,
pub url: Option<String>,
pub data: Value,
pub icon: Option<String>,
pub badge: Option<u32>,
pub collapse_id: Option<String>,
pub loc: Option<LocKeys>,
}Expand description
A message named rather than written.
key is a Fluent message id whose attributes are .title, .body and
optionally .subject (mail only); args are its placeables.
Everything a Notification carries that is not language — the tap
target, the icon, the custom payload — is here too, because those do
not change with the recipient’s locale.
Fields§
§key: StringThe catalog message id: booking-confirmed.
args: ArgsIts placeables: { $coach }, { $count }.
Personal data. A coach’s name, a place, a reference — these are the caller’s values about a person, so they belong in the message that is delivered and nowhere else. Nothing in this module puts one in a log, an event payload or an error.
url: Option<String>Where a tap should take the recipient.
data: ValueThe custom payload the app reads.
icon: Option<String>An icon for the notification (Web Push).
badge: Option<u32>A badge count, for a category that declared badge(true).
collapse_id: Option<String>Coalesces with an undelivered notification carrying the same id.
loc: Option<LocKeys>The app’s own localisation keys, for a category whose
RenderMode is not RenderMode::Server.
These are not this catalog’s ids: they name strings compiled into the iOS and Android apps, which only the app knows. The module cannot invent them, so a caller that wants native rendering passes them, and APNs and FCM get them alongside (or instead of) the server’s text. Web Push has no such mechanism and never sees them.
Implementations§
Source§impl Localizable
impl Localizable
Sourcepub fn arg(self, name: impl Into<String>, value: impl Into<Value>) -> Self
pub fn arg(self, name: impl Into<String>, value: impl Into<Value>) -> Self
Adds one placeable.
A number must arrive as a number: Fluent selects the plural form
from it, and "2" as a string selects other in every language —
which reads correctly in English and wrongly in Polish.
Sourcepub fn badge(self, badge: u32) -> Self
pub fn badge(self, badge: u32) -> Self
A badge count, honoured only by a category that declared
badge(true).
Sourcepub fn collapse_id(self, id: impl Into<String>) -> Self
pub fn collapse_id(self, id: impl Into<String>) -> Self
Coalesces with an undelivered notification carrying the same id.
Sourcepub fn loc(self, loc: LocKeys) -> Self
pub fn loc(self, loc: LocKeys) -> Self
The app’s own localisation keys — see Localizable::loc.