Add config option for not encoding as html entities
Closed this issue · 6 comments
First of all, thanks for this great package!
I'm having a problem with the html entity representations of German Umlauts (äöü) in javascript. For example bestätige
is being encoded as bestätige
. This does not work when I pass the string to a plugin that then sets the text e.g. with jQuery's .text()
.
Could you add an option to not encode special characters and just keep everything utf-8?
Hi @chlab!
Thanks for sharing that issue. I will have a look at it this evening or so. I cannot tell what causes this conversion at all without having a closer look into the code, but will definitely add a test case for that 😉
Thanks @andywer. I looked into this today and it's actually the philo/laravel-tanslate package that converts entities and supplies a --no-entities
option to work around it. Thanks anyway!
Nothing to fix? Awesome 😅
Since adding js translations involves:
- adding the translation
- registering the translation for js
- refreshing the js translation cache
I might write a console command that ties those three tasks together. Would you accept a pull request that adds that command? I would make it use philo/laravel-translate so it would have to be an additional command like php artisan js-localization:add.
Hmm. Interesting point. But:
Step 1 requires manually changing the localization files anyway I guess, since you will have to add translations in n
files given n
different languages you support.
Counter proposal:
Maybe it would make sense to watch the language files for changes when in development mode and automatically trigger the cache-refresh, though. Can be quite "expensive" to watch all these files on every request, but as an optional feature that is by default off when in production mode it might be nice.
What do you think about that?
PS: If we need to discuss this further (?) we should open a new issue for that 😉