{"id":15638033,"url":"https://github.com/lukasgeiter/gettext-extractor","last_synced_at":"2025-04-12T22:34:37.456Z","repository":{"id":55977129,"uuid":"85330579","full_name":"lukasgeiter/gettext-extractor","owner":"lukasgeiter","description":"A flexible and powerful Gettext message extractor with support for JavaScript, TypeScript, JSX and HTML.","archived":false,"fork":false,"pushed_at":"2023-07-15T11:42:59.000Z","size":341,"stargazers_count":98,"open_issues_count":22,"forks_count":21,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-29T11:19:05.878Z","etag":null,"topics":["extractor","gettext","i18n","l10n","po-files","translation","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/lukasgeiter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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":"2017-03-17T16:05:39.000Z","updated_at":"2024-08-16T17:11:02.000Z","dependencies_parsed_at":"2024-06-18T13:33:45.738Z","dependency_job_id":"301221f9-78e9-4b94-a76c-e833dbe86a08","html_url":"https://github.com/lukasgeiter/gettext-extractor","commit_stats":{"total_commits":100,"total_committers":10,"mean_commits":10.0,"dds":0.12,"last_synced_commit":"fab0d57df5b790a5931f3ea758d7d128405fb432"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasgeiter%2Fgettext-extractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasgeiter%2Fgettext-extractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasgeiter%2Fgettext-extractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasgeiter%2Fgettext-extractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukasgeiter","download_url":"https://codeload.github.com/lukasgeiter/gettext-extractor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248642308,"owners_count":21138350,"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":["extractor","gettext","i18n","l10n","po-files","translation","typescript"],"created_at":"2024-10-03T11:17:01.758Z","updated_at":"2025-04-12T22:34:37.416Z","avatar_url":"https://github.com/lukasgeiter.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gettext Extractor [![Tests Status][status-tests-badge]][status-tests-link]\n\n*A flexible and powerful Gettext message extractor with support for JavaScript, TypeScript, JSX and HTML*\n\nIt works by running your files through a parser and then uses the AST (Abstract Syntax Tree) to find and extract translatable strings from your source code. All extracted strings can then be saved as `.pot` file to act as template for translation files.\n\nUnlike many of the alternatives, this library is highly configurable and is designed to work with most existing setups.\n\nFor the full documentation check out the [Github Wiki][wiki].\n\n\u003c/br\u003e\n\n## Installation\n\n\u003e **Note:** This package requires Node.js version 6 or higher.\n\n#### Yarn\n\n```text\nyarn add gettext-extractor\n```\n\n#### NPM\n\n```text\nnpm install gettext-extractor\n```\n\n\u003c/br\u003e\n\n## Getting Started\n\nLet's start with a code example:\n\n```javascript\nconst { GettextExtractor, JsExtractors, HtmlExtractors } = require('gettext-extractor');\n\nlet extractor = new GettextExtractor();\n\nextractor\n    .createJsParser([\n        JsExtractors.callExpression('getText', {\n            arguments: {\n                text: 0,\n                context: 1\n            }\n        }),\n        JsExtractors.callExpression('getPlural', {\n            arguments: {\n                text: 1,\n                textPlural: 2,\n                context: 3\n            }\n        })\n    ])\n    .parseFilesGlob('./src/**/*.@(ts|js|tsx|jsx)');\n\nextractor\n    .createHtmlParser([\n        HtmlExtractors.elementContent('translate, [translate]')\n    ])\n    .parseFilesGlob('./src/**/*.html');\n\nextractor.savePotFile('./messages.pot');\n\nextractor.printStats();\n```\n\nA detailed explanation of this code example and much more can be found in the [Github Wiki][wiki-introduction].\n\n\u003cbr/\u003e\n\n## Contributing\n\nFrom reporting a bug to submitting a pull request: every contribution is appreciated and welcome.\nReport bugs, ask questions and request features using [Github issues][github-issues].\nIf you want to contribute to the code of this project, please read the [Contribution Guidelines][contributing].\n\n[status-tests-badge]: https://github.com/lukasgeiter/gettext-extractor/actions/workflows/tests.yml/badge.svg\n[status-tests-link]: https://github.com/lukasgeiter/gettext-extractor/actions/workflows/tests.yml\n[wiki]: https://github.com/lukasgeiter/gettext-extractor/wiki\n[wiki-introduction]: https://github.com/lukasgeiter/gettext-extractor/wiki/Introduction\n[github-issues]: https://github.com/lukasgeiter/gettext-extractor/issues\n[contributing]: CONTRIBUTING.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukasgeiter%2Fgettext-extractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukasgeiter%2Fgettext-extractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukasgeiter%2Fgettext-extractor/lists"}