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: lreplace-extracted-comments
args:
- -m
- 'Translators: '
- -r
- ''
- 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 the extracted comments. This can be used to remove the string "Translators: " introduced by Django (see more about this problem in django-rosetta#245).
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.
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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92a203e9f53ae83b0ade2fabb84fd9abc50ab571bfed68c81e1415ed8a99bd0f |
|
MD5 | 817bfc5002cd966c50fb8908713638e4 |
|
BLAKE2b-256 | 28e683cedbfa52155b09acbf886bfa4d238f9ca2fa408e51ec6f4f13d080eeb1 |
Close
Hashes for pre_commit_po_hooks-1.3.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f7c2054a256875d7059d3e53562b19d2ccdc9dea4bf06945908114514785287 |
|
MD5 | c5169d426ef6f12049176ac179a082e3 |
|
BLAKE2b-256 | ae755eeaaffcd69d597a07c560463761f17d0641e0a84f0d740f1ab445afd682 |