Leptos-Use Guide

use_locale

Reactive locale matching.

Returns the first matching locale given by use_locales that is also found in the supported list. In case there is no match, then the first locale in supported will be returned.

If supported is empty, this function will panic!

Matching is done by using the unic_langid::LanguageIdentifier::matches method.

Demo

Usage

use leptos::*;
use leptos_use::use_locale;
use unic_langid::langid_slice;

#[component]
fn Demo() -> impl IntoView {
let locale = use_locale(langid_slice!["en", "de", "fr"]);

view! { }
}

Server-Side Rendering

See use_locales

Feature

This function is only available if the crate feature use_locale is enabled

Source

SourceDemoDocs