aboutsummaryrefslogtreecommitdiff
path: root/po
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2020-02-07 15:32:21 +0200
committerLasse Collin <lasse.collin@tukaani.org>2020-03-11 12:05:57 +0200
commit4b1447809ffbc0d77c0ad456bd6b3afcf0b8623e (patch)
tree0f71d0cd5679dfc47b0d03d790335e9eb3e0caaa /po
parentUpdate THANKS (sync with the master branch). (diff)
downloadxz-4b1447809ffbc0d77c0ad456bd6b3afcf0b8623e.tar.xz
Build: Add support for translated man pages using po4a.
The dependency on po4a is optional. It's never required to install the translated man pages when xz is built from a release tarball. If po4a is missing when building from xz.git, the translated man pages won't be generated but otherwise the build will work normally. The translations are only updated automatically by autogen.sh and by "make mydist". This makes it easy to keep po4a as an optional dependency and ensures that I won't forget to put updated translations to a release tarball. The translated man pages aren't installed if --disable-nls is used. The installation of translated man pages abuses Automake internals by calling "install-man" with redefined dist_man_MANS and man_MANS. This makes the hairy script code slightly less hairy. If it breaks some day, this code needs to be fixed; don't blame Automake developers. Also, this adds more quotes to the existing shell script code in the Makefile.am "-hook"s.
Diffstat (limited to '')
-rw-r--r--po4a/.gitignore2
-rw-r--r--po4a/po4a.conf14
-rwxr-xr-xpo4a/update-po45
3 files changed, 61 insertions, 0 deletions
diff --git a/po4a/.gitignore b/po4a/.gitignore
new file mode 100644
index 00000000..5bcfa04b
--- /dev/null
+++ b/po4a/.gitignore
@@ -0,0 +1,2 @@
+/man
+/xz-man.pot
diff --git a/po4a/po4a.conf b/po4a/po4a.conf
new file mode 100644
index 00000000..41a90fc2
--- /dev/null
+++ b/po4a/po4a.conf
@@ -0,0 +1,14 @@
+# To add a new language, add it to po4a_langs and run "update-po"
+# to get a new .po file. After translating the .po file, run
+# "update-po" again to generate the translated man pages.
+
+[po4a_langs]
+[po4a_paths] xz-man.pot $lang:$lang.po
+
+[type: man] ../src/xz/xz.1 $lang:man/$lang/xz.1
+[type: man] ../src/xzdec/xzdec.1 $lang:man/$lang/xzdec.1
+[type: man] ../src/lzmainfo/lzmainfo.1 $lang:man/$lang/lzmainfo.1
+[type: man] ../src/scripts/xzdiff.1 $lang:man/$lang/xzdiff.1
+[type: man] ../src/scripts/xzgrep.1 $lang:man/$lang/xzgrep.1
+[type: man] ../src/scripts/xzless.1 $lang:man/$lang/xzless.1
+[type: man] ../src/scripts/xzmore.1 $lang:man/$lang/xzmore.1
diff --git a/po4a/update-po b/po4a/update-po
new file mode 100755
index 00000000..c07af928
--- /dev/null
+++ b/po4a/update-po
@@ -0,0 +1,45 @@
+#!/bin/sh
+#
+#############################################################################
+#
+# 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
+#
+# This file has been put into the public domain.
+# You can do whatever you want with this file.
+#
+#############################################################################
+
+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 "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="This file is put in the public domain." \
+ po4a.conf