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

What should be fallbackWarn/missingWarn/silentFallbackWarn combination to supress fallback when root locale exists?

Open Kasheftin opened this issue 1 year ago • 0 comments

Reporting a bug?

It's unclear / probably not working how fallbackWarn/missingWarn/silentFallbackWarn options should be used in the following case:

  • There's lang/message.json file with general translations;
  • Every component might have it's own <i18n> block with local translations;
  • If translation exists in general, but does not exist in local, it should be considered as correct, no warning should be shown in the console (no [intlify] Not found / [intlify] Fall back to translate should be shown);
  • If translation does not exist neither in local nor in general, it should give translation not found warning.

Currently (9.2.2) I can not pick the correct combination of options to achieve this.

Test 1:
  silentTranslationWarn: false,
  silentFallbackWarn: false
Result: 
  [intlify] Not found 'globalString' key in 'en' locale messages.
  [intlify] Fall back to translate 'globalString' with root locale.
  [intlify] Not found 'missingString' key in 'en' locale messages.
  [intlify] Fall back to translate 'missingString' with root locale.
  [intlify] Not found 'missingString' key in 'en' locale messages.

Test 2:
  silentTranslationWarn: true,
  silentFallbackWarn: false
Result: 
  [intlify] Fall back to translate 'globalString' with root locale.
  [intlify] Fall back to translate 'missingString' with root locale.

Test 3:
  silentTranslationWarn: false,
  silentFallbackWarn: true
Result: 
  [intlify] Not found 'globalString' key in 'en' locale messages.
  [intlify] Fall back to translate 'globalString' with root locale.
  [intlify] Not found 'missingString' key in 'en' locale messages.
  [intlify] Fall back to translate 'missingString' with root locale.
  [intlify] Not found 'missingString' key in 'en' locale messages.

Test 4:
  silentTranslationWarn: true,
  silentFallbackWarn: true
Result
  --- empty ---

I guess there's a bug, Test 3 should probably give Not found warnings only.

But even if it's fixed, there's still a logical issue. Suppose we can suppress Fall back warnings. The goal is to suppress Not found warnings if they were successfully resolved by fall back. How to achive this?

Expected behavior

Tests are provided above

Reproduction

It's just the default app and 2 configuration settings in different combinations

System Info

System:
    OS: Linux 5.15 Ubuntu 20.04.5 LTS (Focal Fossa)
    CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
    Memory: 20.44 GB / 31.32 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
    Yarn: 1.22.5 - ~/.yarn/bin/yarn
    npm: 8.5.5 - ~/.nvm/versions/node/v16.14.2/bin/npm
  Browsers:
    Chrome: 105.0.5195.125
    Firefox: 105.0
  npmPackages:
    @intlify/vite-plugin-vue-i18n: ^6.0.3 => 6.0.3 
    @vitejs/plugin-vue: ^3.0.3 => 3.1.2 
    @vue/eslint-config-prettier: ^7.0.0 => 7.0.0 
    @vue/eslint-config-typescript: ^11.0.0 => 11.0.2 
    @vue/tsconfig: ^0.1.3 => 0.1.3 
    vite: ^3.0.9 => 3.1.7 
    vite-plugin-vuetify: ^1.0.0-alpha.12 => 1.0.0-alpha.17 
    vite-svg-loader: ^3.6.0 => 3.6.0 
    vue: ^3.2.38 => 3.2.40 
    vue-cli-plugin-vuetify: ~2.5.8 => 2.5.8 
    vue-i18n: ^9.2.2 => 9.2.2 
    vue-router: ^4.1.5 => 4.1.5 
    vue-tsc: ^0.40.7 => 0.40.13 
    vuetify: ^3.0.0-beta.0 => 3.0.0-beta.13 
    vuex: ^4.0.2 => 4.0.2

Screenshot

No response

Additional context

No response

Validations

Kasheftin avatar Oct 12 '22 11:10 Kasheftin