通过vee-validate进行的Vue-i18n集成无法按文档中所述进行操作 [英] Vue-i18n Integration by vee-validate not working as described in the documentation

查看:473
本文介绍了通过vee-validate进行的Vue-i18n集成无法按文档中所述进行操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我从 vee-复制/粘贴验证文档代码框,我没有收到验证消息-只是以下错误控制台:

Hello I did a copy/paste from the vee-validate documentation into this codesandbox and I get no validation message - just the following error on the console:

[vue-i18n] Cannot translate the value of keypath 'validations.messages._default'. Use the value of keypath as default.

vue-validate,vue-i18n和vuejs中的错误吗?还是应该以某种方式进行配置?

Is it a bug within vue-validate , vue-i18n, vuejs ? Or should one configurate it somehow different?

推荐答案

您忘记初始化i18n

you forgot to initialize i18n

之后

const i18n = new VueI18n();

添加此行

i18n.locale = "en";

此行告诉i18n它应寻找的语言,并将所有翻译(您可以在json文件中包含)与给定语言的veevalidator翻译合并

this line tells i18n what the language it should look for, and merges all your translations (that you can have in a json file) with the veevalidator translations of the given language

这篇关于通过vee-validate进行的Vue-i18n集成无法按文档中所述进行操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆