pre-commit hooks for PO files
Project description
pre-commit-po-hooks
Hooks for pre-commit useful working with PO files.
Example configuration
- repo: https://github.com/mondeja/pre-commit-po-hooks
rev: v1.0.0
hooks:
- id: obsolete-messages
- id: untranslated-messages
- id: remove-django-translators
- id: check-metadata
args:
- -h
- Project-Id-Version
- -v
- v\d+\.\d+\.\d+
Hooks
obsolete-messages
Checks for obsolete messages printing their line numbers if found.
untranslated-messages
Checks for untranslated messages printing their line numbers if found.
lreplace-extracted-comments
Replaces a matching string at the beginning of extracted comments.
Parameters
-m/--match "STRING"
: Matching string to be replaced.-r/--replacement "STRING"
: Replacement for the match at the beginning of the extracted comment. If you want to remove the matching beginning you can pass an empty string""
.-d/--dry-run
: Don't do the replacements, only writes to stderr the locations of the extracted comments to be replaced.
remove-django-translators
Same as lreplace-extracted-comments
passing --match "Translators: " --replacement ""
. Useful to remove the string
prepended by Django extracting messages with gettext (see more about this
problem in django-rosetta#245).
check-metadata
Check that metadata fields matches a set of regular expressions.
Parameters
-h/--header HEADER
: Header name to match in metadata. This argument can be passed multiple times, but after each-h/--header
argument must be a-v/--value
that indicates the regular expression for that header.-v/--value REGEX
: Can be passed multiple times. Indicates the regular expression that the last header passed in the argument-h/--header
must match in the checked PO files.-n/--no-metadata
: When this option is passed, the hook instead checks that there is no metadata in the files, so it will exit with code 1 if some metadata is found in a file or 0 if there is no metadata in any files.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for pre_commit_po_hooks-1.3.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3edede9e2212e97c389e9e2d4665614711e0dd8ee608cdc4964b3552489fa50 |
|
MD5 | d55344af001264c10bbeef01c81e29c5 |
|
BLAKE2b-256 | 112871f65501ae15108347ee278fecff3a624f9d9f9d599650534f1bd8588adb |
Close
Hashes for pre_commit_po_hooks-1.3.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc5d23d1b71bc5f06e3d5e20485901cc8dfc26cf3bc784c6a2588aae4492e17f |
|
MD5 | 54a483da5d59dc5c96be09593a108f08 |
|
BLAKE2b-256 | 9794a6fba5ad65f471cbd1e8bf4869e8bcf45849eb0e1ba84010dbda56c149ad |