pub struct LocaleRegistry { /* private fields */ }Expand description
A registry of locale tables.
Implementations§
Source§impl LocaleRegistry
impl LocaleRegistry
Sourcepub fn with_all_locales() -> Self
pub fn with_all_locales() -> Self
Create a registry with all supported locales: en, zh, es, ja, ar, hi, fr, de.
Sourcepub fn with_en_and_zh() -> Self
pub fn with_en_and_zh() -> Self
Create a registry with English and Chinese tables.
Sourcepub fn new(tables: Vec<LocaleTable>) -> Self
pub fn new(tables: Vec<LocaleTable>) -> Self
Create a registry with the given tables.
Sourcepub fn resolve(&self, keyword: &str) -> Option<(Locale, &'static str)>
pub fn resolve(&self, keyword: &str) -> Option<(Locale, &'static str)>
Resolve a keyword from any locale to its canonical English form. Returns (locale, canonical_keyword) if found.
Sourcepub fn is_keyword(&self, text: &str) -> bool
pub fn is_keyword(&self, text: &str) -> bool
Check if a string is a keyword in any locale.
Sourcepub fn table_for(&self, locale: Locale) -> Option<&LocaleTable>
pub fn table_for(&self, locale: Locale) -> Option<&LocaleTable>
Get the table for a specific locale.
Sourcepub fn locale_count(&self) -> usize
pub fn locale_count(&self) -> usize
Number of registered locales.
Sourcepub fn total_keywords(&self) -> usize
pub fn total_keywords(&self) -> usize
Total number of keywords across all locales.
Trait Implementations§
Source§impl Clone for LocaleRegistry
impl Clone for LocaleRegistry
Source§impl Debug for LocaleRegistry
impl Debug for LocaleRegistry
Auto Trait Implementations§
impl Freeze for LocaleRegistry
impl RefUnwindSafe for LocaleRegistry
impl Send for LocaleRegistry
impl Sync for LocaleRegistry
impl Unpin for LocaleRegistry
impl UnsafeUnpin for LocaleRegistry
impl UnwindSafe for LocaleRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more