summaryrefslogtreecommitdiff
path: root/tools/xgettext.sh
blob: 1504f421044262bfffd990e84b749122cf7e4cc6 (plain)
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
#! /bin/bash

me=$(basename "${BASH_SOURCE[0]}");

if [[ $# -lt 1 ]]; then
	echo "Usage: $me FILE..." >&2;
	exit 1;
fi

mkdir -p locale;
echo "Generating template..." >&2;
xgettext --from-code=UTF-8 \
		--keyword=S \
		--keyword=NS:1,2 \
		--keyword=N_ \
		--add-comments='Translators:' \
		--add-location=file \
		-o locale/template.pot \
		"$@" \
		|| exit;

find locale -name '*.po' -type f | while read -r file; do
	echo "Updating $file..." >&2;
	msgmerge --update "$file" locale/template.pot;
done

echo "DONE!" >&2;