xiCO2k / laravel-vue-i18n

Allows to connect your `Laravel` Framework translation files with `Vue`.
MIT License
598 stars 49 forks source link

Create multiple instances for different locales? #56

Closed ragulka closed 2 years ago

ragulka commented 2 years ago

I have a use-case where I need to show part of an app in one language, and another part in another language - both being visible at the same time. Would this be possible with this package, somehow? I was hoping I could just create an instance of some sort of i18n class, but it looks like there is no class at all?

ragulka commented 2 years ago

Looking through the source code it seems multiple instances are not possible, not even when creating multiple Vue app instances, as this package maintains a single internal state, which is shared even between different vue app instances, unfortunately. Would you consider refactoring the package in a way that would allow creating different instances of the i18n state, each with its own messages & locale?

xiCO2k commented 2 years ago

Hey @ragulka, would love to review a PR with that capability.

Thanks