i18n documentation incomplete
Author: thisismydesignCreated Feb 24, 2023Updated Jul 23, 2025
Posted as a StackOverflow question as well.
Is your feature request related to a problem? Please describe.
I'm trying to follow https://vuelidate-next.netlify.app/advanced_usage.html#i18n-support
But there are multiple things unclear:
- What is
import { i18n } from "@/i18n"? I'm using@nuxtjs/i18n@v7and not sure how to get global access toi18n. I'm not sure withvue-i18neither. - Are translations provided by this library or do I have to provide them? If so how?
Describe the solution you'd like
Docs with full examples to integrate i18n with nuxt and vue projects.
Describe alternatives you've considered
I found this workaround:
helpers/i18n-validators.ts
import * as validators from '@vuelidate/validators'
import { NuxtI18nInstance } from '@nuxtjs/i18n'
export const createRequired = (i18n: NuxtI18nInstance) => {
const { createI18nMessage } = validators
// It works™
// @ts-ignore
const withI18nMessage = createI18nMessage({ t: i18n.t.bind(i18n) })
return withI18nMessage(validators.required)
}Component.vue
import { createRequired } from '@/helpers/i18n-validators'
const required = createRequired($i18n)Manually add translations (even english ones), e.g. validations.required.
Also found
- this example: https://stackoverflow.com/a/75428346/2771889
- this article about TS support https://dev.to/itsribs/how-not-to-integrate-i18n-support-with-vuelidate-in-vue-3-3ode
Source: vuelidate/vuelidate