Vee-validate: locale not work in nuxt

Created on 11 Oct 2017  路  3Comments  路  Source: logaretm/vee-validate

Versions:

  • Nuxt: 4.0.0
  • Vee-Validate: 2.0.0-rc.18

Description:

locale config not work ,here is my code:

import Vue from 'vue'
import VeeValidate, { Validator } from 'vee-validate'
import cn from 'vee-validate/dist/locale/zh_CN'
Validator.addLocale(cn)
Vue.use(VeeValidate, {
  locale: 'cn'
})

But , after set the prompt still english .

Steps To Reproduce:

Most helpful comment

I use Nuxt.js in a couple of projects and I didn't face this issue. You should add the locale after the installation/configuration, and I suggest you use the new API method localize

import Vue from 'vue'
import VeeValidate, { Validator } from 'vee-validate'
import cn from 'vee-validate/dist/locale/zh_CN'

Vue.use(VeeValidate)

// adds and sets the validator locale
Validator.localize('cn', cn)

All 3 comments

I use Nuxt.js in a couple of projects and I didn't face this issue. You should add the locale after the installation/configuration, and I suggest you use the new API method localize

import Vue from 'vue'
import VeeValidate, { Validator } from 'vee-validate'
import cn from 'vee-validate/dist/locale/zh_CN'

Vue.use(VeeValidate)

// adds and sets the validator locale
Validator.localize('cn', cn)

Thanks so much , you have resolved my issue .

@logaretm I don't think this is a good solution.

I want to implement a hot reload of language in my Nuxt app. With above solution locale is loaded when plugin is loaded. But how to hot reload it?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

saintplay picture saintplay  路  3Comments

schel4ok picture schel4ok  路  3Comments

MaxMilton picture MaxMilton  路  3Comments

the94air picture the94air  路  3Comments

biapar picture biapar  路  3Comments