kazupon / vue-i18n

:globe_with_meridians: Internationalization plugin for Vue.js
https://kazupon.github.io/vue-i18n/
MIT License
7.28k stars 861 forks source link

Fall back to datetime localization of root. when using SFC #689

Open ChristianStornowski opened 5 years ago

ChristianStornowski commented 5 years ago

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

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

rdhainaut commented 5 years ago

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
});
SinBirb commented 3 years ago

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