{"id":19397009,"url":"https://github.com/dexus/i18n-gettext","last_synced_at":"2026-06-19T07:32:20.390Z","repository":{"id":15897488,"uuid":"13857372","full_name":"Dexus/i18n-gettext","owner":"Dexus","description":"Express/connect module for Node i18n and l10n support","archived":false,"fork":false,"pushed_at":"2025-02-19T18:52:40.000Z","size":21,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T22:11:17.362Z","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/Dexus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2013-10-25T10:05:12.000Z","updated_at":"2023-03-05T01:17:16.000Z","dependencies_parsed_at":"2024-11-10T10:39:08.468Z","dependency_job_id":"835b6f4f-d488-4c62-832c-0f93cb871a14","html_url":"https://github.com/Dexus/i18n-gettext","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Dexus/i18n-gettext","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dexus%2Fi18n-gettext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dexus%2Fi18n-gettext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dexus%2Fi18n-gettext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dexus%2Fi18n-gettext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dexus","download_url":"https://codeload.github.com/Dexus/i18n-gettext/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dexus%2Fi18n-gettext/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34522035,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"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":[],"created_at":"2024-11-10T10:39:04.327Z","updated_at":"2026-06-19T07:32:20.373Z","avatar_url":"https://github.com/Dexus.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# i18n-abide\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/Dexus/i18n-gettext.svg)](https://greenkeeper.io/)\n\nThis module **abides by the user's language preferences** and makes it available\nthroughout the app.\n\nThis module **abides by the Mozilla L10n way of doing things**.\n\n**The module abides**.\n\n# Status\n\nUsed in production systems, such as the\n[Mozilla Persona](https://github.com/mozilla/browserid) service in 40+\nlanguages.\n\nAlso used on other websites including:\n* Mozilla Webmaker\n\n# Supported Localization Technologies\n\nThis module supports several localization backends:\n* Gettext PO files (default and documented below)\n* Plist files\n* Transflex key-value-JSON files\n\nThis module supports client side as well as server side localization.\n\n# Usage\n\n    npm install i18n-abide\n\nIn this README, we'll use express and EJS templates, but other\nintegrations are possible.\n\nIn your app where you setup express:\n\n    var i18n = require('i18n-abide');\n\n    app.use(i18n.abide({\n      supported_languages: ['en-US', 'de', 'es', 'db-LB', 'it-CH'],\n      default_lang: 'en-US',\n      debug_lang: 'it-CH',\n      translation_directory: 'i18n'\n    }));\n\nThis block sets up the middleware and views with gettext support.\nWe declare support for English, German, Spanish, and two debug locales\n(more on this later).\n\nIn your routes, you can use the gettext function in `.js` files.\n\n    exports.homepage = function(req, resp) {\n      resp.render('home', {title: req.gettext(\"Hey, careful, man, there's a beverage here!\")});\n    };\n\nIn your layout files, you can add\n\n    \u003c!DOCTYPE html\u003e\n    \u003chtml lang=\"\u003c%= lang %\u003e\" dir=\"\u003c%= lang_dir %\u003e\"\u003e\n      \u003chead\u003e\n        \u003cmeta charset=\"utf-8\"\u003e\n        ...\n\nIn your templates files, you can use the gettext function in `.ejs` files:\n\n    \u003cp\u003e\u003c%= gettext(\"This will not stand, ya know, this aggression will not stand, man.\") %\u003e\u003c/p\u003e\n\ni18n-abide also provides a `format` function for string interpolation.\n\nThis module provides both server side translations and client side translations.\nServer side works out of the box and is the most common use case.\n\nIf you also want to do client-side translations,\ni18n-abide provides `lib/gettext.js` and you can do the same in `.js` and\n`.ejs` files.\n\n## Setting Language via HTTP Header\n\nThe `i18n-abide` module uses the\n[`accept-language` HTTP header](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4)\nto determine which language to use.\n\nSee [API docs](./docs/API.md) for overriding this via URL or the API directly.\n\n## Translation files\n\nThe `i18n-abide` module currently supports three file formats.\n\n1) PO/POT files, which get transformed to JSON via provided command line tools.\n\n2) [PLIST](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man5/plist.5.html) (i.e., XML)\nfiles, which require no transformation prior to use.\n\n3) [Transflex](http://support.transifex.com/customer/portal/articles/1223004-key-value-json-files) [JSON](https://developer.mozilla.org/en/docs/JSON)\n(JavaScript Object Notation) a key-value JSON type,\nwhich require no transformation prior to use.\n\n### PO/POT files\n\nThis is the default and assumed for documentation in this README.\n\nPO files can be compiled to .json or Gettext binary `.mo` files.\n\nFor use on the client side,\nPO files are compiled to JavaScript for easy inclusion into your page or build\nscript.\n\nNOTE: The PO/POT files are also transformed into .JSON,\nbut do not follow the same layout as the Transflex JSON files.\n\nSee [GETTEXT.md](docs/GETTEXT.md) for more details.\n\n### Other file formats\n\nSee [API](docs/API.md) for configuration and details around using Plist or Transflex localization files.\n\n\n# Debugging and Testing\n\n`db-LB` is a special **debug** locale.\nTo trigger it, set your Browser or Operating System language to Italian\n(Switzerland) which is `it-CH`.\nThis fake locale `db-LB` will be triggered,\nit is David Bowie speak for the region of Labyrinth.\n\nOh, hell ya a \"The Dude\" / Bowie Mashup.\nThat just happened.\n\nNow,\nstart up your Node server and visit a page you've wrapped strings in Gettext...\n\n# Tutorial\n\nMozilla Hacks blog has a three part introduction.\n\n* [Localize Your Node.js Service](https://hacks.mozilla.org/2013/04/localize-your-node-js-service-part-1-of-3-a-node-js-holiday-season-part-9/)\n* [Localization community, tools \u0026 process](https://hacks.mozilla.org/2013/04/localization-community-tools-process-part-2-of-3-a-node-js-holiday-season-part-10/)\n* [Localization in Action](https://hacks.mozilla.org/2013/04/localization-in-action-part-3-of-3-a-node-js-holiday-season-part-11/)\n\n# Docs\n* See [USAGE](./docs/USAGE.md) for full details.\n* [API docs](./docs/API.md) has more advanced config options and APIs\n* [GETTEXT](./docs/GETTEXT.md) documents how to use PO/POT files\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdexus%2Fi18n-gettext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdexus%2Fi18n-gettext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdexus%2Fi18n-gettext/lists"}