Repository navigation
v0.2.4
Patch Changes
-
b762136: Add plural forms to the texts of custom templates.
- A text in a template's
messagesmay be plural forms instead of a string: one text perIntl.PluralRulescategory (zero,one,two,few,many,other), such asitems: { one: '{count} item', other: '{count} items' }.otheris required inen. t('<name>.<key>', { count })andt.htmlpick the form forcountthrough the plural rules of the email's locale;{count}is the number formatted for the locale. A category without a form usesother.countis required at compile time for texts with plural forms.- Other locales of the template and the mailer's
messagesgive plural forms for those keys category by category and may add categories the English texts leave out, such asfewandmany. Categories a locale leaves out fall back to English. createMailerthrowsINVALID_CONFIGfor plural forms withoutotherinen, an unknown plural category, and a locale text whose form differs fromen(a string whereenhas plural forms, or the other way round).TemplateTextsandTemplateMessagesaccept plural forms.TranslateandTemplateRenderContexttake an optional second type parameter with the keys of texts with plural forms.
- A text in a template's