{"id":15991828,"url":"https://github.com/sinedied/gettext-extract","last_synced_at":"2025-03-17T20:30:19.333Z","repository":{"id":26875956,"uuid":"111521667","full_name":"sinedied/gettext-extract","owner":"sinedied","description":":speech_balloon: CLI for extracting Gettext messages from JavaScript, TypeScript, JSX and HTML","archived":false,"fork":false,"pushed_at":"2022-04-08T23:46:09.000Z","size":163,"stargazers_count":4,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-11T00:16:35.687Z","etag":null,"topics":["cli","extract","gettext","html","i18n","jsx","l10n","messages","pot","translation","typescript"],"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/sinedied.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-21T08:37:48.000Z","updated_at":"2021-09-23T09:58:16.000Z","dependencies_parsed_at":"2022-08-07T12:01:12.318Z","dependency_job_id":null,"html_url":"https://github.com/sinedied/gettext-extract","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinedied%2Fgettext-extract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinedied%2Fgettext-extract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinedied%2Fgettext-extract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinedied%2Fgettext-extract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sinedied","download_url":"https://codeload.github.com/sinedied/gettext-extract/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243878483,"owners_count":20362433,"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":["cli","extract","gettext","html","i18n","jsx","l10n","messages","pot","translation","typescript"],"created_at":"2024-10-08T06:02:52.749Z","updated_at":"2025-03-17T20:30:19.058Z","avatar_url":"https://github.com/sinedied.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :speech_balloon: gettext-extract\n\n[![NPM version](https://img.shields.io/npm/v/gettext-extract.svg)](https://www.npmjs.com/package/gettext-extract)\n[![Build status](https://img.shields.io/travis/sinedied/gettext-extract/master.svg)](https://travis-ci.org/sinedied/gettext-extract)\n![Node version](https://img.shields.io/node/v/gettext-extract.svg)\n[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)\n[![License](https://img.shields.io/npm/l/gettext-extract.svg)](LICENSE)\n\n\u003e CLI for extracting Gettext messages from JavaScript, TypeScript, JSX and HTML\n\nThis CLI is essentially a convenience wrapper around\n[gettext-extractor](https://github.com/lukasgeiter/gettext-extractor), all the processing is done by this library.\n\n## Installation\n\n```sh\nnpm install gettext-extract\n```\n\n## Usage\n```\nUsage: gettext-extract [options]\n\nOptions:\n  -c, --config  Config file [default: .gettext.json]\n  -o, --output  Output file [default: template.pot]\n  -h, --help    Show this help\n```\n\n## Configuration\n\nConfiguration for message extraction can be provided using a `.gettext.json` file, a custom JSON file using the\n`--config` CLI option or by adding a `gettext` object in your `package.json`.\n\nHere is an example configuration (remove comments for valid JSON):\n```hson\n{\n  \"js\": {\n    \"parsers\": [\n      {\n        \"expression\": \"gettext\",\n        \"arguments\": {\n          \"text\": 0\n        }\n      },\n      {\n        \"expression\": \"ngettext\",\n        \"arguments\": {\n          \"text\": 0,\n          \"textPlural\": 1\n        }\n      },\n      {\n        \"expression\": \"pgettext\",\n        \"arguments\": {\n          \"context\": 0,\n          \"text\": 1\n        }\n      }\n    ],\n    \"glob\": {\n      // [node-glob pattern(https://github.com/isaacs/node-glob#glob-primer) to match your JS files\n      \"pattern\": \"src/**/*.ts\",\n      // Add any [node-glob options](https://github.com/isaacs/node-glob#options) here\n      \"options\": {\n        \"ignore\": \"src/**/*.spec.ts\"\n      }\n    }\n  },\n  \"html\": {\n    \"parsers\": [\n      {\n        // Extract message from content of the HTML element with the specified CSS selector\n        \"element\": \"[translate]\",\n        \"attributes\": {\n          \"textPlural\": \"translate-plural\",\n          \"context\": \"translate-context\"\n        }\n      },\n      {\n        // Extract message from attribute of the HTML element\n        \"attribute\": \"translate-text\",\n        \"attributes\": {\n          \"textPlural\": \"translate-plural\",\n          \"context\": \"translate-context\"\n        }\n      }\n    ],\n    \"glob\": {\n      \"pattern\": \"src/**/*.html\"\n    }\n  },\n  //\n  \"headers\": {\n    \"Language\": \"\"\n  },\n  \"output\": \"translations/template.pot\"\n}\n```\n\nAt least one valid parser (JS or HTML) with glob pattern must be present, everything else is optional.\n\nYou can fin additional information concerning the\n[JavaScript / TypeScript / JSX](https://github.com/lukasgeiter/gettext-extractor/wiki/JavaScript%2C-TypeScript%2C-JSX)\nor [HTML](https://github.com/lukasgeiter/gettext-extractor/wiki/HTML) parsers on the `gettext-extractor` wiki.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinedied%2Fgettext-extract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinedied%2Fgettext-extract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinedied%2Fgettext-extract/lists"}