intlify / vue-i18n

Vue I18n for Vue 3
https://vue-i18n.intlify.dev/
MIT License
2.15k stars 327 forks source link

Add a way to suppress the console.warn message about 'allowComposition' in v9.3.0 #1523

Open rhianvanesch opened 1 year ago

rhianvanesch commented 1 year ago

Clear and concise description of the problem

In version 9.3.0, this console.warn message is shown every time we instantiate the plugin with createI18n.

[intlify] 'allowComposition' option will be dropped in the next major version. For more information, please see 👉 https://tinyurl.com/2p97mcze

This causes our unit test reports to be very noisy, as the message shows once per unit test.

We are also unable to quickly turn off allowComposition at this time (we have a very large codebase with a mix of Options and Composition API) and we may have to stay on v9 as we don't want to migrate every component to the Composition API, especially since the Options API is a valid way to develop with Vue, and is not being deprecated.

Suggested solution

It would be great if there was an option to suppress this warning with an option, or an environment variable.

Alternative

No response

Additional context

We can't downgrade to an earlier version of vue-i18n-next as we need the TypeScript fixes in 9.3.0.

Validations

estebandee commented 1 year ago

Agreed.

Also, as per the official Vue Docs, the Options API is not legacy nor deprecated:

Will Options API be deprecated?

No, we do not have any plan to do so. Options API is an integral part of Vue and the reason many developers love it. We also realize that many of the benefits of Composition API only manifest in larger-scale projects, and Options API remains a solid choice for many low-to-medium-complexity scenarios.

jean-dusenne commented 1 year ago

Hello if you do not use option API in your codebase, you can set property legacy to false with this property, i have no more warning about allowComposition

export default createI18n({
  legacy: false,
  locale: "en",
  allowComposition: true,
  messages: {
    en,
    es,
  },
  fallbackLocale: "en",
});
rhianvanesch commented 1 year ago

@jean-dusenne Unfortunately the problem here is that we are still using the Options API, and cannot quickly remove it, and it isn't a deprecated API, so we shouldn't have to remove it.

daniesg commented 8 months ago

Checking to see if this is under review. We have no plans to move our components to the composition API since it's a valid choice for Vue 3. We also have a few composition functions that use i18n, so we need both the options API and composition API. Is there a reason why the default option doesn't support both. Pinia supports both out of the box