Update website PO files.
[tails-test.git] / wiki / src / contribute / l10n_tricks.mdwn
blob72d26d416c77b2e0f506066cfff018c71472e4d6
1 [[!toc]]
3 Compare the content of two PO files
4 ===================================
6 Here is how to check out the differences between two PO files without
7 caring about strings order, line breaks or comments.
9     diff -u <(msgfmt -o - translation/es/es.po | msgunfmt) \
10             <(msgfmt -o - persistence-setup/po/es.po | msgunfmt)
12 The syntax is bash specific. Replace the paths to the two PO files you
13 are interested in comparing.
15 Calculate statistics on the translations
16 ========================================
18 Run the [[language statistics.sh]] script.
20 Build the wiki offline
21 ======================
23 To check your translations before you send them, you may want to browse the
24 wiki offline. See the [[corresponding documentation|contribute/build/website]].
26 Search for fuzzy strings with Vim
27 =================================
29 Ran inside Vim, the following command will search recursively for *fuzzy*
30 inside *.fr.po* files
32     :vimgrep /fuzzy/ **/*.fr.po |:copen
34 To switch easily between the file list and the editor, using Alt + Arrow
35 up/down, you can add those lines in .vimrc:
37     nmap <silent> <A-Up> :wincmd k<CR>
38     nmap <silent> <A-Down> :wincmd j<CR>
40 Check the validity of PO files
41 ==============================
43 Use the tool [i18nspector](http://jwilk.net/software/i18nspector).
45 To copy, install and run it issue the following commands in the folder where
46 you want to download it:
48     apt-get install i18nspector/unstable
49     i18nspector <PO file>
51 Run i18nspector on the whole wiki
52 =================================
54     cd wiki/src
55     contribute/l10n_tricks/check_po.sh
57 Rewrap files
58 ============
60 To rewrap one .po file:
62     msgcat --width=80 -o your_output_file.po your_input_file.po
64 To rewrap several .po files:
66     for f in $(find . -type f -name .po) ; do msgcat --width=80 -o \
67          "${f}.new" "$f" ; mv -f "${f}.new" "$f" ; done
69 To rewrap a .mdwn file:
71     fold -s -w 80 translate.mdwn > translate.mdwn.out
73 Quickly update several repositories
74 ===================================
76 Tails is split in [[several git repositories|contribute/git]]: tails-greeter,
77 whisperback, persistence-setup, *etc*.
79 If you cloned those differents repositories in the same folder, you can pull them all
80 in a row with the following bash script:
82     #!/bin/sh
83         for d in $(find . -type d -name ".git" | sed 's/\/.git\+$//' ); do
84            echo "Current repository: $d";
85            cd $d && git pull && cd - || exit 1
86     done
88 This will basically check in all subfolders if there is an existing `.git` folder,
89 and run `git pull` if appropriate.