'Lazy loading translation file in <i18n> tag

I want to reduce my app size and i started from language files.
I'm using vue-i18n Single File Components and i can lazy load like this vue-i18n Lazy loading. I read about custom lang blocks, but as i know i can't set dynamic locale in src.

Now my question: is there a way to lazy load languages in <i18n> tag?



Solution 1:[1]

The library author did answered the question - translations defined as part of Vue SFC are compiled (by the loaders for appropriate build tool) as an export from SFC module. That means they are part of the component module and only way to lazy load is to lazy load the component itself

So no, there is no way to lazy load single language defined in i18 custom blocks. If you need lazy loading, don't use custom blocks and rather define your translations in global JSON files (split by language). Other alternative is to completely rewrite the loader itself to collect and merge custom blocks into such global module but that is a lot of work and I would not recommend that...

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Michal Levý