Skip to content

Cannot silence fallback warnings like on V8 #776

Open
@LifeIsStrange

Description

@LifeIsStrange

Reporting a bug

By default when fallbacking fail, two warnings are printed
e.g

[intlify] Fall back to translate 'bf.headerBar.homeSearchBarPlaceholder' key with 'en' locale
[intlify] Not found 'bf.headerBar.homeSearchBarPlaceholder' key in 'en' locale messages.

The documentation clearly state:

To suppress these warnings (while keeping those which warn of the total absence of translation for the given key) set silentTranslationWarn: true, and silentFallbackWarn: true when initializing the createI18n.

Since the failing fallback warnings are much too noisy, I want to silence them, but keep other i18n warnings.
Unfortunately, it seems that those booleans have been silently renamed and the documentation no longer reflect the state of V9
Apparently silentFallbackWarn has become fallbackWarn and the boolean logic reversed. If so why not I don't care and indeed setting fallbackWarn remove half of the warnings.
silentTranslationWarn seems to now longer exist ? (at least in non-legacy mode), however I cannot find the new boolean.
It should have been renamed to translationWarn to be consistent with fallbackWarn renaming but there is no such thing.
The ComposerOptions type expose the following candidates:

  • missingWarn: when enabled it effectively hide warnings, but it hide too much warnings e.g I have no key in the fallback languages nor in the user locale.
    This is in direct contradiction with

while keeping those which warn of the total absence of translation for the given key

  • missing: this boolean might be the new silentTranslationWarn ? weird cause the type is not a boolean despite what the doc claims, I have no idea how to set missing.

I am on the latest stable Vue-i18n 9.1.x release.

const i18n = createI18n({
  fallbackWarn: false,
  missingWarn: false,
  fallbackLocale: ["en", "fr"],
  globalInjection: true,
  legacy: false,
  useScope: "global",
  locale: locale,
  messages: loadTranslations(),
  datetimeFormats,
  numberFormats,
});

edit:
the doc confirm that silentTranslationWarn has been renamed to missingWarn.
Then how come I have now warning when no key is found for fallbackLocale?
@kazupon friendly ping

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions