Trait leptos_i18n::Locale
source · pub trait Locale: 'static + Default + Clone + Copy {
type Keys: LocaleKeys<Locale = Self>;
// Required methods
fn from_str(s: &str) -> Option<Self>;
fn as_str(self) -> &'static str;
// Provided methods
fn find_locale<T: AsRef<str>>(accepted_langs: &[T]) -> Self { ... }
fn get_keys(self) -> &'static Self::Keys { ... }
}
Expand description
Trait implemented the enum representing the supported locales of the application
Most functions of this crate are generic of type implementing this trait
Required Associated Types§
sourcetype Keys: LocaleKeys<Locale = Self>
type Keys: LocaleKeys<Locale = Self>
The associated struct containing the translations
Required Methods§
Provided Methods§
sourcefn find_locale<T: AsRef<str>>(accepted_langs: &[T]) -> Self
fn find_locale<T: AsRef<str>>(accepted_langs: &[T]) -> Self
Given a slice of accepted languages sorted in preferred order, return the locale that fit the best the request.
Object Safety§
This trait is not object safe.