{"id":18062240,"url":"https://github.com/gflohr/locale-xgettext","last_synced_at":"2025-04-11T15:04:33.677Z","repository":{"id":56830447,"uuid":"73166930","full_name":"gflohr/Locale-XGettext","owner":"gflohr","description":"Universal xgettext frontend","archived":false,"fork":false,"pushed_at":"2023-03-15T09:25:21.000Z","size":312,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T11:11:23.591Z","etag":null,"topics":["gnu-gettext","i18n","l10n","locale-xgettext","perl","xgettext"],"latest_commit_sha":null,"homepage":"http://www.guido-flohr.net/extending-xgettext-with-locale-xgettext/","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gflohr.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","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":"2016-11-08T08:51:45.000Z","updated_at":"2023-07-01T16:21:47.000Z","dependencies_parsed_at":"2024-06-19T01:49:39.263Z","dependency_job_id":"ca6a963e-0042-4cbe-881e-f546373c29f8","html_url":"https://github.com/gflohr/Locale-XGettext","commit_stats":{"total_commits":199,"total_committers":3,"mean_commits":66.33333333333333,"dds":"0.025125628140703515","last_synced_commit":"a83c6337367377d1f26c71283ff2e7d1fae8f18f"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gflohr%2FLocale-XGettext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gflohr%2FLocale-XGettext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gflohr%2FLocale-XGettext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gflohr%2FLocale-XGettext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gflohr","download_url":"https://codeload.github.com/gflohr/Locale-XGettext/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248429062,"owners_count":21101780,"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":["gnu-gettext","i18n","l10n","locale-xgettext","perl","xgettext"],"created_at":"2024-10-31T05:06:23.121Z","updated_at":"2025-04-11T15:04:33.637Z","avatar_url":"https://github.com/gflohr.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Locale-XGettext\n\nExtract strings from arbitrary formats into PO files\n\n## Description\n\nWhen using \n[GNU gettext](https://www.gnu.org/software/gettext/)\nyou often find yourself extracting translatable\nstrings from more or less exotic file formats that cannot be handled\nby xgettext from the\n[GNU gettext](https://www.gnu.org/software/gettext/)\nsuite directly.  This package simplifies\nthe task of writing a string extractor in Perl, Python, Java, Ruby or\nother languages by providing a common base needed for such scripts.\n\n## Usage\n\nIncluded is a sample string extractor [xgettext-txt](bin/xgettext-txt) for plain text files.  It simply\nsplits the input into paragraphs, and turns each paragraph into an\nentry of a PO file.\n\n## Common Workflow\n\nThe idea of the package is that you just a write a parser plug-in for\n`Locale::XGettext` and use all the boilerplate code for generating the\nPO file and for processing script options from this library.  One such\nexample is a parser plug-in for strings in templates for the\nTemplate Toolkit version 2 included in the package \n[Template-Plugin-Gettext](https://github.com/gflohr/Template-Plugin-Gettext).\nthat contains a script `xgettext-tt2` which can only extract\nstrings from that particular template language.\n\nIf this is the only source of translatable strings you are mostly done.\nOften times you will, however, have to merge strings from all different\ninput formats into one single PO file.  Let's assume that your project\nis written in Perl and C and that it also contains Template Toolkit\ntemplates and plain text files that have to be translated.\n\n1. Use `xgettext-txt` from this package to extract strings from all\n   plain text files and write the output into `text.pot`.\n\n2. Use `xgettext-tt2` from \n   [Template-Plugin-Gettext](https://github.com/gflohr/Template-Plugin-Gettext)\n   to extract all strings\n   from your templates into another file `templates.pot`.\n\n3. Finally use `xgettext` from\n   [GNU gettext](https://www.gnu.org/software/gettext/)\n   for extracting strings from\n   all source files written in Perl and C, _and_ from the previously\n   created pot files `text.pot` and `templates.pot`.  This works\n   because `xgettext` natively understands `.po` resp. `.pot` files.\n \nBy the way, all xgettext flavors based on `Locale::XGettext`\nare also able to extract strings from `.po` or `.pot` files.  So you\ncan also make do completely without GNU gettext and use any `Locale::XGettext`\nextractor instead of GNU gettext for the last step.\n\n## Writing Extractors\n\nWriting an extractor is as easy as implementing one single method that\ntakes a filename argument and extract strings from that file.  See \nthe manual page\n[Locale::XGettext(3pm)](http://search.cpan.org/~guido/Locale-XGettext/lib/Locale/XGettext.pm)\nfor more information.  See [samples/README.md](samples/README.md)\nas a starting point for writing an extractor in Perl or many\nother languages.  The distribution currently contains fully functional\nexamples written in [C](samples/C/README.md), [Java](samples/Java/README.md), \n[Python](samples/Python/README.md), [Perl](samples/Perl/README.md),\nand [Ruby](samples/Ruby/README.md).\n\n## Differences To `xgettext` From GNU Gettext\n\nThere a couple of subtle differences in the handling of command-line\narguments between extractors based on `Locale::XGettext` and\nthe original `xgettext` program.  Report a bug if you think that\na particular difference is a bug and not an improvement.\n\nOne thing that `Locale::XGettext` does not support is the prefix\n\"pass-\" for flag definitions.  While it is possible for an\nextractor to implement the behavior of GNU gettext, this is not\ndirectly supported by `Locale::XGettext`.  Instead, that\nprefix is simply ignored, when specified on the command-line\nfor an option argument to \"--flag\" or as part of the set of \ndefault flags for a particular extractor.\n\nAdditionally, while `xgettext` from GNU gettext has a hard-coded,\nfixed set of supported formats, you can specify arbitrary formats\nwith \"--flag\" for extractors based on `Locale::XGettext`.\n\n## Installation\n\n### From CPAN\n\nYou can install the latest version of `Locale::XGettext` from\n[CPAN](http://search.cpan.org/) with:\n\n```\n$ cpan Locale::XGettext\n```\n\nIf the command `cpan` is not installed, try instead:\n\n```\n$ perl -MCPAN -e 'install Locale::XGettext'\n```\n\n### From Sources\n\nDownload the sources from \n[Locale-XGettext](https://github.com/gflohr/Locale-XGettext) and\n\n```\n$ tar cxf Locale-XGettext-VERSION.tar.gz\n$ cd Locale-XGettext-VERSION\n$ perl Makefile.PL\n$ make\n$ make test\n$ make install\n```\n\n### From Git\n\n```\n$ git clone https://github.com/gflohr/Locale-XGettext.git\n$ cd Locale-XGettext\n$ dzil build\n$ cd Locale-XGettext-VERSION\n```\n\nFrom here, follow the instructions for installation from sources.\n\nThe command `dzil` is part of [Dist::Zilla](http://search.cpan.org/~rjbs/Dist-Zilla/).\n\n## TODO\n\nThe module should ship with its own PO parser and writer.\n\n## Bugs\n\nPlease report bugs at \n[https://github.com/gflohr/Locale-XGettext/issues](https://github.com/gflohr/Locale-XGettext/issues)\n\n## Copyright\n\nCopyright (C) 2016-2017, Guido Flohr, \u003cguido.flohr@cantanea.com\u003e, \nall rights reserved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgflohr%2Flocale-xgettext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgflohr%2Flocale-xgettext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgflohr%2Flocale-xgettext/lists"}