Javascript Translation
Permalink
When we build blocks we use <?php echo t('Text")?> to translate it to the local language.
What about when we are generating things in javascript, how do we return translated strings instead of hard coded language specific strings?
What about when we are generating things in javascript, how do we return translated strings instead of hard coded language specific strings?
I don't know if this addresses your question, but I've managed to sneak a few things past the PRB by using t() in view.php to populate a JS object. An example from
https://www.concrete5.org/marketplace/addons/read-more-trial...
The .js file can access this object and hence its translated members.
This isn't 'generating things in javascript' so may not help you.