@@ -51,7 +51,7 @@ Replaces a matching string at the beginning of extracted comments.
5151
5252Same as [`lreplace-extracted-comments`][lreplace-extracted-comments-link]
5353passing `--match "Translators : " --replacement " " `. Useful to remove the string
54- prepended by Django extracting messages with gettext (see more about this
54+ prepended by Django extracting messages with xgettext (see more about this
5555problem in [django-rosetta#245][django-rosetta-lstrip]).
5656
5757### **`check-metadata`**
@@ -69,6 +69,28 @@ Check that metadata fields matches a set of regular expressions.
6969- `-n/--no-metadata`: When this option is passed, the hook instead checks that
7070 there is no metadata in the files, so it will exit with code 1 if some
7171 metadata is found in a file or 0 if there is no metadata in any files.
72+
73+ ### **`standard-metadata`**
74+
75+ Check that the metadata of your PO files fits some standard requirements based
76+ on the next regular expressions:
77+
78+ - `Project-Id-Version`: `\d +\.\d +\.\d `
79+ - `Report-Msgid-Bugs-To`: `.+\s <.+@.+\. .+>`
80+ - `Last-Translator`: `.+\s <.+@.+\. .+>`
81+ - `Language-Team`: `.+\s <.+@.+\. .+>`
82+ - `Language`: `\w\w _?\w ?\w ?(@\w +)?`
83+ - `Content-Type`: `text/plain; charset=[a-zA-Z\- ]+`
84+ - `Content-Transfer-Encoding`: `\d +bits?`
85+
86+ If you need to replace some fields with other regular expressions, you can do
87+ it passing the `-h` and `-v` arguments of the
88+ [`check-metadata` hook][check-metadata-link].
89+
90+ For example, if your version
91+ includes the character `v` at the beginning:
92+ `-h " Project-Id-Version" -v "v\d+\.\d+\.\d"`
93+
7294
7395[pypi-link] : https://pypi.org/project/pre-commit-po-hooks
7496[pypi-version-badge-link] : https://img.shields.io/pypi/v/pre-commit-po-hooks
@@ -79,4 +101,5 @@ Check that metadata fields matches a set of regular expressions.
79101[tests-link] : https://github.com/mondeja/pre-commit-po-hooks/actions?query=workflow%CI
80102
81103[lreplace-extracted-comments-link] : https://github.com/mondeja/pre-commit-po-hooks#lreplace-extracted-comments
104+ [check-metadata-link] : https://github.com/mondeja/pre-commit-po-hooks#check-metadata
82105[django-rosetta-lstrip] : https://github.com/mbi/django-rosetta/pull/245
0 commit comments