{"id":13805737,"url":"https://github.com/gmarty/xgettext","last_synced_at":"2025-12-26T22:30:14.164Z","repository":{"id":3440411,"uuid":"4493033","full_name":"gmarty/xgettext","owner":"gmarty","description":"Extracts translatable strings from source. Identical to xgettext but for template languages.","archived":false,"fork":false,"pushed_at":"2025-02-18T05:31:46.000Z","size":905,"stargazers_count":78,"open_issues_count":5,"forks_count":35,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-18T08:41:32.102Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"aspnet/EntityFramework","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gmarty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2012-05-30T09:15:12.000Z","updated_at":"2025-03-20T14:48:18.000Z","dependencies_parsed_at":"2024-01-03T02:24:51.774Z","dependency_job_id":"7b3f6e4a-661c-4b73-8715-e864ac71a38b","html_url":"https://github.com/gmarty/xgettext","commit_stats":{"total_commits":262,"total_committers":15,"mean_commits":"17.466666666666665","dds":0.3435114503816794,"last_synced_commit":"a13d8b7d5853011eaf42bc1a1a9e96f02f1b3270"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmarty%2Fxgettext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmarty%2Fxgettext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmarty%2Fxgettext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmarty%2Fxgettext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gmarty","download_url":"https://codeload.github.com/gmarty/xgettext/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254030965,"owners_count":22002681,"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":[],"created_at":"2024-08-04T01:01:04.354Z","updated_at":"2025-12-26T22:30:14.134Z","avatar_url":"https://github.com/gmarty.png","language":"JavaScript","funding_links":[],"categories":["i18n"],"sub_categories":[],"readme":"# xgettext-template [![Node.js CI](https://github.com/gmarty/xgettext/actions/workflows/node.js.yml/badge.svg)](https://github.com/gmarty/xgettext/actions/workflows/node.js.yml)\nExtracts translatable strings from source. Identical to [xgettext(1)](http://www.gnu.org/software/gettext/manual/gettext.html#xgettext-Invocation) but for template languages.\n\n## Template language support\n* Handlebars (using [gettext-handlebars](https://github.com/smhg/gettext-handlebars))\n* Swig (using [gettext-swig](https://github.com/smhg/gettext-swig))\n* Volt (using [gettext-volt](https://github.com/perchlayer/gettext-volt))\n* EJS (using [gettext-ejs](https://github.com/pekala/gettext-ejs))\n\nReact's **JSX** and **Pug** are todos (PRs are much appreciated).\n\n## Installation\n``` bash\n$ npm install -g xgettext-template\n```\n\n## Usage\n``` bash\n$ xgettext-template [OPTION] [INPUTFILE]...\n```\n#### Options\n```\nInput file location:\n  -f, --files-from  get list of input files from FILE\n  -D, --directory   add DIRECTORY to list for input files search[default: [\".\"]]\n\nOutput file location:\n  -o, --output  write output to specified file          [default: \"messages.po\"]\n\nChoice of input file language:\n  -L, --language  recognise the specified language\n                  (Handlebars, Swig, Volt, EJS, Nunjucks)\n\nInput file interpretation:\n  --from-code  encoding of input files                        [default: \"ascii\"]\n\nOperation mode:\n  -j, --join-existing  join messages with existing file         [default: false]\n\nLanguage specific options:\n  -k, --keyword  look for WORD as an additional keyword\n\nOutput details:\n  --force-po     write PO file even if empty                    [default: false]\n  --no-location  do not write '#: filename:line' lines          [default: false]\n  -s, --sort-output  generate sorted output                     [default: false]\n\nInformative output:\n  -h, --help     display this help and exit                            [boolean]\n  -V, --version  output version information and exit                   [boolean]\n```\nMore information about each option can be found in the [xgettext manual](https://www.gnu.org/software/gettext/manual/html_node/xgettext-Invocation.html).\n\n#### In Poedit\nGo to *File* - *Preferences...* in Poedit and add a new parser in the *Parsers* tab:\n\n![Poedit parser configuration](http://gmarty.github.io/xgettext/Poedit.png)\n\nPlease note that in this Windows example you have to use `xgettext-template.cmd`. The `.cmd` extension should not be there on *nix platforms.\n\n## General workflow\nIn the following Handlebars example translatable content is passed to helpers (`_` and `ngettext`):\n``` html\n\u003cbutton\u003e{{_ \"Sign in\"}}\u003c/button\u003e\n\n\u003cp\u003e{{count}} {{ngettext \"country\" \"countries\" count}}\u003c/p\u003e\n```\n\nWith Handlebars, this requires helpers being registered:\n``` javascript\nHandlebars.registerHelper('_', function(msgid) {\n  return i18n.gettext(msgid);\n});\n\nHandlebars.registerHelper('ngettext', function(msgid, plural, count) {\n  return i18n.ngettext(msgid, plural, count);\n});\n```\nWhat this `i18n` object refers to is up to you. Some (client/server) options are:\n* [node-gettext](https://github.com/andris9/node-gettext)\n* [Jed](http://slexaxton.github.io/Jed/)\n\n**xgettext-template** parses the strings above out of your templates into gettext's PO files.\nThese PO files are then translated and compiled to binary MO files using applications like [Poedit](http://www.poedit.net).\nThe MO files are passed as input the i18n library (above).\n\n## Development\n\n* Clone repository and run `npm install`.\n* Have your editor run eslint or run `npm run lint` to lint.\n* Run `npm test` to run tests.\n\n## Note\n\nxgettext-template initial development was founded by Dijiwan.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmarty%2Fxgettext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgmarty%2Fxgettext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmarty%2Fxgettext/lists"}