vue-i18n icon indicating copy to clipboard operation
vue-i18n copied to clipboard

Fall back to datetime localization of root. when using SFC

Open ChristianStornowski opened this issue 5 years ago • 2 comments

vue & vue-i18n version

ex: 2.6.10, 8.14.0

Steps to reproduce

  1. 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>.
  2. 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,
    ...
});

  1. Include new created SFC into an app.
  2. 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'.

ChristianStornowski avatar Aug 22 '19 12:08 ChristianStornowski

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
});

rdhainaut avatar Sep 04 '19 18:09 rdhainaut

I would consider this a bug, not an improvement, because there is no way to solve this issue other than silence the warning.

SinBirb avatar Feb 04 '21 09:02 SinBirb