Dynamic Javascript using Scala template

亡梦爱人 提交于 2019-12-06 05:13:31

Actually you don't need to translate your JavaScripts dynamically, it's reduntant waste of resources, instead prepare static JS files like messages.en.js, messages.de.js etc and include required file basing on the user's language directly into the view.

Here you have some description how to make it easy (JavaScript approach)

There is a module allowing javascript internationalization using the same mechanism as in Play templates, have a look at : https://github.com/julienrf/play-jsmessages

This will definitely fits your needs. I use it for a while know with success. You can expose your translations through a javascript file and then use browser caching with a proper fingerprinting configuration.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!