{"id":21970125,"url":"https://github.com/gwa/grunt-gettext-parser","last_synced_at":"2026-04-11T11:02:52.099Z","repository":{"id":35446443,"uuid":"39713129","full_name":"gwa/grunt-gettext-parser","owner":"gwa","description":"Extract gettext translation calls from Twig templates to a single PHP file for parsing. Support for i18n extension, Drupal 8 templates, and Wordpress Timber","archived":false,"fork":false,"pushed_at":"2018-03-19T16:52:36.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-24T11:23:27.039Z","etag":null,"topics":["drupal-8","grunt","grunt-plugins","i18n","timber","twig","wordpress"],"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/gwa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-26T04:12:46.000Z","updated_at":"2021-07-22T17:19:03.000Z","dependencies_parsed_at":"2022-08-31T08:21:37.963Z","dependency_job_id":null,"html_url":"https://github.com/gwa/grunt-gettext-parser","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/gwa/grunt-gettext-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwa%2Fgrunt-gettext-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwa%2Fgrunt-gettext-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwa%2Fgrunt-gettext-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwa%2Fgrunt-gettext-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gwa","download_url":"https://codeload.github.com/gwa/grunt-gettext-parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwa%2Fgrunt-gettext-parser/sbom","scorecard":{"id":450698,"data":{"date":"2025-08-11","repo":{"name":"github.com/gwa/grunt-gettext-parser","commit":"9817599793462672f92ada222eed4c42ea64bc08"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Code-Review","score":2,"reason":"Found 3/14 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE-MIT.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE-MIT.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 22 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T08:07:59.216Z","repository_id":35446443,"created_at":"2025-08-19T08:07:59.216Z","updated_at":"2025-08-19T08:07:59.216Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31677819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T08:18:19.405Z","status":"ssl_error","status_checked_at":"2026-04-11T08:17:08.892Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["drupal-8","grunt","grunt-plugins","i18n","timber","twig","wordpress"],"created_at":"2024-11-29T14:31:44.464Z","updated_at":"2026-04-11T11:02:52.063Z","avatar_url":"https://github.com/gwa.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grunt-gettext-parser\n\n[![Build Status](https://travis-ci.org/gwa/grunt-gettext-parser.svg?branch=master)](https://travis-ci.org/gwa/grunt-gettext-parser)\n\n\u003e Extract gettext calls from templates to a single PHP file that can then be used to create a `.po` file for translations.\n\nA grunt task that parses `gettext` calls from [twig](http://twig.sensiolabs.org/) ([i18n Extension](http://twig-extensions.readthedocs.io/en/latest/i18n.html), [Timber](http://upstatement.com/timber/) for Wordpress, or Drupal 8) files and creates a \"dummy\" PHP file with gettext calls.\n\nThe dummy file can then be parsed [using grunt-pot](https://www.npmjs.com/package/grunt-pot) to create a `.pot` or `.po` file.\n\n### i18n\n\nRunning the task in `i18n` mode on the following:\n\n```markup\n\u003c!-- twig template with i18n extension --\u003e\n\u003cspan\u003e{{ trans \"my text\" }}\u003c/span\u003e\n\u003cdiv\u003e\n{% trans %}\n    other text with a {{ variable }}\n{% endtrans %}\n\u003c/div\u003e\n```\n\nresults in:\n\n```php\n\u003c?php\ngettext('my text');\ngettext('other text with a %variable%');\n```\n\n### Wordpress\n\nRunning the task in `wordpress` mode for the `mydomain` text domain on the following:\n\n```markup\n\u003c!-- twig template for Timer --\u003e\n\u003cspan\u003e{{ __('my text', 'mydomain') }}\u003c/span\u003e\n\u003cspan\u003e{{ __('other text', 'otherdomain') }}\u003c/span\u003e\n```\n\nresults in:\n\n```php\n\u003c?php\ngettext('my text');\n```\n\n(Note that `otherdomain` translations are excluded.)\n\n### Drupal\n\nRunning the task in `drupal` mode on the following:\n\n```markup\n\u003c!-- Drupal 8 module twig template --\u003e\n\u003cspan\u003e{{ 'my text'|t }}\u003c/span\u003e\n```\n\nalso results in:\n\n```php\n\u003c?php\ngettext('my text');\n```\n\n[grunt-pot](https://www.npmjs.com/package/grunt-pot) can subsequently be used to create a `.pot` file and update any existing `.po` files.\n\n## Getting Started\nThis plugin requires Grunt `~0.4.5`\n\nIf you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:\n\n```shell\nnpm install grunt-gettext-parser --save-dev\n```\n\nOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\n\n```js\ngrunt.loadNpmTasks('grunt-gettext-parser');\n```\n\n## The \"gettext_parser\" task\n\n### Overview\n\nIn your project's Gruntfile, add a section named `gettext_parser` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n    gettext_parser: {\n        your_target: {\n            options: {\n                style: 'wordpress',\n                textdomain: 'mydomain',\n                // Changes the name of the rendered function. Defaults to `gettext`.\n                output_function: 'myFunction'\n            },\n            files: {\n                'path/to/output.php': ['views/**/*.twig']\n            }\n        },\n    },\n});\n```\n\n### Options\n\n#### style\n\n`wordpress` (default) `i18n`, or `drupal`.\n\n#### textdomain\n\nWordpress only: The textdomain to be parsed. gettext calls to other domains will be ignored. Set to `null` to parse all text domains.\n\n#### output_function\n\n`gettext` (default)\n\n#### add_textdomain\n\n`false` (default)\n\nWrite the textdomain to the php file. Helpful for use with checktextdomain libraries.\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgwa%2Fgrunt-gettext-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgwa%2Fgrunt-gettext-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgwa%2Fgrunt-gettext-parser/lists"}