{"id":37091638,"url":"https://github.com/ttag-org/babel-plugin-ttag","last_synced_at":"2026-01-14T11:09:17.240Z","repository":{"id":13342482,"uuid":"74213320","full_name":"ttag-org/babel-plugin-ttag","owner":"ttag-org","description":" :blue_book: ttag - library for extracting and resolving gettext translations extract es6 localization","archived":false,"fork":false,"pushed_at":"2025-03-19T06:35:33.000Z","size":1362,"stargazers_count":28,"open_issues_count":18,"forks_count":27,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-29T12:25:05.359Z","etag":null,"topics":["babel-plugin","gettext","i18n","javascript","language","localization","po-files","resolves-translations","template-literals","translation"],"latest_commit_sha":null,"homepage":"https://ttag.js.org","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/ttag-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2016-11-19T14:26:55.000Z","updated_at":"2025-03-19T06:46:38.000Z","dependencies_parsed_at":"2024-04-18T20:34:19.528Z","dependency_job_id":"c02ce2e2-6fd8-4c90-8d18-a9c015efc3ec","html_url":"https://github.com/ttag-org/babel-plugin-ttag","commit_stats":null,"previous_names":["c-3po-org/babel-plugin-c-3po","alexmost/babel-plugin-c-3po"],"tags_count":83,"template":false,"template_full_name":null,"purl":"pkg:github/ttag-org/babel-plugin-ttag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttag-org%2Fbabel-plugin-ttag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttag-org%2Fbabel-plugin-ttag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttag-org%2Fbabel-plugin-ttag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttag-org%2Fbabel-plugin-ttag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttag-org","download_url":"https://codeload.github.com/ttag-org/babel-plugin-ttag/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttag-org%2Fbabel-plugin-ttag/sbom","scorecard":{"id":11747,"data":{"date":"2025-08-04","repo":{"name":"github.com/ttag-org/babel-plugin-ttag","commit":"36ad415686fe1c5b651b17cabbcb316b97f9b995"},"scorecard":{"version":"v5.2.1-28-gc1d103a9","commit":"c1d103a9bb9f635ec7260bf9aa0699466fa4be0e"},"score":1.9,"checks":[{"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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#token-permissions"}},{"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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#maintained"}},{"name":"Code-Review","score":1,"reason":"Found 5/30 approved changesets -- score normalized to 1","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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#code-review"}},{"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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#packaging"}},{"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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#dangerous-workflow"}},{"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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#binary-artifacts"}},{"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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#cii-best-practices"}},{"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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#pinned-dependencies"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#license"}},{"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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#fuzzing"}},{"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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#branch-protection"}},{"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/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 9 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"22 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-14T14:45:02.836Z","repository_id":13342482,"created_at":"2025-08-14T14:45:02.836Z","updated_at":"2025-08-14T14:45:02.836Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28417956,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["babel-plugin","gettext","i18n","javascript","language","localization","po-files","resolves-translations","template-literals","translation"],"created_at":"2026-01-14T11:09:16.456Z","updated_at":"2026-01-14T11:09:17.232Z","avatar_url":"https://github.com/ttag-org.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct.svg)](https://stand-with-ukraine.pp.ua)\n\n\n# babel-plugin-ttag\n[![travis](https://api.travis-ci.org/ttag-org/babel-plugin-ttag.svg)](https://travis-ci.org/ttag-org)\n[![codecov](https://codecov.io/gh/ttag-org/babel-plugin-ttag/branch/master/graph/badge.svg)](https://codecov.io/gh/ttag-org/babel-plugin-ttag)\n\n[![NPM](https://nodei.co/npm/babel-plugin-ttag.png?downloads=true)](https://nodei.co/npm/babel-plugin-ttag/)\n\n\u003e :warning: This project [was previously named `babel-plugin-c-3po`](https://github.com/ttag-org/ttag/issues/105).\n\u003e Some of the talks, presentations, and documentation _may_ reference it with both names.\n\n## project description\nSolution for providing gettext like translations into your project. Uses es6 native template syntax.\n\n## documentation - [c-3po.js.org](http://c-3po.js.org)\n\nPlugin functions:\n- extracting translations from es6 tagged templates to .pot \n- resolving translations from .po files right into your sources at compile time.\n\nKey features:\nThe core features of this tool are:\n\n- Works with GNU gettext tool (.po files).\n- Use es6 tagged templates syntax for string formatting (no extra formatting rules, no sprintf e.t.c).\n- The most intelligent gettext functions extraction from javascript sources (babel plugin).\n- Resolves translations from .po files right into your code (no runtime extra work in browser).\n- Works with everything that works with babel (.jsx syntax for instance).\n- Fast feedback loop (alerts when some string is missing translation right at compile time)\n- Designed to work with universal apps (works on a backend and a frontend).\n\n## Tutorials\n* [Quick Start](https://c-3po.js.org/quick-start.html)\n* [Localization with webpack and ttag](https://c-3po.js.org/localization-with-webpack-and-c-3po.html)\n\nInstallation\n============\n\n`npm install --save-dev babel-plugin-ttag \u0026\u0026 npm install --save ttag`\n\n\ngettext example\n===============\nHere is how you code will look like while using this plugin:\n\n```javascript\nimport { t } from 'ttag';\nconst name = 'Mike';\nconsole.log(t`Hello ${name}`);\n```\nSo you can see that you can use native es6 template formatting. To make your string translatable, all you need to do is to place 't' tag.\n\nTranslator will see this inside .po files:\n```po\n#: src/page.js:8\nmsgid \"Hello ${ name }\"\nmsgstr \"\"\n```\nPlural example\n==============\nHere is how you can handle plural forms:\n\u003e This function has something similar with standart ngettext but behaves a little bit different. It assumes that you have only one form in your sources and other forms will be added in .po files. This is because different languages has different number of plural forms, and there are cases when your default language is not english, so it doesn't make sense to specify 2 plural forms at all.\n\n```javascript\nimport { ngettext, msgid } from 'ttag';\nconst name = 'Mike';\nconst n = 5;\nconsole.log(ngettext(msgid`Mike has ${n} banana`, `Mike has ${n} bananas`, n));\n```\n\nOutput in .po files:\n```po\n#: src/PluralDemo.js:18\nmsgid \"Mike has ${ n } banana\"\nmsgid_plural \"Mike has ${ n } bananas\"\nmsgstr[0] \"\"\nmsgstr[1] \"\"\n```\n\nUse case with jsx (react):\n==========================\nThere are no additional setup for making this plugin work inside jsx. (just add babel-plugin-react plugin to your .babelrc)\n\n```javascript\nimport React from 'react';\nimport { t, ngettext, msgid } from 'ttag';\n\nclass PluralDemo extends React.Component {\n    constructor(props) {\n        super(props);\n        this.state = { count: 0 };\n        this.countInc = this.countInc.bind(this);\n    }\n    countInc() {\n        this.setState({ count: this.state.count + 1 });\n    }\n    render() {\n        const n = this.state.count;\n        return (\n            \u003cdiv\u003e\n                \u003ch3\u003e{ t`Deadly boring counter demo (but with plurals)` }\u003c/h3\u003e\n                \u003cdiv\u003e{ ngettext(msgid`You have clicked ${n} time`, `You have clicked ${n} times`, n) }\u003c/div\u003e\n                \u003cbutton onClick={this.countInc}\u003e{ t`Click me` }\u003c/button\u003e\n            \u003c/div\u003e\n        )\n    }\n}\n\nexport default PluralDemo;\n```\n\nDisabling some code parts\n=========================\nIf for some reason you need to disable ttag plugin transformation for some code block\nyou can use special comment globally to disable the whole file or inside some code block (function):\n```javascript\n/* disable ttag */\n\n// or\nfunction test() {\n    /* disable ttag */\n}\n```\n\nContribution\n============\nFeel free to contribute, make sure to cover your contributions with tests.\nTest command:\n```\nmake test\n```\n\nLicense\n=======\n\n[MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttag-org%2Fbabel-plugin-ttag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttag-org%2Fbabel-plugin-ttag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttag-org%2Fbabel-plugin-ttag/lists"}