-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxtract-xlate-msgs.sh
executable file
·57 lines (47 loc) · 1.62 KB
/
xtract-xlate-msgs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
set -e
set -u
base_dir=$( dirname "$0" )
cd "${base_dir}" || exit 99
locale_dir="locale"
locale_domain="postfix_logsums"
pot_file="${locale_dir}/${locale_domain}.pot"
po_with="99"
my_address="${DEBEMAIL:-frank@brehm-online.com}"
pkg_version=$( head -n 1 debian/changelog | sed -e 's/^[^(]*(//' -e 's/).*//' )
echo "Package-Version: '${pkg_version}'"
pybabel extract postfix-logsums postfix_logsums \
-o "${pot_file}" \
-F etc/babel.ini \
--width=${po_with} \
--sort-by-file \
--msgid-bugs-address="${my_address}" \
--copyright-holder="Frank Brehm, Berlin" \
--project="${locale_domain}" \
--version="${pkg_version}"
sed -i -e "s/FIRST AUTHOR/Frank Brehm/g" -e "s/<EMAIL@ADDRESS>/<${my_address}>/g" "${pot_file}"
for ldir in "${locale_dir}"/* ; do
if [[ ! -d "${ldir}" ]] ; then
continue
fi
lang=$( basename "${ldir}" )
po_file="${locale_dir}/${lang}/LC_MESSAGES/${locale_domain}.po"
if [[ ! -f "${po_file}" ]] ; then
pybabel init --domain "${locale_domain}" \
--input-file "${pot_file}" \
--output-dir "${locale_dir}" \
--locale "${lang}" \
--width ${po_with}
else
pybabel update --domain "${locale_domain}" \
--input-file "${pot_file}" \
--output-dir "${locale_dir}" \
--locale "${lang}" \
--width ${po_with} \
--ignore-obsolete \
--update-header-comment
fi
# Updating project version
sed -i -e "s/^\(\"Project-Id-Version:[ ][ ]*[^ ][^ ]*[ ][ ]*\)[^ \\][^ \\]*/\1${pkg_version}/i" "${po_file}"
done
# vim: ts=4 list