vueI18n
- type:
object
orstring
- default:
{}
Configuration for the vue-i18n
library that is used internally by this module. See full documentation at https://vue-i18n.intlify.dev/api/general.html#createi18n
It's also supported to set this property to a path to a local configuration file. The file needs to export a function or plain object. If a function, it will be passed a Nuxt Context as a parameter. It's necessary to use that approach when overriding more complex types (like functions) that can't be stringified correctly.
~/vue-i18n.options.ts
import type { I18nOptions } from 'vue-i18n'import type { NuxtApp } from 'nuxt/dist/app/index'export default function (nuxt: NuxtApp) { return { modifiers: { snakeCase: (str) => str.split(' ').join('-') } } as I18nOptions}
The
messages
option cannot be included in an object and exported with function due to limitations in Vue I18n v9 handling of locale messages.As the workaround, you can use lazy-load transtions in @nuxtjs/i18n
. locale messages handled with lazy-load transtions will be loaded as locale messges inside Vue i18n.