dioxus-i18n

Crates.iodioxus-i18n
lib.rsdioxus-i18n
version
sourcesrc
created_at2024-08-31 13:32:55.301795
updated_at2024-12-10 10:26:39.264963
descriptioni18n integration for Dioxus apps based on Fluent Project.
homepage
repositoryhttps://github.com/dioxus-community/dioxus-i18n
max_upload_size
id1358856
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Marc Espin (marc2332)

documentation

README

dioxus-i18n 🌍

i18n integration for Dioxus apps based on the Project Fluent.

This crate used to be in the Dioxus SDK.

Support

  • Dioxus v0.6 🧬
  • All renderers (web, desktop, etc), freya doesn't support Dioxus 0.6 yet.
  • Both WASM and native targets

Example:

# en-US.ftl

hello = Hello, {$name}!
// main.rs

fn app() -> Element {
    let i18 = use_init_i18n(|| {
        I18nConfig::new(langid!("en-US"))
            .with_locale(Locale::new_static( // Embed
                langid!("en-US"),
                include_str!("./en-US.ftl"),
            ))
            .with_locale(Locale::new_dynamic( // Load at launch
                langid!("es-ES"),
                include_str!("./es-ES.ftl"),
            ))
    });

    rsx!(
        label { { t!("hello", name: "World") } }
    )
}

MIT License

Commit count: 14

cargo fmt