intlify/vue-i18n

[v9.6.4] Suppressing automatic locale fallback with `!` causes redundant `console.warn`s for missing keys

Closed this issue · 1 comments

Reporting a bug?

Thanks for a wonderful library!

{ locale: 'en-US!' } causes the library to console.warn about falling back to en-US for all translation keys, and appears to perform a redundant resolution step for missing keys.

Expected behavior

{ locale: 'en-US!' } should be identical to { locale: 'en-US' }, except with no fallback strategy, and no fallback-related console.warn logs should be present, as detailed in the docs:

To suppress the automatic fallback, add the postfix exclamation mark !, for example de-DE!

The final translation output is as expected, but the steps to get there are not.

Reproduction

StackBlitz repro

Open up browser developer tools to view console logs.

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.4.2 - /usr/local/bin/npm
    pnpm: 8.9.2 - /usr/local/bin/pnpm
npmPackages:
    @vitejs/plugin-vue: ^4.2.3 => 4.3.4 
    vite: ^4.4.9 => 4.4.9 
    vue: ^3.3.4 => 3.3.4 
    vue-i18n: ^9.6.4 => 9.6.4 
    vue-tsc: ^1.8.8 => 1.8.10

Screenshot

Screenshot of StackBlitz repro with developer tools opened to console logs. Four warning logs are circled for the "Test missing" key: fall back with en-US, not found in en-US, fall back with en-US, not found in en-US.

Additional context

No response

Validations

duplicate #1641