1
votes

I have an app that I've been doing translations with using the old i18n __(' ') syntax in my jade files, but now I am moving my emailing functions outside of my express controllers.

Now doing them using jade.renderFile(), it's not recognizing __(' ') anymore. Is there a way to include i18n in calls to renderFile?

Jade/Pug I suppose.

Thank you!

1

1 Answers

1
votes

Sorry for late reply! But if you still care about this issue, try the following code:

app.post('/render', (req, res) => { var options.__ = res.__;//forward__function jade.renderFile('code.jade', options, function(err, html){ if (err) throw err; console.log(html);//completed html contain i18n value });