Compare the content of two PO files

Here is how to check out the differences between two PO files without caring about strings order, line breaks or comments.

diff -u <(msgfmt -o - translation/es/es.po | msgunfmt) \
        <(msgfmt -o - persistence-setup/po/es.po | msgunfmt)

The syntax is bash specific. Replace the paths to the two PO files you are interested in comparing.

Calculate statistics on the translations

Run the language statistics.sh script.

Build the wiki offline

To check your translations before you send them, you may want to browse the wiki offline. See the corresponding documentation.

Search for fuzzy strings with Vim

Ran inside Vim, the following command will search recursively for fuzzy inside .fr.po files

:vimgrep /fuzzy/ **/*.fr.po |:copen

To switch easily between the file list and the editor, using Alt + Arrow up/down, you can add those lines in .vimrc:

nmap <silent> <A-Up> :wincmd k<CR>
nmap <silent> <A-Down> :wincmd j<CR>

Check the validity of PO files

Use the tool i18nspector.

To copy, install and run it issue the following commands in the folder where you want to download it:

apt-get install i18nspector/unstable
i18nspector <PO file>

Run i18nspector on the whole wiki

cd wiki/src
contribute/l10n_tricks/check_po.sh

Rewrap files

To rewrap one .po file:

msgcat --width=80 -o your_output_file.po your_input_file.po

To rewrap several .po files:

for f in $(find . -type f -name .po) ; do msgcat --width=80 -o \
     "${f}.new" "$f" ; mv -f "${f}.new" "$f" ; done

To rewrap a .mdwn file:

fold -s -w 80 translate.mdwn > translate.mdwn.out

Quickly update several repositories

Tails is split in several git repositories: tails-greeter, whisperback, persistence-setup, etc.

If you cloned those differents repositories in the same folder, you can pull them all in a row with the following bash script:

#!/bin/sh
    for d in $(find . -type d -name ".git" | sed 's/\/.git\+$//' ); do
       echo "Current repository: $d";
       cd $d && git pull && cd - || exit 1
done

This will basically check in all subfolders if there is an existing .git folder, and run git pull if appropriate.