Add 0.22.1~rc1 announce.
[tails/vicves.git] / refresh-translations
blobc6e88720fe303ccfaadcd95462e119446301dd45
1 #! /bin/sh
3 set -e
4 set -u
6 PERL_PROGS="/usr/local/bin/gpgApplet /usr/local/bin/tails-security-check \
7 /usr/local/bin/tails-htp-notify-user /usr/local/bin/tails-start-i2p \
8 /usr/local/bin/tails-virt-notify-user"
9 PYTHON_PROGS="/etc/whisperback/config.py /usr/local/bin/shutdown_helper_applet \
10 /usr/local/bin/tails-about /usr/local/sbin/tails-additional-software"
11 SHELL_PROGS="/usr/local/bin/tails-update-frontend-wrapper \
12 /usr/local/sbin/unsafe-browser /usr/share/tails/truecrypt-wrapper.disabled"
14 LOCALE_BASEDIR=config/chroot_local-includes/usr/share/locale
16 ### External libraries
18 . config/chroot_local-includes/usr/local/lib/tails-shell-library/po.sh
20 ### Functions
22 prog_potfile () {
23 prog=$1
25 progpath="config/chroot_local-includes$prog"
26 domain=$(basename $prog)
27 echo "tmp/pot/${domain}.pot"
30 refresh_pot () {
31 prog=$1
32 proglang=$2
34 progpath="config/chroot_local-includes$prog"
35 pot=$(prog_potfile $prog)
37 mkdir -p "$(dirname $pot)"
39 if [ -e "${progpath}" ]; then
40 xgettext --language="${proglang}" --from-code=UTF-8 \
41 -o "${pot}" "${progpath}"
42 sed -i "s@^\"Content-Type: text/plain\; charset=CHARSET\\\n\"@\"Content-Type: text/plain\; charset=UTF-8\\\n\"@" "${pot}"
46 po_file () {
47 locale=$1
49 echo "po/${locale}.po"
52 mo_file () {
53 locale=$1
55 echo "${LOCALE_BASEDIR}/${locale}/LC_MESSAGES/tails.mo"
58 refresh_mo () {
59 for locale in "$@" ; do
60 po=$(po_file $locale)
61 mo=$(mo_file $locale)
62 mkdir -p $(dirname "$mo")
63 msgfmt -o "${mo}" "${po}"
64 done
67 no_left_out_files () {
68 (cd po && intltool-update --maintain)
69 [ ! -e po/missing ] || return 1
70 return 0
73 intltool_update_pot () {
75 cd po
76 intltool-update --pot --gettext-package=tails
80 intltool_merge () {
81 grep -E --no-filename '[^ #]*\.(desktop|directory)\.in$' po/POTFILES.in \
82 | while read infile ; do
83 intltool-merge --quiet --desktop-style --utf8 \
84 po "$infile" "${infile%.in}"
85 done
88 intltool_report () {
89 (cd po && intltool-update --report --gettext-package=tails)
92 ### Main
94 # Update POT files
95 mkdir -p tmp/pot
96 for prog in $PERL_PROGS ; do refresh_pot $prog Perl ; done
97 for prog in $PYTHON_PROGS ; do refresh_pot $prog Python ; done
98 for prog in $SHELL_PROGS ; do refresh_pot $prog Shell ; done
99 intltool_update_pot
101 # If left out files are detected, intltool-update --maintain writes
102 # them to po/missing.
103 no_left_out_files || exit 3
105 # Update PO files
106 intltool_update_po $(po_languages)
108 # Update files that are actually used at runtime
109 refresh_mo $(po_languages)
110 intltool_merge
112 # Report back
113 intltool_report