@i18n-micro/vue
Vue 3 bindings for i18n-micro — composables, components, and routing helpers.
Entry points: @i18n-micro/vue, @i18n-micro/vue/router.
@i18n-micro/vue
Components
I18nGroup
const I18nGroup: DefineComponent
''I18nLink
const I18nLink: DefineComponent
{}I18nSwitcher
const I18nSwitcher: DefineComponent
{}{}{}{}{}{}{}{} · Inline style applied to the switcher button when the current locale is
marked as disabled: true in the locale config. Note: disabled locales are omitted from the dropdown list, but the current
locale label is still shown on the button.{}I18nT
function I18nT(props: I18nTProps): any
See I18nTProps
Composables
useI18n
Get the i18n instance from the Vue app context Returns the same instance that was created with createI18n()
function useI18n(options?: UseI18nOptions): { … }
See UseI18nOptions
useLocaleHead
function useLocaleHead(options?: UseLocaleHeadOptions): { … }
Functions
createI18n
function createI18n(options: CreateI18nOptions): I18nPlugin
See CreateI18nOptions · I18nPlugin
Classes
VueI18n
class VueI18n extends BaseI18n {
constructor(options: VueI18nOptions)
}
computed(() => t(key)) re-runs after a write.locale is set when one locale's chunk was written, unset when anything may have changed.See BaseI18n · VueI18nOptions
Constants
I18nDefaultLocaleKey
const I18nDefaultLocaleKey: InjectionKey<string>
I18nInjectionKey
const I18nInjectionKey: InjectionKey<VueI18n>
See VueI18n
I18nLocalesKey
const I18nLocalesKey: InjectionKey<Locale[]>
See Locale
Types
I18nPlugin
type I18nPlugin = Plugin & { … }
I18nRouteTarget
A link target: a path with its query and hash, or a location (a named one needs a router that resolves names).
type I18nRouteTarget = string | {
path?: string;
name?: string | symbol;
params?: object;
query?: object;
hash?: string;
}
I18nRoutingStrategy
Routing strategy interface for i18n Implement this interface to integrate with any router library
interface I18nRoutingStrategy
href of a path from resolvePath, for a router that navigates by something else
(VitePress: paths are relative to the site base, the address bar is not)I18nTProps
interface I18nTProps
UseI18nOptions
interface UseI18nOptions
UseLocaleHeadOptions
interface UseLocaleHeadOptions
false · Also emit bare-language hreflang tags derived from iso (never from routing code).VueI18nOptions
interface VueI18nOptions
tn(n, 'currency')).td(d, 'short')).Europe/Berlin): set it so server and browser render one date.createI18n fills it from locales.Re-exports
Declared in another package of this repository and documented on its page.
- From
@i18n-micro/core:defaultPlural·interpolate·FormatService - From
@i18n-micro/types:CleanTranslation·Getter·Locale·LocaleCode·Params·PluralFunc·Translations
@i18n-micro/vue/router
Also exports, as @i18n-micro/vue does: I18nRoutingStrategy.
Functions
createVueRouterAdapter
Factory for Vue Router adapter Implements routing utilities for Vue Router Uses vue-router APIs for navigation and path resolution
function createVueRouterAdapter(
router: Router,
locales: Locale[],
defaultLocale: string,
): I18nRoutingStrategy
See Locale · I18nRoutingStrategy
Generated from the TypeScript sources and their JSDoc by pnpm run docs:generate.
Back to all packages · Integration guides