{"id":19232642,"url":"https://github.com/makeomatic/ms-mailer-templates","last_synced_at":"2025-02-23T11:40:32.188Z","repository":{"id":2220569,"uuid":"45937997","full_name":"makeomatic/ms-mailer-templates","owner":"makeomatic","description":"Set of email templates for sending through ms-mailer or any other client","archived":false,"fork":false,"pushed_at":"2024-01-20T17:45:09.000Z","size":2253,"stargazers_count":0,"open_issues_count":23,"forks_count":6,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-02-05T12:39:47.322Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/makeomatic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-10T20:23:25.000Z","updated_at":"2021-11-03T12:43:28.000Z","dependencies_parsed_at":"2024-06-21T13:01:45.307Z","dependency_job_id":"12592d2e-b783-46e8-9af5-d3bfe74ec318","html_url":"https://github.com/makeomatic/ms-mailer-templates","commit_stats":{"total_commits":113,"total_committers":15,"mean_commits":7.533333333333333,"dds":0.6902654867256637,"last_synced_commit":"50ca1d5466e6291bf1a1956bffe91faaf253e12d"},"previous_names":[],"tags_count":85,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makeomatic%2Fms-mailer-templates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makeomatic%2Fms-mailer-templates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makeomatic%2Fms-mailer-templates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makeomatic%2Fms-mailer-templates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/makeomatic","download_url":"https://codeload.github.com/makeomatic/ms-mailer-templates/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240310872,"owners_count":19781341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T16:07:01.265Z","updated_at":"2025-02-23T11:40:32.154Z","avatar_url":"https://github.com/makeomatic.png","language":"HTML","readme":"# Templates for Mailer Microservice\n\n[![Build Status](https://semaphoreci.com/api/v1/makeomatic/ms-mailer-templates/branches/master/shields_badge.svg)](https://semaphoreci.com/makeomatic/ms-mailer-templates)\n\nUses foundation ink by zurb for creating basic responsive styles. By default includes the most simple\ntemplates for account activation and password reset.\n\n## Installation\n\n`npm i ms-mailer-templates -S`\n\n## Usage\n\n```js\nconst render = require('ms-mailer-templates');\n\nconst ctx = { link: 'http://localhost', qs: '?token=xxxxx', username: 'Indiana Johns' };\nrender('activate', ctx,  optionalHandlebarsOpts )\n  .then(template =\u003e {\n    // get rendered template\n  });\n```\n\nIt checks for incorrect context, missing template and so on\n\n## i18n\n\nThe package uses [`i18next`](https://i18next.com) library to provide translations.\n\n### Usage\n\nProvide `lng` option among other context options to specify destination language when rendering templates.\nThe following code will return html for `activate` email template translated into german.\n```js\nconst render = require('ms-mailer-templates');\n\nrender('activate', { lng: 'de' })\n  .then(translatedTemplate =\u003e {\n    ...\n  });\n```\n\n### Translation helper\n\nPackage exports a simple translation helper as a property of the default export.\n\n```js\nrender.translate(key, { lng, ...rest });\n```\n\nWhere `key` is the key of the string to be translated, `lng` - target language, `rest` - other translation context options\n\nUsage example:\n\n```js\nconst render = require('ms-mailer-templates');\n\n// returns translated string when translation is available \n// for 'de' language and 'custom' namespace\nconst txt = render.translate('custom:|Count {{count}}', { lng: 'de', count: 10 });\n```\n\n### Guides\n\nTo add i18n support for existing or new templates one must wrap strings to be translated into `t` handlebars helper.\n\n```handlebars\n\u003cdiv\u003e\n  {{t \"String to translate\"}}\n\u003c/div\u003e\n```\n\n### Namespaces\n\nDefault package's i18n namespace is `emails`. All strings fall into this namespace unless\nspecifically stated otherwise. When one has separate translation project they \ncan put their own strings into separate namespace. `:|` works as the namespace\nseparator.\n\n```handlebars\n\u003cspan\u003e{{t \"my-own-ns:|something to be translated\"}}\u003c/span\u003e\n```\n\nThen add your newly created namespace to the list of supported namespaces in `src/i18n.js` file:\n\n```js\nconst SUPPORTED_NAMESPACES = [\n  'emails',\n  'your-new-namespace',\n  ...\n]\n```\n\nThe package uses `en` locale as a reference and fallbacks to the key contents when no translation is provided.\n\n### Parsing\n\nAll strings wrapped with `t` helper will be parsed into `en` locale.\n\nCommand\n```shell\nyarn i18n:parse\n```\nwill parse all `src/templates/**/*.html` files and store all collected strings under\n`i18n-parsed` directory with structure as follows:\n\n```.\n...\n└──i18n-parsed\n   └──en\n      ├── emails.json\n      └── custom-namespace.json\n```\n\n### Translations\n\nAll translated resources must be provided as flat `json` files under `i18n` directory\nfollowing the `i18n/{{language}}{{namespace}}.json` filename template.\n\n```.\n...\n└──i18n\n   ├──en\n   │   ├── emails.json\n   │   └── custom-namespace.json\n   ├──de\n   │   ├── emails.json\n   │   └── custom-namespace.json\n   │   ...\n```\n\n## Existing templates\n\n### General\n\n  1. `password`\n  1. `reset`\n\n### Radio FX\n\n  1. `activate`\n  1. `invite`\n  1. `report-problem`\n  1. `request-invite`\n  1. `support-contact`\n\n### StreamLayer\n\n  1. `accept-invite`\n  1. `add-member-notify`\n  1. `feedback`\n  1. `registration-notify`\n  1. `password-reset`\n\n## Roadmap\n\n1. Add more templates\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakeomatic%2Fms-mailer-templates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmakeomatic%2Fms-mailer-templates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakeomatic%2Fms-mailer-templates/lists"}