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.66k stars 339 forks source link

i18n pluralization string JSON format #401

Closed lanceschi closed 3 years ago

lanceschi commented 4 years ago

Hello,

I'd like to have some clarification on i18n pluralization. If I store string likewise:

{
  "%s dogLabel": {
    "one": "One dog",
    "other": "5 dogs"
  }
}

... and pluralize in a pug template with the following:

p= tn('%s dogLabel', 5)

I 'm getting 5 dogLabel, whereas I'd like to get 5 dogs.

Is there something wrong with my string JSON structure (taken more or less from here)?

Thanks for the awesome lib!

niftylettuce commented 4 years ago

I've never used the pluralization nested stuff before, so I'm really not sure. You could try writing a test in @ladjs/i18n at https://github.com/ladjs/i18n or something to get a better understanding if you wanted to push the ball on this one.

niftylettuce commented 4 years ago

PR welcome to fix or give an example usage

niftylettuce commented 3 years ago

PR welcome!