2024-07-28 20:34:38 +01:00
|
|
|
use leptos::*;
|
|
|
|
use leptos_use::docs::demo_or_body;
|
|
|
|
use leptos_use::use_locale;
|
2024-08-13 13:45:36 +01:00
|
|
|
use unic_langid::langid_slice;
|
2024-07-28 20:34:38 +01:00
|
|
|
|
|
|
|
#[component]
|
|
|
|
fn Demo() -> impl IntoView {
|
2024-08-13 13:45:36 +01:00
|
|
|
let locale = use_locale(langid_slice!["en", "de", "fr"]);
|
2024-07-28 20:34:38 +01:00
|
|
|
|
|
|
|
view! {
|
2024-08-13 13:45:36 +01:00
|
|
|
<p>Locale: <code class="font-bold">{move || locale.get().to_string()}</code></p>
|
2024-07-28 20:34:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
_ = console_log::init_with_level(log::Level::Debug);
|
|
|
|
console_error_panic_hook::set_once();
|
|
|
|
|
|
|
|
mount_to(demo_or_body(), || {
|
|
|
|
view! { <Demo/> }
|
|
|
|
})
|
|
|
|
}
|