blob: e1fd3bbcf3646825c0736fa075415e53c5e5f10f (
plain) (
blame)
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
|
#!/bin/sh
set -eu
LANGS=
while getopts 'l:' flag; do
case "$flag" in
l)
LANGS="$OPTARG"
;;
*)
exit 2
;;
esac
done
shift $((OPTIND - 1))
if [ -z "$LANGS" ]; then
echo "Missing LANG" >&2
exit 2
fi
end="\033[0m"
yellow="\033[0;33m"
manpage() {
from_f="$1"
for l in $LANGS; do
to_f="$(echo "$from_f" | sed "s/\.en\./.$l./")"
printf 'Generating %s...\n' "$to_f"
OUT="$(mktemp)"
po4a-updatepo -f man -m "$from_f" -p "doc/po/$l.po"
po4a-translate -f man -m "$from_f" -p "doc/po/$l.po" -l "$to_f" -k 0 -v 2>&1 | tee "$OUT" >&2
if ! grep -qF ' is 100% translated (' "$OUT"; then
printf "\n\t${yellow}WARNING${end}!\n Missing translations for %s\n\n" "$to_f" >&2
fi
done
}
for f in "$@"; do
case "$f" in
*.en.[1-9].in)
mkdir -p doc/po
manpage "$f"
;;
*)
echo "Unsupported file format: $f" >&2
exit 2
;;
esac
done
|