{"id":20072215,"url":"https://github.com/beliven-it/fastify-polyglot","last_synced_at":"2025-08-31T14:03:54.579Z","repository":{"id":47809466,"uuid":"271570061","full_name":"beliven-it/fastify-polyglot","owner":"beliven-it","description":"A plugin to handle i18n","archived":false,"fork":false,"pushed_at":"2024-06-19T00:13:04.000Z","size":800,"stargazers_count":8,"open_issues_count":4,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-19T11:31:27.112Z","etag":null,"topics":["fastify","i18n","js","localization","node-polyglot","nodejs","polyglot"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/beliven-it.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,"zenodo":null}},"created_at":"2020-06-11T14:38:08.000Z","updated_at":"2023-09-22T08:40:34.000Z","dependencies_parsed_at":"2024-11-13T14:41:45.623Z","dependency_job_id":"e767ac58-af4f-4139-bd56-6973a878d53d","html_url":"https://github.com/beliven-it/fastify-polyglot","commit_stats":{"total_commits":26,"total_committers":5,"mean_commits":5.2,"dds":0.6923076923076923,"last_synced_commit":"70786a4c22bcf2ab2ed7bfe3d171349c081d99b6"},"previous_names":["heply/fastify-polyglot"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/beliven-it/fastify-polyglot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beliven-it%2Ffastify-polyglot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beliven-it%2Ffastify-polyglot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beliven-it%2Ffastify-polyglot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beliven-it%2Ffastify-polyglot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beliven-it","download_url":"https://codeload.github.com/beliven-it/fastify-polyglot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beliven-it%2Ffastify-polyglot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272988919,"owners_count":25026961,"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","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["fastify","i18n","js","localization","node-polyglot","nodejs","polyglot"],"created_at":"2024-11-13T14:38:56.435Z","updated_at":"2025-08-31T14:03:54.524Z","avatar_url":"https://github.com/beliven-it.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# fastify-polyglot\n\nA plugin to handle i18n using [node-polyglot](https://www.npmjs.com/package/node-polyglot)\n\n[![Node.js CI](https://github.com/beliven-it/fastify-polyglot/actions/workflows/node.js.yml/badge.svg)](https://github.com/beliven-it/fastify-polyglot/actions/workflows/node.js.yml)\n\n## Install\n\n```bash\n$ npm i --save fastify-polyglot\n```\n\n## Usage\n\n```js\nconst path = require('path')\n\nfastify.register(require('fastify-polyglot'), {\n  defaultLocale: 'it',\n  locales: {\n    it: require(path.join(__dirname, './locales/it'))\n  }\n})\n\nconsole.log(fastify.i18n.t('Hello!'))\n\n// 'Ciao!'\n```\n\nAlternatively, you can pass a path lo load locales from:\n\n```js\nconst path = require('path')\n\nfastify.register(require('fastify-polyglot'), {\n  defaultLocale: 'it',\n  localesPath: path.join(__dirname, './locales')\n})\n```\n\n## Options\n\n| Name               | Description                                                                             |\n|--------------------|-----------------------------------------------------------------------------------------|\n| `defaultLocale`    |  The default locale code to be used (`en` by default).                                  |\n| `localesPath`      |  The folder from where to load locale dictionaries (`./locales` by default).            |\n| `locales`          |  A map of locales, where keys are locale codes and values are translation dictionaries. |\n\n**NOTE:** if both `localesPath` and `locales` are passed, dictionaries will be merged together.\n\n## Test\n\n```bash\n$ npm test\n```\n\n## Acknowledgements\n\nThis project is kindly sponsored by:\n\n[![Beliven](https://assets.beliven.com/brand/logo_pos_color.svg)](https://www.beliven.com)\n\n## License\n\nLicensed under [MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeliven-it%2Ffastify-polyglot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeliven-it%2Ffastify-polyglot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeliven-it%2Ffastify-polyglot/lists"}