Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The package does not support multi-lang apps #7

Closed
iamgergo opened this issue May 29, 2019 · 3 comments
Closed

The package does not support multi-lang apps #7

iamgergo opened this issue May 29, 2019 · 3 comments

Comments

@iamgergo
Copy link
Member

Since the translations are generated via blade directive, they are stored statically in the compiled templates. This is performance friendly, however, it does not track the current application locale.

It means, if the application local has been changed, the generated translations will have the previous locale.

@iamgergo
Copy link
Member Author

iamgergo commented Jun 2, 2019

Some possible solutions:

  • Don't cache the translations, always generate them on runtime based on the current locale.
  • Map all the available locales (based on the lang dir) and build a basic switch for the current locale. This way we can use the compiled versions, however, we need to compile all the available languages also we need to check if the packages have translations with the language and compile it as well.

@iamgergo
Copy link
Member Author

iamgergo commented Jun 2, 2019

@deiberchacon Hi!

So, I was working on the 2nd way, that I mentioned in my previous comment.
Actually, it works. I will write some tests and refactor a bit, then I commit – maybe in a new branch – and you can test if it works well for you as well.

I'll ping you here soon! Thanks!

@iamgergo
Copy link
Member Author

iamgergo commented Jun 3, 2019

@deiberchacon I committed and tagged the new release.

Now the package supports multi-locale translations and package translations as well.
All the available locales are rendered, but behind the scenes, there is a simple switch-case that determines which is the proper based on the current locale.

This way we can have the performance advantage and also we can change the locale without rerendering the views.

You may update your package to the latest version. Be brave to open a new issue to if you find any bug or weird behavior. I close this issue now.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant