aboutsummaryrefslogtreecommitdiff
path: root/po4a/update-po
blob: 244951ec12605a9000b093423cb7e1d519e987e7 (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
51
#!/bin/sh
# SPDX-License-Identifier: 0BSD

#############################################################################
#
# Updates xz-man.pot and the *.po files, and generates translated man pages.
# These are done using the program po4a. If po4a is missing, it is still
# possible to build the package without translated man pages.
#
#############################################################################
#
# Author: Lasse Collin
#
#############################################################################

if type po4a > /dev/null 2>&1; then
	:
else
	echo "po4a/update-po: The program 'po4a' was not found." >&2
	echo "po4a/update-po: Translated man pages were not generated." >&2
	exit 1
fi

if test ! -f po4a.conf; then
	cd `dirname "$0"` || exit 1
	if test ! -f po4a.conf; then
		echo "po4a/update-po: Error: Cannot find po4a.conf." >&2
		exit 1
	fi
fi

PACKAGE_VERSION=`cd .. && sh build-aux/version.sh` || exit 1

# Using --force to get up-to-date version numbers in the output files
# when nothing else has changed. This makes it slower but it's fine
# as long as this isn't run every time when "make" is run at the
# top level directory. (po4a isn't super-fast even without --force).
set -x
po4a --force --verbose \
	--package-name="XZ Utils" \
	--package-version="$PACKAGE_VERSION" \
	--copyright-holder="The XZ Utils authors and contributors" \
	po4a.conf

# Add the customized POT header which contains the SPDX license
# identifier and spells out the license name instead of saying
# "the same license as the XZ Utils package".
mv xz-man.pot xz-man.pot.tmp
cat ../po/xz.pot-header > xz-man.pot
sed '1,/^#$/d' xz-man.pot.tmp >> xz-man.pot
rm xz-man.pot.tmp