Repository navigation
v0.2.1
Patch Changes
-
817dab4: Document the semver policy of the
Localetype: built-in locales can be added in any release.Localelists the built-in locales and gains values whenever a built-in locale is added, in any release, so code that requires everyLocalevalue (such asRecord<Locale, …>) is not covered by semver.- If you already use a locale through
messagesand it becomes built-in, your overrides still win; keys you did not override come from the built-in texts instead of English.
-
1f1d989: Add per-locale texts to custom templates.
defineTemplateacceptsmessages: the template's texts by locale.enis required and lists every text key; other locales may leave keys out, which fall back to English key by key. Plural forms are not supported in template texts.- In a template with
messages,tandt.htmltake the template's own keys under its name, such ast('invoice.subject', { number }), plus thecommonkeys, and reject any other key at compile time. A template withoutmessageskeepstfor every built-in key. - The
messagessetting ofcreateMaileroverrides the texts of registered custom templates under their names, with the same English fallback as the built-in texts.MessagesOverrides<typeof templates>andLocaleMessages<typeof templates>type such overrides outside thecreateMailercall. - A custom template with
messagesthat replaces a built-in template also replaces the built-in texts of that template in every locale. createMailerthrowsINVALID_CONFIGfor template texts that are not strings, a missingen, a key thatendoes not have, a locale that is neither built-in nor a key ofmessages, and a template withmessagesnamedcommonor containing a dot.- Types
TemplateMessagesandTemplateTexts.Template,TemplateRenderContext,Translate,MessagesOverridesandLocaleMessagestake optional type parameters, andTemplatePropsaccepts templates withmessages.