forwardemail / email-templates

Create, preview (browser/iOS Simulator), and send custom email templates for Node.js. Made for @forwardemail, @ladjs, @cabinjs, @spamscanner, and @breejs.
https://forwardemail.net/docs/send-emails-with-node-js-javascript
MIT License
3.67k stars 337 forks source link

Set locale for mail with i18n #259

Closed lludol closed 6 years ago

lludol commented 6 years ago

Hello,

Can you write on your README that we have to set the "locale" attribute in the "locals" Object to the current locale to use the right language ?

email.send({
  template: 'mars',
  message: {
    to: 'elon@spacex.com'
  },
  locals: {
    locale: 'fr', // THIS
    name: 'Elon'
  }
}).then(console.log).catch(console.error);

I had to read your code to find out how it works!

By the way, thank you for your work!

niftylettuce commented 6 years ago

thanks @lludol for bringing this to my attention, I've updated the README

does this look OK to you?

https://github.com/niftylettuce/email-templates#localization