Function leptos_use::use_locale

source ·
pub fn use_locale<S>(supported: S) -> Signal<LanguageIdentifier>
Expand description

Reactive locale matching.

Returns the first matching locale given by crate::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

Link to Demo

§Usage

use unic_langid::langid_slice;
let locale = use_locale(langid_slice!["en", "de", "fr"]);

§Server-Side Rendering

See crate::use_locales