{"id":15374758,"url":"https://github.com/mondeja/pre-commit-po-hooks","last_synced_at":"2025-04-15T12:31:36.639Z","repository":{"id":43656362,"uuid":"373299006","full_name":"mondeja/pre-commit-po-hooks","owner":"mondeja","description":"Hooks for pre-commit useful working with PO files","archived":false,"fork":false,"pushed_at":"2025-01-14T01:09:34.000Z","size":67,"stargazers_count":8,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T01:43:47.614Z","etag":null,"topics":["pofiles","pre-commit","pre-commit-hooks","translation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mondeja.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}},"created_at":"2021-06-02T20:47:53.000Z","updated_at":"2025-01-14T01:05:39.000Z","dependencies_parsed_at":"2024-01-03T01:11:23.744Z","dependency_job_id":null,"html_url":"https://github.com/mondeja/pre-commit-po-hooks","commit_stats":{"total_commits":49,"total_committers":4,"mean_commits":12.25,"dds":"0.22448979591836737","last_synced_commit":"2c9989ff933b17d496bcaca5a80c9f08ee6677db"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mondeja%2Fpre-commit-po-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mondeja%2Fpre-commit-po-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mondeja%2Fpre-commit-po-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mondeja%2Fpre-commit-po-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mondeja","download_url":"https://codeload.github.com/mondeja/pre-commit-po-hooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248679168,"owners_count":21144416,"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":["pofiles","pre-commit","pre-commit-hooks","translation"],"created_at":"2024-10-01T13:59:42.630Z","updated_at":"2025-04-15T12:31:36.385Z","avatar_url":"https://github.com/mondeja.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pre-commit-po-hooks\n\n[![PyPI][pypi-version-badge-link]][pypi-link]\n[![Python versions][pypi-pyversions-badge-link]][pypi-link]\n[![License][license-image]][license-link]\n[![Tests][tests-image]][tests-link]\n\nHooks for pre-commit useful working with PO files.\n\n## Example configuration\n\n```yaml\n- repo: https://github.com/mondeja/pre-commit-po-hooks\n  rev: v1.7.3\n  hooks:\n    - id: obsolete-messages\n    - id: untranslated-messages\n    - id: fuzzy-messages\n    - id: remove-django-translators\n    - id: standard-metadata\n    - id: max-lines\n      args: [\"10000\"]\n```\n\n## Hooks\n\n### **`obsolete-messages`**\n\nChecks for obsolete messages printing their line numbers if found.\n\n### **`untranslated-messages`**\n\nChecks for untranslated messages printing their line numbers if found.\n\n#### Parameters\n\n- `-m/--min`: Minimum number of messages that must be translated in each file\n to pass this check. Can be defined as a percentage of the messages translated\n appending a character `%` at the end of the value.\n\n### **`fuzzy-messages`**\n\nChecks for fuzzy messages printing their line numbers if found.\n\n### **`lreplace-extracted-comments`**\n\nReplaces a matching string at the beginning of extracted comments.\n\n#### Parameters\n\n- `-m/--match \"STRING\"`: Matching string to be replaced.\n- `-r/--replacement \"STRING\"`: Replacement for the match at the beginning of\n the extracted comment. If you want to remove the matching beginning you can\n pass an empty string `\"\"`.\n- `-d/--dry-run`: Don't do the replacements, only writes to stderr the locations\n of the extracted comments to be replaced.\n \n### **`remove-django-translators`**\n\nSame as [`lreplace-extracted-comments`][lreplace-extracted-comments-link]\npassing `--match \"Translators: \" --replacement \"\"`. Useful to remove the string\nprepended by Django extracting messages with xgettext (see more about this\nproblem in [django-rosetta#245][django-rosetta-lstrip]).\n\n### **`check-metadata`**\n\nCheck that metadata fields matches a set of regular expressions.\n\n#### Parameters\n\n- `-h/--header HEADER`: Header name to match in metadata. This argument can be\n passed multiple times, but after each `-h/--header` argument must be a\n `-v/--value` that indicates the regular expression for that header.\n- `-v/--value REGEX`: Can be passed multiple times. Indicates the regular\n expression that the last header passed in the argument `-h/--header` must\n match in the checked PO files.\n- `-n/--no-metadata`: When this option is passed, the hook instead checks that\n there is no metadata in the files, so it will exit with code 1 if some\n metadata is found in a file or 0 if there is no metadata in any files.\n- `-r/--remove/--remove-metadata`: When this option is passed the metadata will\n be removed from the files instead of being treated as a lint error.\n\n### **`standard-metadata`**\n\nCheck that the metadata of your PO files fits some standard requirements based\non the next regular expressions:\n\n- `Project-Id-Version`: `\\d+\\.\\d+\\.\\d`\n- `Report-Msgid-Bugs-To`: `.+\\s\u003c.+@.+\\..+\u003e`\n- `Last-Translator`: `.+\\s\u003c.+@.+\\..+\u003e`\n- `Language-Team`: `.+\\s\u003c.+@.+\\..+\u003e`\n- `Language`: `\\w\\w_?\\w?\\w?(@\\w+)?`\n- `Content-Type`: `text/plain; charset=[0-9a-zA-Z\\-]+`\n- `Content-Transfer-Encoding`: `\\d+bits?`\n\nIf you need to replace some fields with other regular expressions, you can do\nit passing the `-h` and `-v` arguments of the\n[`check-metadata` hook][check-metadata-link].\n\nFor example, if your version includes the character `v` at the beginning:\n`-h \"Project-Id-Version\" -v \"v\\d+\\.\\d+\\.\\d\"`\n\n### **`no-metadata`**\n\nIt will check if PO files has metadata. If has metadata, it will fail the check\nreturning exit code 1.\n\n#### Parameters\n\n- `-r/--remove/--remove-metadata`: When this option is passed the metadata will\n be removed from the files instead of being treated as a lint error.\n \n### **`remove-metadata`**\n\nRemove metadata headers from your PO files. This is an alias for\n[`no-metadata` hook][no-metadata-link] passing `--remove-metadata` argument.\n\n### **`max-messages`**\n\nDefine a maximum number of entries for each PO file. Pass an interger in the\nfirst argument:\n\n```yaml\n- id: max-messages\n  args:\n    - \"5000\"\n```\n\n#### Parameters\n\n- Maximum number of messages allowed for each PO file.\n\n### **`max-lines`**\n\nDefine a maximum number of lines for each PO file. Pass an interger in the\nfirst argument:\n\n```yaml\n- id: max-lines\n  args:\n    - \"10000\"\n```\n\n#### Parameters\n\n- Maximum number of lines allowed for each PO file.\n\n### **`min-translated`**\n\nDefine a minimum number of files that must be translated in order to pass.\nPass a float or a value ending with `%` character if you wan to compare\nagainst the percentage of translated files:\n\n```yaml\n- id: min-translated\n  args:\n    - \"95%\"\n```\n\n#### Parameters\n\n- Minimum number or percentage of messages which must be translated in each\n PO file.\n\n \n[pypi-link]: https://pypi.org/project/pre-commit-po-hooks\n[pypi-version-badge-link]: https://img.shields.io/pypi/v/pre-commit-po-hooks\n[pypi-pyversions-badge-link]: https://img.shields.io/pypi/pyversions/pre-commit-po-hooks\n[license-image]: https://img.shields.io/pypi/l/pre-commit-po-hooks?color=light-green\n[license-link]: https://github.com/mondeja/pre-commit-po-hooks/blob/master/LICENSE\n[tests-image]: https://img.shields.io/github/actions/workflow/status/mondeja/pre-commit-po-hooks/ci.yml?branch=master\u0026logo=github\u0026label=tests\n[tests-link]: https://github.com/mondeja/pre-commit-po-hooks/actions?query=workflow%CI\n\n[lreplace-extracted-comments-link]: https://github.com/mondeja/pre-commit-po-hooks#lreplace-extracted-comments\n[check-metadata-link]: https://github.com/mondeja/pre-commit-po-hooks#check-metadata\n[no-metadata-link]: https://github.com/mondeja/pre-commit-po-hooks#no-metadata\n[django-rosetta-lstrip]: https://github.com/mbi/django-rosetta/pull/245\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmondeja%2Fpre-commit-po-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmondeja%2Fpre-commit-po-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmondeja%2Fpre-commit-po-hooks/lists"}