Package: pre-commit-po-hooks
pre-commit-po-hooksHooks for pre-commit useful working with PO files.Example configuration-repo:https://github.com/mondeja/pre-commit-po-hooksrev:v1.7.3hooks:-id:obsolete-messages-id:untranslated-messages-id:fuzzy-messages-id:remove-django-translators-id:standard-metadata-id:max-linesargs:["10000"]Hooksobsolete-messagesChecks for obsolete messages printing their line numbers if found.untranslated-messagesChecks for untranslated messages printing their line numbers if found.Parameters-m/--min: Minimum number of messages that must be translated in each file
to pass this check. Can be defined as a percentage of the messages translated
appending a character%at the end of the value.fuzzy-messagesChecks for fuzzy messages printing their line numbers if found.lreplace-extracted-commentsReplaces 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-translatorsSame aslreplace-extracted-commentspassing--match "Translators: " --replacement "". Useful to remove the string
prepended by Django extracting messages with xgettext (see more about this
problem indjango-rosetta#245).check-metadataCheck 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/--headerargument must be a-v/--valuethat 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/--headermust
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.-r/--remove/--remove-metadata: When this option is passed the metadata will
be removed from the files instead of being treated as a lint error.standard-metadataCheck that the metadata of your PO files fits some standard requirements based
on the next regular expressions:Project-Id-Version:\d+\.\d+\.\dReport-Msgid-Bugs-To:.+\s<.+@.+\..+>Last-Translator:.+\s<.+@.+\..+>Language-Team:.+\s<.+@.+\..+>Language:\w\w_?\w?\w?(@\w+)?Content-Type:text/plain; charset=[0-9a-zA-Z\-]+Content-Transfer-Encoding:\d+bits?If you need to replace some fields with other regular expressions, you can do
it passing the-hand-varguments of thecheck-metadatahook.For example, if your version includes the charactervat the beginning:-h "Project-Id-Version" -v "v\d+\.\d+\.\d"no-metadataIt will check if PO files has metadata. If has metadata, it will fail the check
returning exit code 1.Parameters-r/--remove/--remove-metadata: When this option is passed the metadata will
be removed from the files instead of being treated as a lint error.remove-metadataRemove metadata headers from your PO files. This is an alias forno-metadatahookpassing--remove-metadataargument.max-messagesDefine a maximum number of entries for each PO file. Pass an interger in the
first argument:-id:max-messagesargs:-"5000"ParametersMaximum number of messages allowed for each PO file.max-linesDefine a maximum number of lines for each PO file. Pass an interger in the
first argument:-id:max-linesargs:-"10000"ParametersMaximum number of lines allowed for each PO file.min-translatedDefine a minimum number of files that must be translated in order to pass.
Pass a float or a value ending with%character if you wan to compare
against the percentage of translated files:-id:min-translatedargs:-"95%"ParametersMinimum number or percentage of messages which must be translated in each
PO file.