Some checks failed
actionlint check / actionlint check (pull_request) Successful in 7s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 3s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 6s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 9s
GitLeaks check / GitLeaks check (pull_request) Successful in 11s
hadolint check / hadolint check (pull_request) Successful in 14s
Prettier check / Prettier check (pull_request) Failing after 35s
markdownlint check / markdownlint check (pull_request) Failing after 40s
htmlhint check / htmlhint check (pull_request) Successful in 44s
checkov check / checkov check (pull_request) Failing after 1m20s
ShellCheck check / ShellCheck check (pull_request) Successful in 23s
Stylelint check / Stylelint check (pull_request) Successful in 24s
yamllint check / yamllint check (pull_request) Successful in 22s
Rust check / Rust check (pull_request) Failing after 57m45s
58 lines
1.4 KiB
Rust
58 lines
1.4 KiB
Rust
#![cfg_attr(
|
|
all(not(debug_assertions), target_os = "windows"),
|
|
windows_subsystem = "windows"
|
|
)]
|
|
|
|
use dioxus_i18n::{prelude::*, t};
|
|
use freya::prelude::*;
|
|
use unic_langid::langid;
|
|
|
|
use std::path::PathBuf;
|
|
|
|
fn main() {
|
|
launch_with_props(app, "freya + i18n", (300.0, 200.0));
|
|
}
|
|
|
|
#[allow(non_snake_case)]
|
|
fn Body() -> Element {
|
|
let mut i18n = i18n();
|
|
|
|
let change_to_english = move |_| i18n.set_language(langid!("en-US"));
|
|
let change_to_spanish = move |_| i18n.set_language(langid!("es-ES"));
|
|
|
|
rsx!(
|
|
rect {
|
|
rect {
|
|
direction: "horizontal",
|
|
Button {
|
|
onclick: change_to_english,
|
|
label {
|
|
"English"
|
|
}
|
|
}
|
|
Button {
|
|
onclick: change_to_spanish,
|
|
label {
|
|
"Spanish"
|
|
}
|
|
}
|
|
}
|
|
label { { t!("hello_world") } }
|
|
label { { t!("hello", name: "Dioxus") } }
|
|
}
|
|
)
|
|
}
|
|
|
|
fn app() -> Element {
|
|
use_init_i18n(|| {
|
|
I18nConfig::new(langid!("en-US"))
|
|
.with_locale((langid!("en-US"), include_str!("./data/i18n/en-US.ftl")))
|
|
.with_locale((
|
|
langid!("es-ES"),
|
|
PathBuf::from("./examples/data/i18n/es-ES.ftl"),
|
|
))
|
|
});
|
|
|
|
rsx!(Body {})
|
|
}
|