I am trying to localize Javascript files. For example, I would:
var count = 0; $('#choices .choice').each(function(i) { $('input', this).each(function() { count++ $(this).attr('placeholder', '@Message("placeholder.choice") ' + count) }) })
This will obviously work if the Javascript file is inside the Scala HTML template, but I would rather have it in a dedicated file.
To begin with, I wonder if this is a good idea: how about caching a file if the contents can change? In this case, there is one parameter: is there a solution to this problem in the URL? For example: /assets/javascripts/:lang/my-file.js .
And the real question is: is this possible using Play! framework? It seems that Javascript templates are not supported (or I missed something). Is there any way to do this right?
source share