fix an issue with quotes in translation

use JSON.stringify to print strings escaped. Without this, the default
template might produce unloadable JS code. Example is provided.
pretty print JSON in custom template

produces more readable output