Getting Started

Configuration

Nuxt zodI18n configuration

You can configure Nuxt zodI18n with the zodI18n property in your nuxt.config file.

nuxt.config.ts
export default defineNuxtConfig({
  zodI18n: {
    // My custom configuration
  }
})

dateFormat

Change default date format in error message linked to Date.

nuxt.config.ts
export default defineNuxtConfig({
  zodI18n: {
    dateFormat: {
      day: '2-digit',
      month: 'numeric',
      year: 'numeric'
    }
  }
})
As result show 20/12/2020 instead of 20 December 2020

localeCodesMapping

  • Type: Record<string, string>
  • Default: undefined

Change default i18n codes to own custom ones.

nuxt.config.ts
export default defineNuxtConfig({
  zodI18n: {
    localeCodesMapping: {
      'en-GB': 'en',
      'fr-FR': 'fr'
    }
  }
})

useModuleLocale

  • Type: boolean
  • Default: true

Toggle usage of module internal translation files.

By setting it to false you need to provide your own translations under zodI18n key.
You can use this file with English translation as basis.


Copyright © 2023