Skip to main content

Crate es_fluent_derive

Crate es_fluent_derive 

Source
Expand description

§es-fluent-derive

Codecov: es-fluent-derive crates.io: es-fluent-derive

Procedural macros behind the es-fluent typed-message facade. Applications should import these derives from es-fluent rather than depending on this crate directly.

The crate implements:

  • EsFluent for structs and enum messages;
  • EsFluentChoice for standalone selector enums;
  • EsFluentVariants for field or variant metadata; and
  • EsFluentLabel for type-level labels.
use es_fluent::{EsFluent, EsFluentLabel};

#[derive(EsFluent, EsFluentLabel)]
pub enum AccountMessage<'a> {
    Welcome { name: &'a str },
    SignedOut,
}

Derives support argument transforms, selectors, explicit keys, package-local domains, and namespace-based file splitting.

Derive Macros§

EsFluent
Turns an enum or struct into a localizable message.
EsFluentChoice
Allows an enum to be used inside another message as a selector (e.g., for gender or status).
EsFluentLabel
Generates a helper implementation of the FluentLabel trait and registers the type’s name as a key.
EsFluentVariants
Generates variant enums for struct fields.