So I guess the issue is:
s.write('locale',` exports.name = function() {return '${lang}'}; exports.temp = function(n){return n + '${locale[lang].tr}';}; exports.translate = function(t){return ${locale[lang].tr}[t];}; `);
You want something more like:
s.write('locale',` exports.name = function() {return ${JSON.stringify(lang)}}; exports.temp = function(n){return n + ${JSON.stringify(locale[lang].t)};}; exports.translate = function(t){return ${JSON.stringify(locale[lang].tr}[t]);}; `);
Generally it's safer to use JSON.stringify than to try and quote it yourself :)
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
So I guess the issue is:
You want something more like:
Generally it's safer to use JSON.stringify than to try and quote it yourself :)