{"_id":"@postalsys/gettext","_rev":"5-19fb37f335bdf551c4f262c11814ca4b","name":"@postalsys/gettext","dist-tags":{"latest":"4.1.1"},"versions":{"3.0.0":{"name":"@postalsys/gettext","version":"3.0.0","keywords":["i18n","l10n","internationalization","localization","translation","gettext"],"author":{"name":"Andris Reinman"},"_id":"@postalsys/gettext@3.0.0","maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"homepage":"http://github.com/postalsys/gettext","bugs":{"url":"https://github.com/postalsys/gettext/issues"},"dist":{"shasum":"6f52693735495db3ac90ec11acc42b713fc83e71","tarball":"https://registry.npmjs.org/@postalsys/gettext/-/gettext-3.0.0.tgz","fileCount":9,"integrity":"sha512-6Hm0Sp2INZovkeAdWqB8AN6loJsugmhiYbwEqW7Ya8e7+KaT22b00N8NbDgU9rFpyb3H/6JKGBvxLt4PrvPZYA==","signatures":[{"sig":"MEYCIQD9HjSKYMQySmxPwAIpPhJ3in0KQT7bD5o6cGr5aRaQBAIhALK99G1cD9hNocsCLMJJs2qju8Mdqtc+XoxG1xHS0tpJ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":92946},"main":"./lib/gettext.js","engine":{"node":">=10"},"gitHead":"65d9670f691c2eeca40dce129c95bcf8b613d344","scripts":{"docs":"jsdoc2md -f lib/gettext.js -t docs/README.template.md --partial docs/templates/*.hbs --param-list-format list > README.md","test":"grunt","update":"rm -rf node_modules package-lock.json && ncu -u && npm install"},"_npmUser":{"name":"andris","email":"andris@kreata.ee"},"licenses":[{"url":"http://github.com/postalsys/gettext/blob/master/LICENSE","type":"MIT"}],"repository":{"url":"git+ssh://git@github.com/postalsys/gettext.git","type":"git"},"_npmVersion":"10.2.4","description":"A JavaScript implementation of gettext, a localization framework","directories":{},"_nodeVersion":"20.11.1","dependencies":{"lodash.get":"4.4.2"},"_hasShrinkwrap":false,"devDependencies":{"chai":"4.2.0","grunt":"1.0.1","mocha":"7.1.1","sinon":"9.0.1","grunt-cli":"1.2.0","grunt-mocha-test":"0.12.7","jsdoc-to-markdown":"5.0.3","grunt-contrib-jshint":"1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gettext_3.0.0_1726735016275_0.37838879330253095","host":"s3://npm-registry-packages"}},"4.0.0":{"name":"@postalsys/gettext","version":"4.0.0","keywords":["i18n","l10n","internationalization","localization","translation","gettext"],"author":{"name":"Andris Reinman"},"_id":"@postalsys/gettext@4.0.0","maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"homepage":"http://github.com/postalsys/gettext","bugs":{"url":"https://github.com/postalsys/gettext/issues"},"dist":{"shasum":"ed1327592c8ba8425b6ecc91f8312601051ce3ee","tarball":"https://registry.npmjs.org/@postalsys/gettext/-/gettext-4.0.0.tgz","fileCount":9,"integrity":"sha512-NFNdzh3rHTbPvqFM4dUab/2+V8igr/XFeNJjmLuMWEzcTuSmTbOhHEVunHt+2uVSb6byIS1oIkxjfBiXVyWEAg==","signatures":[{"sig":"MEUCIQCtX+Lqrgis8ru+pYJboNDEW9nDWAXxk7AjyqEGVGUYmQIgT2eIZoARWExU8qIER+ehBqMNO7NjMKJsmoVT18ZcwBQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@postalsys%2fgettext@4.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":95900},"main":"./lib/gettext.js","engine":{"node":">=10"},"gitHead":"534584bfd5ba8aba3d21cd3b0445762cd99b416b","scripts":{"docs":"jsdoc2md -f lib/gettext.js -t docs/README.template.md --partial docs/templates/*.hbs --param-list-format list > README.md","test":"grunt","update":"rm -rf node_modules package-lock.json && ncu -u && npm install"},"_npmUser":{"name":"andris","email":"andris@kreata.ee"},"licenses":[{"url":"http://github.com/postalsys/gettext/blob/master/LICENSE","type":"MIT"}],"repository":{"url":"git+ssh://git@github.com/postalsys/gettext.git","type":"git"},"_npmVersion":"10.8.2","description":"A JavaScript implementation of gettext, a localization framework","directories":{},"_nodeVersion":"20.17.0","dependencies":{"lodash.get":"4.4.2"},"_hasShrinkwrap":false,"devDependencies":{"chai":"4.4.1","grunt":"1.6.1","mocha":"10.7.3","sinon":"19.0.2","eslint":"8.57.0","grunt-cli":"1.5.0","grunt-eslint":"24.3.0","grunt-mocha-test":"0.13.3","jsdoc-to-markdown":"9.0.1","grunt-contrib-jshint":"3.2.0","eslint-config-prettier":"9.1.0","eslint-config-nodemailer":"1.2.0"},"_npmOperationalInternal":{"tmp":"tmp/gettext_4.0.0_1726737308528_0.9334171474240165","host":"s3://npm-registry-packages"}},"4.0.1":{"name":"@postalsys/gettext","version":"4.0.1","keywords":["i18n","l10n","internationalization","localization","translation","gettext"],"author":{"name":"Andris Reinman"},"_id":"@postalsys/gettext@4.0.1","maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"homepage":"http://github.com/postalsys/gettext","bugs":{"url":"https://github.com/postalsys/gettext/issues"},"dist":{"shasum":"1594211f37627a7147af3ea415f377a0211358ee","tarball":"https://registry.npmjs.org/@postalsys/gettext/-/gettext-4.0.1.tgz","fileCount":9,"integrity":"sha512-QERj2sCJTZJN4scplV9BUpZObUsB/ZAF+/MD3OBxDkqTWEmK/C0HX1i15IRJ0YpYtl3hovc4mEN37HIGvb4pbw==","signatures":[{"sig":"MEUCIBfVadJW3c79YxJWtmbX2nB4VtzgvDisUKlc97gwbvxdAiEA3GRV16cnXxtFhD/VvBookNp9+tVCFzz1OV8n5lQHhC4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@postalsys%2fgettext@4.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":94623},"main":"./lib/gettext.js","engine":{"node":">=16"},"gitHead":"6a37fd7a0d342d3340f546335080342168a14920","scripts":{"docs":"jsdoc2md -f lib/gettext.js -t docs/README.template.md --partial docs/templates/*.hbs --param-list-format list > README.md","test":"grunt","update":"rm -rf node_modules package-lock.json && ncu -u && npm install"},"_npmUser":{"name":"andris","email":"andris@kreata.ee"},"licenses":[{"url":"http://github.com/postalsys/gettext/blob/master/LICENSE","type":"MIT"}],"repository":{"url":"git+ssh://git@github.com/postalsys/gettext.git","type":"git"},"_npmVersion":"10.8.2","description":"A JavaScript implementation of gettext, a localization framework","directories":{},"_nodeVersion":"20.17.0","dependencies":{"lodash.get":"4.4.2"},"_hasShrinkwrap":false,"devDependencies":{"chai":"4.4.1","grunt":"1.6.1","mocha":"10.7.3","sinon":"19.0.2","eslint":"8.57.0","grunt-cli":"1.5.0","grunt-eslint":"24.3.0","grunt-mocha-test":"0.13.3","jsdoc-to-markdown":"9.0.2","grunt-contrib-jshint":"3.2.0","eslint-config-prettier":"9.1.0","eslint-config-nodemailer":"1.2.0"},"_npmOperationalInternal":{"tmp":"tmp/gettext_4.0.1_1728973940074_0.027633152661095783","host":"s3://npm-registry-packages"}},"4.1.0":{"name":"@postalsys/gettext","version":"4.1.0","keywords":["i18n","l10n","internationalization","localization","translation","gettext"],"author":{"name":"Andris Reinman"},"_id":"@postalsys/gettext@4.1.0","maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"homepage":"http://github.com/postalsys/gettext","bugs":{"url":"https://github.com/postalsys/gettext/issues"},"dist":{"shasum":"d62b91f996f26fcf27412a67cef53a6e95153f09","tarball":"https://registry.npmjs.org/@postalsys/gettext/-/gettext-4.1.0.tgz","fileCount":9,"integrity":"sha512-DNUqMXvCW/wVKA/UaAYME2oXZbNfrz6ZjmfOy0xDwRtI6If1alUzc7s500TuvEW07UPJ5vJ7dGALvI08cXsG7Q==","signatures":[{"sig":"MEUCIF3w3zz2eqjG5EpXImetvM95DMZ0O7fEAJAeUvsTEq5WAiEArTJEer6JSpjGe9bYocY3O3pn/nW411rmfO+oB82L2J0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@postalsys%2fgettext@4.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":100984},"main":"./lib/gettext.js","engine":{"node":">=16"},"gitHead":"b773c3bc8bff7f7f2ec5705d34a211f72028daa0","scripts":{"docs":"jsdoc2md -f lib/gettext.js -t docs/README.template.md --partial docs/templates/*.hbs --param-list-format list > README.md","test":"grunt","update":"rm -rf node_modules package-lock.json && ncu -u && npm install"},"_npmUser":{"name":"andris","email":"andris@kreata.ee"},"licenses":[{"url":"http://github.com/postalsys/gettext/blob/master/LICENSE","type":"MIT"}],"repository":{"url":"git+ssh://git@github.com/postalsys/gettext.git","type":"git"},"_npmVersion":"10.8.2","description":"A JavaScript implementation of gettext, a localization framework","directories":{},"_nodeVersion":"20.19.2","dependencies":{"lodash.get":"4.4.2"},"_hasShrinkwrap":false,"devDependencies":{"chai":"4.4.1","grunt":"1.6.1","mocha":"11.6.0","sinon":"21.0.0","eslint":"8.57.0","grunt-cli":"1.5.0","grunt-eslint":"24.3.0","grunt-mocha-test":"0.13.3","jsdoc-to-markdown":"9.1.1","grunt-contrib-jshint":"3.2.0","eslint-config-prettier":"10.1.5","eslint-config-nodemailer":"1.2.0"},"_npmOperationalInternal":{"tmp":"tmp/gettext_4.1.0_1749812200666_0.7561225237747693","host":"s3://npm-registry-packages-npm-production"}},"4.1.1":{"name":"@postalsys/gettext","description":"A JavaScript implementation of gettext, a localization framework","version":"4.1.1","author":{"name":"Andris Reinman"},"maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"homepage":"http://github.com/postalsys/gettext","repository":{"type":"git","url":"git+ssh://git@github.com/postalsys/gettext.git"},"scripts":{"test":"grunt","docs":"jsdoc2md -f lib/gettext.js -t docs/README.template.md --partial docs/templates/*.hbs --param-list-format list > README.md","update":"rm -rf node_modules package-lock.json && ncu -u && npm install"},"main":"./lib/gettext.js","licenses":[{"type":"MIT","url":"http://github.com/postalsys/gettext/blob/master/LICENSE"}],"devDependencies":{"chai":"4.4.1","eslint":"8.57.0","eslint-config-nodemailer":"1.2.0","eslint-config-prettier":"10.1.8","grunt":"1.6.1","grunt-cli":"1.5.0","grunt-contrib-jshint":"3.2.0","grunt-eslint":"24.3.0","grunt-mocha-test":"0.13.3","jsdoc-to-markdown":"9.1.3","mocha":"11.7.5","sinon":"21.0.1"},"engine":{"node":">=16"},"keywords":["i18n","l10n","internationalization","localization","translation","gettext"],"gitHead":"f41df7517490048ba2832b78827652d11900f071","_id":"@postalsys/gettext@4.1.1","bugs":{"url":"https://github.com/postalsys/gettext/issues"},"_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-kOK8LVJ5imGo9cyR6td98OwSfMX/mtcoHiJ8Z3dCsEowkbbE6xmooVs9EYO4ZknQ7m9TkoGcMbUVY2UNH5XTqg==","shasum":"8d52829c886dfebeb9b0f278e338f778ce27b568","tarball":"https://registry.npmjs.org/@postalsys/gettext/-/gettext-4.1.1.tgz","fileCount":9,"unpackedSize":100891,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@postalsys%2fgettext@4.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDXqB83+UHJQAar0RkjP+FM5mYOl/X5eM6/AMhdOBsTIAiBaEvKaMosIJUwi8qUUU4zmr+VdFPHpr27tzMq4xyup5g=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:49ae0c5b-4e11-4040-9019-591d5cdc4575"}},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/gettext_4.1.1_1767639598553_0.6467769359157594"},"_hasShrinkwrap":false}},"time":{"created":"2024-09-19T08:36:56.181Z","modified":"2026-01-05T18:59:59.043Z","3.0.0":"2024-09-19T08:36:56.423Z","4.0.0":"2024-09-19T09:15:08.687Z","4.0.1":"2024-10-15T06:32:20.253Z","4.1.0":"2025-06-13T10:56:40.841Z","4.1.1":"2026-01-05T18:59:58.692Z"},"bugs":{"url":"https://github.com/postalsys/gettext/issues"},"author":{"name":"Andris Reinman"},"homepage":"http://github.com/postalsys/gettext","keywords":["i18n","l10n","internationalization","localization","translation","gettext"],"repository":{"type":"git","url":"git+ssh://git@github.com/postalsys/gettext.git"},"description":"A JavaScript implementation of gettext, a localization framework","maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"readme":"# @postalsys/gettext\n\n> **Note:** This is a fork of [alexanderwallin/node-gettext](https://github.com/alexanderwallin/node-gettext) with additional enhancements and maintenance updates.\n\n**`@postalsys/gettext`** is a JavaScript implementation of a substantial subset of [GNU gettext](https://www.gnu.org/software/gettext/), a powerful localization framework originally written in C. This library enables developers to internationalize their JavaScript applications by handling translations, plural forms, and contexts, closely mirroring the functionality of the original gettext.\n\nIf you're interested in parsing or compiling `.mo`/`.po` files for use with this library or elsewhere, consider using [gettext-parser](https://github.com/smhg/gettext-parser).\n\n## Table of Contents\n\n-   [Features](#features)\n    -   [Differences from GNU gettext](#differences-from-gnu-gettext)\n-   [Installation](#installation)\n-   [Usage](#usage)\n    -   [Basic Example](#basic-example)\n    -   [Error Events](#error-events)\n    -   [Recipes](#recipes)\n        -   [Loading Translations from .mo or .po Files](#loading-translations-from-mo-or-po-files)\n-   [API Reference](#api-reference)\n-   [Contributing](#contributing)\n-   [License](#license)\n-   [See Also](#see-also)\n\n## Features\n\n-   **Comprehensive Localization Support**: Handles domains, contexts, plurals, and more.\n-   **File Format Compatibility**: Supports `.json`, `.mo`, and `.po` files via [gettext-parser](https://github.com/smhg/gettext-parser).\n-   **Extensive Language Support**: Includes plural forms for 136 languages.\n-   **Dynamic Configuration**: Allows changing locale or domain at runtime.\n-   **Debugging Tools**: Provides detailed error messages when the `debug` option is enabled.\n-   **Event Emission**: Emits events for internal errors, such as missing translations.\n\n### Differences from GNU gettext\n\nWhile `@postalsys/gettext` aims to closely emulate GNU gettext, there are notable differences:\n\n1. **No Category Support**: Unlike GNU gettext, which supports categories like `LC_MESSAGES`, `LC_NUMERIC`, and `LC_MONETARY`, this library focuses solely on message localization, effectively always operating under the `LC_MESSAGES` category. For number formatting, currencies, dates, and other localization needs, consider using dedicated JavaScript libraries.\n2. **Manual Translation Loading**: GNU gettext automatically reads translation files from the filesystem based on locale and category settings. In contrast, `@postalsys/gettext` requires developers to manually load and provide translations, accommodating both server-side and client-side environments.\n\n## Installation\n\nInstall the package via npm:\n\n```sh\nnpm install @postalsys/gettext\n```\n\n## Usage\n\n### Basic Example\n\n```js\nconst Gettext = require('@postalsys/gettext');\nconst swedishTranslations = require('./translations/sv-SE.json');\n\nconst gt = new Gettext();\ngt.addTranslations('sv-SE', 'messages', swedishTranslations);\ngt.setLocale('sv-SE');\n\nconsole.log(gt.gettext('The world is a funny place'));\n// Output: \"Världen är en underlig plats\"\n```\n\n### Error Events\n\n`@postalsys/gettext` emits an `error` event when it encounters issues such as missing translations. You can handle these events as follows:\n\n```js\n// Set up your Gettext instance and add translations...\n\ngt.on('error', error => {\n    console.error('Translation error:', error.message);\n});\n\ngt.gettext('An unrecognized message');\n// Logs: 'Translation error: No translation found for msgid \"An unrecognized message\"'\n```\n\n### Recipes\n\n#### Loading Translations from .mo or .po Files\n\n`@postalsys/gettext` works seamlessly with translations parsed by [`gettext-parser`](https://github.com/smhg/gettext-parser). Here's how you can load translations from `.po` files:\n\n```js\nconst fs = require('fs');\nconst path = require('path');\nconst Gettext = require('@postalsys/gettext');\nconst { po } = require('gettext-parser');\n\n// Directory where your translations are stored\nconst translationsDir = 'path/to/locales';\nconst locales = ['en', 'fi-FI', 'sv-SE'];\nconst domain = 'messages';\n\nconst gt = new Gettext();\n\nlocales.forEach(locale => {\n    const filename = `${domain}.po`;\n    const translationsFilePath = path.join(translationsDir, locale, filename);\n    const translationsContent = fs.readFileSync(translationsFilePath);\n\n    const parsedTranslations = po.parse(translationsContent);\n    gt.addTranslations(locale, domain, parsedTranslations);\n});\n\ngt.setLocale('sv-SE');\nconsole.log(gt.gettext('Hello'));\n// Outputs the translated string in Swedish\n```\n\n## API Reference\n\n<a name=\"Gettext\"></a>\n\n## Gettext\n\n* [Gettext](#Gettext)\n    * [new Gettext([options])](#new_Gettext_new)\n    * [.on(eventName, callback)](#Gettext+on)\n    * [.off(eventName, callback)](#Gettext+off)\n    * [.addTranslations(locale, domain, translations)](#Gettext+addTranslations)\n    * [.setLocale(locale)](#Gettext+setLocale)\n    * [.setTextDomain(domain)](#Gettext+setTextDomain)\n    * [.gettext(msgid)](#Gettext+gettext) ⇒ <code>String</code>\n    * [.dgettext(domain, msgid)](#Gettext+dgettext) ⇒ <code>String</code>\n    * [.ngettext(msgid, msgidPlural, count)](#Gettext+ngettext) ⇒ <code>String</code>\n    * [.dngettext(domain, msgid, msgidPlural, count)](#Gettext+dngettext) ⇒ <code>String</code>\n    * [.pgettext(msgctxt, msgid)](#Gettext+pgettext) ⇒ <code>String</code>\n    * [.dpgettext(domain, msgctxt, msgid)](#Gettext+dpgettext) ⇒ <code>String</code>\n    * [.npgettext(msgctxt, msgid, msgidPlural, count)](#Gettext+npgettext) ⇒ <code>String</code>\n    * [.dnpgettext(domain, msgctxt, msgid, msgidPlural, count)](#Gettext+dnpgettext) ⇒ <code>String</code>\n\n<a name=\"new_Gettext_new\"></a>\n\n### new Gettext([options])\nCreates and returns a new Gettext instance.\n\n**Returns**: <code>Object</code> - A Gettext instance  \n**Params**\n\n- `[options]`: <code>Object</code> - A set of options\n    - `.sourceLocale`: <code>String</code> - The locale that the source code and its\n                                        texts are written in. Translations for\n                                        this locale is not necessary.\n    - `.debug`: <code>Boolean</code> - Whether to output debug info into the\n                                        console.\n\n<a name=\"Gettext+on\"></a>\n\n### gettext.on(eventName, callback)\nAdds an event listener.\n\n**Params**\n\n- `eventName`: <code>String</code> - An event name\n- `callback`: <code>function</code> - An event handler function\n\n<a name=\"Gettext+off\"></a>\n\n### gettext.off(eventName, callback)\nRemoves an event listener.\n\n**Params**\n\n- `eventName`: <code>String</code> - An event name\n- `callback`: <code>function</code> - A previously registered event handler function\n\n<a name=\"Gettext+addTranslations\"></a>\n\n### gettext.addTranslations(locale, domain, translations)\nStores a set of translations in the set of gettext\ncatalogs.\n\n**Params**\n\n- `locale`: <code>String</code> - A locale string\n- `domain`: <code>String</code> - A domain name\n- `translations`: <code>Object</code> - An object of gettext-parser JSON shape\n\n**Example**  \n```js\ngt.addTranslations('sv-SE', 'messages', translationsObject)\n```\n<a name=\"Gettext+setLocale\"></a>\n\n### gettext.setLocale(locale)\nSets the locale to get translated messages for.\n\n**Params**\n\n- `locale`: <code>String</code> - A locale\n\n**Example**  \n```js\ngt.setLocale('sv-SE')\n```\n<a name=\"Gettext+setTextDomain\"></a>\n\n### gettext.setTextDomain(domain)\nSets the default gettext domain.\n\n**Params**\n\n- `domain`: <code>String</code> - A gettext domain name\n\n**Example**  \n```js\ngt.setTextDomain('domainname')\n```\n<a name=\"Gettext+gettext\"></a>\n\n### gettext.gettext(msgid) ⇒ <code>String</code>\nTranslates a string using the default textdomain\n\n**Returns**: <code>String</code> - Translation or the original string if no translation was found  \n**Params**\n\n- `msgid`: <code>String</code> - String to be translated\n\n**Example**  \n```js\ngt.gettext('Some text')\n```\n<a name=\"Gettext+dgettext\"></a>\n\n### gettext.dgettext(domain, msgid) ⇒ <code>String</code>\nTranslates a string using a specific domain\n\n**Returns**: <code>String</code> - Translation or the original string if no translation was found  \n**Params**\n\n- `domain`: <code>String</code> - A gettext domain name\n- `msgid`: <code>String</code> - String to be translated\n\n**Example**  \n```js\ngt.dgettext('domainname', 'Some text')\n```\n<a name=\"Gettext+ngettext\"></a>\n\n### gettext.ngettext(msgid, msgidPlural, count) ⇒ <code>String</code>\nTranslates a plural string using the default textdomain\n\n**Returns**: <code>String</code> - Translation or the original string if no translation was found  \n**Params**\n\n- `msgid`: <code>String</code> - String to be translated when count is not plural\n- `msgidPlural`: <code>String</code> - String to be translated when count is plural\n- `count`: <code>Number</code> - Number count for the plural\n\n**Example**  \n```js\ngt.ngettext('One thing', 'Many things', numberOfThings)\n```\n<a name=\"Gettext+dngettext\"></a>\n\n### gettext.dngettext(domain, msgid, msgidPlural, count) ⇒ <code>String</code>\nTranslates a plural string using a specific textdomain\n\n**Returns**: <code>String</code> - Translation or the original string if no translation was found  \n**Params**\n\n- `domain`: <code>String</code> - A gettext domain name\n- `msgid`: <code>String</code> - String to be translated when count is not plural\n- `msgidPlural`: <code>String</code> - String to be translated when count is plural\n- `count`: <code>Number</code> - Number count for the plural\n\n**Example**  \n```js\ngt.dngettext('domainname', 'One thing', 'Many things', numberOfThings)\n```\n<a name=\"Gettext+pgettext\"></a>\n\n### gettext.pgettext(msgctxt, msgid) ⇒ <code>String</code>\nTranslates a string from a specific context using the default textdomain\n\n**Returns**: <code>String</code> - Translation or the original string if no translation was found  \n**Params**\n\n- `msgctxt`: <code>String</code> - Translation context\n- `msgid`: <code>String</code> - String to be translated\n\n**Example**  \n```js\ngt.pgettext('sports', 'Back')\n```\n<a name=\"Gettext+dpgettext\"></a>\n\n### gettext.dpgettext(domain, msgctxt, msgid) ⇒ <code>String</code>\nTranslates a string from a specific context using s specific textdomain\n\n**Returns**: <code>String</code> - Translation or the original string if no translation was found  \n**Params**\n\n- `domain`: <code>String</code> - A gettext domain name\n- `msgctxt`: <code>String</code> - Translation context\n- `msgid`: <code>String</code> - String to be translated\n\n**Example**  \n```js\ngt.dpgettext('domainname', 'sports', 'Back')\n```\n<a name=\"Gettext+npgettext\"></a>\n\n### gettext.npgettext(msgctxt, msgid, msgidPlural, count) ⇒ <code>String</code>\nTranslates a plural string from a specific context using the default textdomain\n\n**Returns**: <code>String</code> - Translation or the original string if no translation was found  \n**Params**\n\n- `msgctxt`: <code>String</code> - Translation context\n- `msgid`: <code>String</code> - String to be translated when count is not plural\n- `msgidPlural`: <code>String</code> - String to be translated when count is plural\n- `count`: <code>Number</code> - Number count for the plural\n\n**Example**  \n```js\ngt.npgettext('sports', 'Back', '%d backs', numberOfBacks)\n```\n<a name=\"Gettext+dnpgettext\"></a>\n\n### gettext.dnpgettext(domain, msgctxt, msgid, msgidPlural, count) ⇒ <code>String</code>\nTranslates a plural string from a specifi context using a specific textdomain\n\n**Returns**: <code>String</code> - Translation or the original string if no translation was found  \n**Params**\n\n- `domain`: <code>String</code> - A gettext domain name\n- `msgctxt`: <code>String</code> - Translation context\n- `msgid`: <code>String</code> - String to be translated\n- `msgidPlural`: <code>String</code> - If no translation was found, return this on count!=1\n- `count`: <code>Number</code> - Number count for the plural\n\n**Example**  \n```js\ngt.dnpgettext('domainname', 'sports', 'Back', '%d backs', numberOfBacks)\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## See Also\n\n-   [gettext-parser](https://github.com/smhg/gettext-parser) - Parse and compile gettext translations between `.po`/`.mo` files and JSON.\n-   [lioness](https://github.com/alexanderwallin/lioness) - Gettext library for React applications.\n-   [react-gettext-parser](https://github.com/lagetse/react-gettext-parser) - Extract translatable strings from React components.\n-   [narp](https://github.com/lagetse/narp) - CLI tool for synchronizing translations between your app and Transifex.\n","readmeFilename":"README.md"}