1
0
mirror of https://git.tukaani.org/xz.git synced 2025-02-17 14:08:12 +00:00
xz/po4a/update-po
Lasse Collin 2bc80e5f82 po4a/update-po: Disable wrapping in .pot and .po files
The .po files from the Translation Project come with unwrapped
strings so this matches it.

This may reduce the noise in diffs too. When the beginning of
a paragraph had changed, the rest of the lines got rewrapped
in msgsid. Now it's just one very long line that changes when
a paragraph has been edited.

The --add-location=file option was removed as redundant. The line
numbers don't exist in the .pot file due to --porefs file and thus
they cannot get copied to the .po files either.

(cherry picked from commit 4beba1cd62d7f8f7a6f1e899b68292d94c53b599)
2024-05-28 21:20:55 +03:00

65 lines
2.3 KiB
Bash
Executable File

#!/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).
#
# Make diffing the .pot and .po files easier:
#
# --porefs file Put only the input filenames, not line numbers,
# into the .pot file. This way they won't get
# copied to the .po files either.
#
# --wrap-po newlines Wrap msgids only at \n in the .pot file.
#
# --msgmerge-opt "--no-wrap"
# Wrap msgids and msgstrs only at \n in the .po files.
#
# The values from --package-name and --package-version are used to create
# the Project-Id-Version field. It likely makes sense that its value isn't
# identical to the value in the program message translations. In practice
# it seems that the .po files from many (but not all) translators will use
# "xz-man" no matter what is specified here and in xz-man.pot. Thus it's
# best to use "xz-man" here to get the most consistent results.
set -x
po4a --force --verbose \
--porefs file --wrap-po newlines --msgmerge-opt "--no-wrap" \
--package-name="xz-man" \
--package-version="$PACKAGE_VERSION" \
--copyright-holder="[See the headers in the input files.]" \
po4a.conf