Options

Misc

Miscellaneous options.

experimental

  • type: object
  • default: { localeDetector: '', switchLocalePathLinkSSR: false, autoImportTranslationFunctions: false }

Supported properties:

  • localeDetector (default: '') - Specify the locale detector to be called per request on the server side. You need to specify the filepath where the locale detector is defined.
    About how to define the locale detector, see the defineI18nLocaleDetector API
  • switchLocalePathLinkSSR (default: false) - Changes the way dynamic route parameters are tracked and updated internally, improving language switcher SSR when using the SwitchLocalePathLink component.
  • autoImportTranslationFunctions (default: false) - Automatically imports/initializes $t, $rt, $d, $n, $tm and $te functions in <script setup> when used.
    This feature relies on Nuxt's Auto-imports and will not work if this has been disabled.

customBlocks

  • type: object
  • default: { defaultSFCLang: 'json', globalSFCScope: false }

Configure the i18n custom blocks of SFC.

Supported properties:

  • defaultSFCLang (default: 'json') - Specify the content for all your inlined i18n custom blocks on your SFC. about details, see here
  • globalSFCScope (default: false) - Whether to include all i18n custom blocks on your SFC on global scope. about details, see here

types

  • type: string (composition or legacy)
  • default: composition

Enforces the type definition of the API style to be used. If you set composition, Composition API types provided by Vue I18n and @nuxtjs/i18n are supported, else legacy, Options API types are supported.

If it can not detect Nuxt configuration changing, you may need to run nuxi prepare.

debug

  • type: boolean
  • default: false

Whether to use @nuxtjs/i18n debug mode. If true, logs will be output to the console.

The purpose of this option is to help identify any problems with @nuxtjs/i18n.Don't enable this option in production. It's not optimized for it.

parallelPlugin

  • type: boolean
  • default: false

Set the plugin as parallel. See nuxt plugin loading strategy.

restructureDir

  • type: string | undefined
  • default: undefined

Can be used to configure the directory used to resolve i18n files, this will be set to i18n by default in the v9 release.

Setting this value will also change the default value for langDir, which is locales if unset, this is the new default value in v9.

Copyright © 2024