[Tails-l10n] Please test pre-commit hook for po files

Nachricht löschen

Nachricht beantworten
Autor: u
Datum:  
To: The Tails public development discussion list, Tails localization discussion, tails-l10n-pt-br, transitails
CC: hefee
Betreff: [Tails-l10n] Please test pre-commit hook for po files
Hi!

in order to integrate our web translation platform with our
infrastructure, we are trying to create more rules for PO files, used
for the translation of our website. At some point, all PO files should
follow these rules and the easiest way to ensure this is to install a
pre-commit hook. We will also verify this upon push, so in the future
it'll be necessary to ensure already upon commit that things work the
way they should.

But before enforcing this policy, we'd like you to test a pre-commit
hook. The hook verifies that no PO file headers are missing and that
they are set to a specific team address, wraps the files to 79 chars per
line, checks for whitespace errors. This is necessary in order to avoid
merge conflicts on these headers, something which we've seen occur very
often but that we want to automate without humans having to intervene.

In order to make this happen please:

git fetch tails translation_platform_hooks (assuming tails.git is
called tails as a remote)
git submodule update --init
cd .git/hooks
ln -s ../../wiki/src/contribute/l10n_tricks/pre-commit .

Now, everytime you try to commit a PO file, check_po will run. We've
modified check_po to only check the files you're trying to commit, not
run on the entire repository.

We have not automatically cleaned the PO files, but we will do that at
some point, upon merging these changes into master. This means that if
your files are currently not wrapped at 79 chars, you'll have to do that
:) We've chosen this wrapping because that's Poedit's default setting
and we want to make sure all other tools wrap at the same width.

But: hefee has prepared a script available under
wiki/src/contribute/l10n_tricks/unify_po-headers.sh which can help to
clean the files before trying to commit them :)

It's also "easy" to rewrap your po files using
msgcat -w 79 $FILENAME -o "$FILENAME"

Please report back here if you encounter problems or have ideas for
improvement.

Corresponding tickets if you want to comment there:
- https://labs.riseup.net/code/issues/15605 Make check_po.sh optionally
accept a list of files
- https://labs.riseup.net/code/issues/15408 Consider forcing wrapping of
po files at 79 chars per line
- https://labs.riseup.net/code/issues/15362 Run check_po whenever we try
to commit a po file in all Git repositories

Cheers!
hefee & u.