【发布时间】:2019-09-04 18:02:50
【问题描述】:
我有一个使用 vue-i18n 本地化的应用程序。所有字符串都保存在 JSON 文件中,翻译工作正常。现在我需要添加一个日期时间本地化 as seen here,但该模块没有获取我的配置,并且我在控制台中收到有关“从 'en datetime 格式回退到 'en-US' datetime 格式”的警告。
配置
import messages from './messages.json'
const dateTimeFormats = {
'en-US': {
short: {
year: 'numeric', month: 'short', day: 'numeric'
}
}
}
const i18n = new VueI18n({
locale: 'en',
messages,
dateTimeFormats
})
模板
<b-col cols="7" lg="12"><p class="margin-0">{{ $d(new Date(), 'short') }}</p></b-col>
我尝试明确设置{{ $d(new Date(), 'short', 'en-US') }},我尝试只传递dateTimeFormats 我不断收到相同的警告,但我的标记中没有打印任何内容
【问题讨论】:
标签: javascript vue.js vuejs2 internationalization vue-i18n