Open arpi17 opened 4 years ago
Related to lazy loading. The 'locale' value when calling createI18n is considered available even if no messages have been set yet.
This makes relying on availableLocales for lazy loading potentially problematic if the user overrode it, but i18n gets loaded first.
Tracking it outside of vue-i18n seems to be the best bet.
Hi there! I have two issues/questions regarding the
availableLocales
property.availableLocales
is a constructor option of theVueI18n
class. I think this is by mistake and it should be a part of the Properties section insteadavailableLocales
property is computed based on themessages
property https://github.com/kazupon/vue-i18n/blob/fe6787f4c24ce1a19d0eb72500b39ebe6873f77c/src/index.js#L279 This means it can only include locales that are already loaded. If using lazy loading it might be the case that some locales are not loaded yet and thus those won't show up in theavailableLocales
array. I put up a simple CodeSandbox to demonstrate this. As I found the nameavailableLocales
a bit misleading in this case I'd like to propose toVueI18n
class to contain this information. What do you think?