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

Improve i18n documentation example #350

Closed jbmikk closed 5 years ago

jbmikk commented 5 years ago

The example for i18n in the readme file is confusing:

p= t(`Hi ${name},`)

At first I thought I could use a string with a variable placeholder in my json locale file, but then I realized the example uses backticks and the name becomes part of the key.

Nobody is going to translate the same piece of text using different names. The name should not be part of the key, unless it's replaced by a placeholder name.

It is a confusing example and not what one would expect having used other tools.

A more realistic example would be:

p= `${t('Hi')} ${name},`
niftylettuce commented 5 years ago

Thanks @jbmikk. I've fixed this in the README per your suggestion.

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

Appreciate it!