Crates.io | dioxus-i18n |
lib.rs | dioxus-i18n |
version | |
source | src |
created_at | 2024-08-31 13:32:55.301795 |
updated_at | 2025-02-07 21:14:27.002063 |
description | i18n integration for Dioxus apps based on Fluent Project. |
homepage | |
repository | https://github.com/dioxus-community/dioxus-i18n |
max_upload_size | |
id | 1358856 |
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` |
size | 0 |
i18n integration for Dioxus apps based on the Project Fluent.
This crate used to be in the Dioxus SDK.
# en-US.ftl
hello = Hello, {$name}!
// main.rs
fn app() -> Element {
let i18 = use_init_i18n(|| {
I18nConfig::new(langid!("en-US"))
// implicit [`Locale`]
.with_locale(( // Embed
langid!("en-US"),
include_str!("./en-US.ftl")
))
.with_locale(( // Load at launch
langid!("es-ES"),
PathBuf::from("./es-ES.ftl"),
))
.with_locale(( // Locales will share duplicated locale_resources
langid!("en"), // which is useful to assign a specific region for
include_str!("./en-US.ftl") // the primary language
))
// explicit [`Locale`]
.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"),
PathBuf::from("./es-ES.ftl"),
))
});
rsx!(
label { { t!("hello", name: "World") } }
)
}
# Checks clean compile against `#[cfg(not(target_arch = "wasm32"))]`
cargo build --target wasm32-unknown-unknown
# Runs all tests
cargo test