My fix to allow line breaks (\n) in the translation js files was to introduce a line of code on line 159 of i18n.js:
__: function () {
var msg = this.translate(this.locale, arguments[0]);
if (arguments.length > 1) {
msg = vsprintf(msg, Array.prototype.slice.call(arguments, 1));
}
msg = msg.replace(/\n/g, "<br />"); //allow line breaks
return msg;
},
that means that an input like this:
{
"Never miss out, you can watch a replay.": "永远不会错过,\n您可观看重播",
}
outputs like this in express.js:
in template file: <%- __("Never miss out, you can watch a replay.") %>
actual code printed on page: 永远不会错过,<br />您可观看重播
Is there a better way to do this? Or any plan to allow for output in future?
My fix to allow line breaks (\n) in the translation js files was to introduce a line of code on line 159 of i18n.js:
that means that an input like this:
outputs like this in express.js: in template file:
<%- __("Never miss out, you can watch a replay.") %>
actual code printed on page:永远不会错过,<br />您可观看重播
Is there a better way to do this? Or any plan to allow for
output in future?