Instance of Composer (for Composition API) or VueI18n (for Legacy API) is exposed as $i18n on Vue instance.

getLocaleCookie()

  • Arguments:
    • no arguments
  • Returns: string | undefined

Returns locale code from stored locale cookie.

setLocaleCookie()

  • Arguments:
    • locale (type: string)
  • Returns: undefined

Updates stored locale cookie with specified locale code. Consider using setLocale instead if you want to switch locale.

setLocale()

  • Arguments:
    • locale (type: string)
  • Returns: Promise<void>

Switches locale of the app to specified locale code. If useCookie option is enabled, locale cookie will be updated with new value. If prefixes are enabled (strategy other than no_prefix), will navigate to new locale's route.

getBrowserLocale()

  • Arguments:
    • no arguments
  • Returns: string | undefined

Returns browser locale code filtered against the ones defined in options.

finalizePendingLocaleChange()

  • Arguments:
    • no arguments
  • Returns: Promise<void>

Switches to the pending locale that would have been set on navigate, but was prevented by the option skipSettingLocaleOnNavigate. See more information in Wait for page transition.

waitForPendingLocaleChange()

  • Arguments:
    • no arguments
  • Returns: Promise<void>

Returns a promise that will be resolved once the pending locale is set.

strategy

  • Type: Strategies

Routing strategy as specified in options.

defaultDirection

  • Type: Directions

Default direction as specified in options.

defaultLocale

  • Type: string

Default locale as specified in options.

localeCodes

  • Type: Array<string>

List of locale codes of registered locales.

locales

  • Type: Array<string | LocaleObject>

List of locales as defined in options.

localeProperties

  • Type: LocaleObject

Object of the current locale properties.

differentDomains

  • Type: boolean

Whether differentDomains option is enabled.

onBeforeLanguageSwitch

  • Type: Function

See callbacks

onLanguageSwitched

  • Type: Function

See callbacks