Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect warnings around fallback #373

Closed
daniesg opened this issue Mar 2, 2021 · 10 comments
Closed

Incorrect warnings around fallback #373

daniesg opened this issue Mar 2, 2021 · 10 comments
Labels
Type: Bug Bug or Bug fixes

Comments

@daniesg
Copy link

daniesg commented Mar 2, 2021

vue & vue-i18n version

  • vue: 3.0.5
  • vue-i18n: 9.0.0

What is Expected?

The docs have an example of using both local and global translations in a component. It notes that:

And also, as explained the here, note that, by default, falling back to global scope generates two warnings in the console:

[intlify] Not found 'message.greeting' key in 'ja' locale messages.
[intlify] Fall back to translate 'message.greeting' with root locale.

It also states that

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.

What is actually happening?

Instead what I'm seeing is only one warning

[intlify] Not found 'message.greeting' key in 'ja' locale messages.

When I add only silentFallbackWarn: true, there is no difference. And if I add silentTranslationWarn: true (with and without silentFallbackWarn), it silences all missing translation warnings, even those where it couldn't find it in the global messages.

Are the docs out of date or is this a bug?

@kazupon kazupon added the Type: Bug Bug or Bug fixes label Mar 3, 2021
@kazupon
Copy link
Member

kazupon commented Mar 3, 2021

Thank you for your reporting!
This is the bug.

I'll try to fix it!

@kazupon
Copy link
Member

kazupon commented Mar 3, 2021

I've fixed at #374

@kazupon kazupon closed this as completed Mar 3, 2021
@daniesg
Copy link
Author

daniesg commented Mar 3, 2021

Thanks for the fast response!

@johannesstricker
Copy link

johannesstricker commented Apr 28, 2021

@kazupon I think this is still an issue (or again, maybe) on version 9.1.6. I'm using this setup:

export const i18nPlugin = createI18n({
  legacy: true,
  locale: 'en',
  fallbackLocale: 'en',
  messages,
  silentFallbackWarn: true,
});

Then, in a component I'm using local messages mixed with global messages:

export default {
  name: 'SomeComponent',
  i18n: {
    messages: {
      en: { hello: 'Hello World!' },
    },
  },
};

I'm getting these errors:

[intlify] Not found 'path.to.key' key in 'en' locale messages.
[intlify] Fall back to translate 'path.to.key' with root locale.

@kazupon
Copy link
Member

kazupon commented Apr 29, 2021

Hmm 🤔, If you are possible, Could you give us the minimum reproduction codes, please? 🙏

@Coffcer
Copy link

Coffcer commented Jun 9, 2021

i have the same issue. v9.1.6

const i18n = createI18n({
  locale: 'en',
  messages,,
  silentFallbackWarn: true
})
app.use(i18n)


function setup () {
  const { t } = useI18n({
      messages,
      fallbackWarn: false
   })

  return {
    t
  }
 }

@lambda0xff
Copy link

Still an issue with 9.1.9

@Grawl
Copy link

Grawl commented Oct 15, 2021

just installed version 9.2.0-beta.12 with yarn add vue-i18n@next, and issue is fixed with fallbackWarn: false

but now I have [intlify] Not supported 'preserve'. warning

@themegaphoenix
Copy link

just installed version 9.2.0-beta.12 with yarn add vue-i18n@next, and issue is fixed with fallbackWarn: false

but now I have [intlify] Not supported 'preserve'. warning

I suffer from the same issue

@kazupon
Copy link
Member

kazupon commented Dec 21, 2021

API docs said on fallbackWarn:
https://vue-i18n.intlify.dev/api/composition.html#fallbackwarn

Whether suppress fall back warnings when localization fails.

but now I have [intlify] Not supported 'preserve'. warning

This warning is output when you use the deprecated feature in v9.x
ref:
https://vue-i18n.intlify.dev/guide/migration/breaking.html#remove-preservedirectivecontent-option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug or Bug fixes
Projects
None yet
Development

No branches or pull requests

7 participants