Yeah, that was my confusion to rui--I saw JS and assumed it was a JS file.  

My suggestion is for this code to be refactored to a JS file.  In lieu of that, since it's in a template file, it should be using trans.

Wrote up the conventions here, just now--thanks for the tip!
https://github.com/learningequality/ka-lite/wiki/Coding-guidelines-and-conventions