useLocale API
API reference for the useLocale composable.
Related
Explore these related pages for additional context and usage patterns.
| Page | Category |
|---|---|
| useLocale | Plugins |
| Locale | Providers |
| Accessibility | Features |
Functions
createLocale
(_options?: LocaleOptions<TokenCollection>) => LocaleContext<LocaleTicketInput, LocaleTicket<LocaleTicketInput>>Creates a new locale instance.
createLocaleFallback
() => LocaleContext<LocaleTicketInput, LocaleTicket<LocaleTicketInput>>createLocaleContext
<_E>(_options?: LocalePluginOptions | undefined) => ContextTrinity<_E>createLocalePlugin
(_options?: LocalePluginOptions | undefined) => PluginuseLocale
<_E>(namespace?: string) => _EOptions
disabled
MaybeRefOrGetter<boolean> | undefinedDisabled state for the entire model instance
Default: false
multiple
MaybeRefOrGetter<boolean> | undefinedAllow multiple tickets to be selected simultaneously
Default: false
mandatory
MaybeRefOrGetter<boolean | "force"> | undefinedControls mandatory selection behavior: - `false` (default): No mandatory selection enforcement - `true`: Prevents deselecting the last selected item - `'force'`: Automatically selects the first non-disabled item on registration
adapter
LocaleAdapter | undefineddefault
ID | undefinedfallback
ID | undefinedmessages
Record<ID, Z> | undefinedProperties
selectedValues
ComputedRef<Set<E["value"] extends Ref<infer U, infer U> ? U : E["value"]>>Computed Set of selected ticket values
selectedId
ComputedRef<ID | undefined>selectedIndex
ComputedRef<number>selectedItem
ComputedRef<E | undefined>selectedValue
ComputedRef<E["value"] | undefined>Methods
seek
(direction?: "first" | "last", from?: number, predicate?: (ticket) => boolean) => E | undefinedSeek for a ticket based on direction and optional predicate
on
<K extends Extensible<RegistryEventName>>(event: K, cb: RegistryEventCallback<E, K>) => voidListen for registry events
off
<K extends Extensible<RegistryEventName>>(event: K, cb: RegistryEventCallback<E, K>) => voidStop listening for registry events
emit
<K extends Extensible<RegistryEventName>>(event: K, data: EventPayload<E, K>) => voidEmit an event with data
offboard
(ids: ID[]) => Partial<Z>[]Offboard multiple tickets at once, returning the input shapes that were removed.
batch
<R>(fn: () => R) => RExecute operations in a batch, deferring cache invalidation and event emission until complete
n
(value: number) => stringregister
(registration?: Partial<Z>) => ERegister a locale with optional messages. When `messages` is provided, flattens them to dot-notation tokens and onboards them into the token registry before registering the locale for selection.