{"id":22092206,"url":"https://github.com/pirxpilot/connect-gettext","last_synced_at":"2025-03-23T23:45:33.032Z","repository":{"id":31767740,"uuid":"35334002","full_name":"pirxpilot/connect-gettext","owner":"pirxpilot","description":null,"archived":false,"fork":false,"pushed_at":"2024-01-31T11:52:40.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-02T17:37:29.937Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pirxpilot.png","metadata":{"files":{"readme":"Readme.md","changelog":"History.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-09T15:36:57.000Z","updated_at":"2022-06-04T05:56:30.000Z","dependencies_parsed_at":"2022-09-18T01:22:29.199Z","dependency_job_id":null,"html_url":"https://github.com/pirxpilot/connect-gettext","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirxpilot%2Fconnect-gettext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirxpilot%2Fconnect-gettext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirxpilot%2Fconnect-gettext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirxpilot%2Fconnect-gettext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pirxpilot","download_url":"https://codeload.github.com/pirxpilot/connect-gettext/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245186927,"owners_count":20574554,"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-12-01T03:08:45.690Z","updated_at":"2025-03-23T23:45:33.007Z","avatar_url":"https://github.com/pirxpilot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM version][npm-image]][npm-url]\n[![Build Status][build-image]][build-url]\n[![Dependency Status][deps-image]][deps-url]\n\n# connect-gettext\n\nLightweight implementation of gettext as connect middleware.\n\n## Install\n\n```sh\n$ npm install --save connect-gettext\n```\n\n## Usage\n\nUse with any middleware that sets `req.lang` - such as [detect-language] and/or [overwrite-language].\n\n```js\nvar app = require('express');\n\nvar locale = {\n  supportedLanguages: ['de', 'fr', 'pl', 'en-GB', 'en-US'],\n  defaultLanguage: 'en',\n  gettextAlias: '_'\n};\n\n// use any middleware that sets req.lang\n// `detect-language` is just an example\napp.use(require('detect-language')(locale));\n\n\napp.use(require('connect-gettext')(locale));\n\n```\n\nOnce the middleware is applied `res.locals.gettext` will have `gettext` implementation inserted\nand `res.render` will be able to use it when rendering pages.\n\n```jade\n p\n   | #{_(\"This is how you can use it\")}\n   span= _(\"with Jade\")\n```\n\n## License\n\nMIT © [Damian Krzeminski](https://pirxpilot.me)\n\n[detect-language]: https://npmjs.org/package/detect-language\n[overwrite-language]: https://npmjs.org/package/overwrite-language\n\n[npm-image]: https://img.shields.io/npm/v/connect-gettext\n[npm-url]: https://npmjs.org/package/connect-gettext\n\n[build-url]: https://github.com/pirxpilot/connect-gettext/actions/workflows/check.yaml\n[build-image]: https://img.shields.io/github/actions/workflow/status/pirxpilot/connect-gettext/check.yaml?branch=main\n\n[deps-image]: https://img.shields.io/librariesio/release/npm/connect-gettext\n[deps-url]: https://libraries.io/npm/connect-gettext\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpirxpilot%2Fconnect-gettext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpirxpilot%2Fconnect-gettext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpirxpilot%2Fconnect-gettext/lists"}