kazupon / vue-i18n

:globe_with_meridians: Internationalization plugin for Vue.js
https://kazupon.github.io/vue-i18n/
MIT License
7.28k stars 861 forks source link

Default to en over en-US #579

Open philipschm1tt opened 5 years ago

philipschm1tt commented 5 years ago

Hi,

I would like to propose to change the default locale of VueI18n from "en-US" to "en".

"en" is widely used for countries outside of the US and is often treated as the default. Consequently, more projects have "en" messages.

Generally, this is not an issue, because people are supposed to set the locale for their use case and don’t rely on the default value.

In my case, specifically, we have a weird issue with our Storybook configuration. Even though we integrated vue-i18n following your Storybook example, Storybook does not pass the i18n instance from the story down to the components if the components use tags. The components receive a new i18n instance using the default "en-US" locale. There is no clear way to fix this issue, since our Storybook configuration uses the actual Vue CLI 3 webpack configuration (which works). If the default was "en", our Storybook configuration issue would not present a problem.

Thank you for reading. Keep up the good work on the library!

exoego commented 5 years ago

It is true that en-US is currently default in vue-i18n. https://github.com/kazupon/vue-i18n/blob/2c9c675a7b5a82e0fa8daccf061fcda7610dab48/src/index.js#L65-L66

I have no experience with Storybook and can not tell how to configure them in Storybook. Hope someone give advice on this topic.

It sounds more like Storybook's issue, if "Storybook does not pass the i18n instance from the story down to the components if the components use tags" is true. It maybe better to open an issue in Storybook.

philipschm1tt commented 5 years ago

It’s not a general Storybook issue. @kazupon even has a vue-i18n Storybook example where it works.

I suspect that it is an issue with our complicated webpack setup. I configured Storybook to use our production webpack setup. That seems like a good approach but may have interfered with the i18n setup.

At the moment, we simply accept that Storybook displays "message.key" instead of the localizations. We accept that over having to track down the issue.

However, I figured that "en" would make more sense as vue-i18n fallback language since a lot more people have "en" localizations than "en-US".

exoego commented 5 years ago

I agree that en is more generic and preferrable fallback rather than en-US, as an user and contributor of vue-i18n. However, changing default value could be a breaking change, since there is a possibility that some users rely on en-US fallback.

So I suggest @kazupon to change default to en when vue-i18n reaches v9.