vue-i18n
vue-i18n copied to clipboard
Fall back to datetime localization of root. when using SFC
vue & vue-i18n version
ex: 2.6.10, 8.14.0
Steps to reproduce
- Create a SFC with
<i18n>{"de": {"clockPostfix": "Uhr"}}</i18n>
tag and an template like<template><div>{{ $d(new Date(), 'long', 'de') }} {{ $t('clockPostfix') }}</div></template>
. - Setup i18n config with dateTimeFormate:
const dateTimeFormats = {
'de': {
long: {
day: '2-digit', month: '2-digit', year: 'numeric', minute: '2-digit', hour: '2-digit'
}
}
};
export default new VueI18n({
...
dateTimeFormats
})
new Vue({
i18n,
...
});
- Include new created SFC into an app.
- Start app.
What is Expected?
No console warning.
What is actually happening?
[vue-i18n] Fall back to 'de' datetime formats from 'de' datetime formats.
[vue-i18n] Fall back to datetime localization of root: key 'long'.
I have the same issue. In waiting, this is a simple workaround that desactive fallback warning:
const i18n = new VueI18n({
// skip other options config for briefty
silentFallbackWarn: true
});
I would consider this a bug, not an improvement, because there is no way to solve this issue other than silence the warning.