7 releases

0.3.0 Dec 10, 2024
0.2.5 Sep 10, 2024
0.2.0 Aug 31, 2024
0.1.0 Aug 31, 2024

#54 in Accessibility

Download history 57/week @ 2024-09-18 115/week @ 2024-09-25 59/week @ 2024-10-02 67/week @ 2024-10-09 12/week @ 2024-10-16 17/week @ 2024-10-23 44/week @ 2024-10-30 44/week @ 2024-11-06 43/week @ 2024-11-13 94/week @ 2024-11-20 24/week @ 2024-11-27 135/week @ 2024-12-04 176/week @ 2024-12-11 133/week @ 2024-12-18 61/week @ 2024-12-25 77/week @ 2025-01-01

575 downloads per month

MIT license

54KB
160 lines

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

Dependencies

~5–10MB
~108K SLoC