1
1
nano/po/update_linguas.sh
Benno Schulenberg 3604ad2950 build: remove obsolete translations from the PO files after merging
These obsolete strings contribute nothing to the translations that the
users get to see.  They are somewhat useful only for translators.  But
as nano is registered at the Translation Project, translators fetch or
receive their PO file from there (or they keep their own archive), so
these obsolete strings are not getting lost.  But for nano, they just
burden the distribution tarball.
2019-04-14 09:55:23 +02:00

33 строки
1.1 KiB
Bash
Исполняемый файл

#!/bin/sh
# Let this be executed in the po/ subdir.
cd "$(dirname "$0")" || exit 1
echo "Updating translations via TP"
# First remove existing PO files, as wget will not overwrite them.
rm *.po
wget --recursive --level=1 --accept=po --no-directories --no-verbose \
https://translationproject.org/latest/nano/ || exit 2
# Are there now PO files that are not in git yet?
NEWSTUFF=$(git status --porcelain *.po | grep "^??")
if [ -n "${NEWSTUFF}" ]; then
echo "New languages found; updating LINGUAS"
echo "# List of available languages." >LINGUAS
echo $(printf '%s\n' *.po | LC_ALL=C sort | sed 's/\.po//g') >>LINGUAS
fi
echo "Regenerating POT file and remerging and recompiling PO files..."
make update-po
echo "Removing the dead weight of obsolete translations..."
for pofile in *.po; do
msgattrib --no-obsolete $pofile >trimmed.po || exit 4
mv trimmed.po $pofile || exit 4
done
# If needed, fix a problem in the Makefile template.
grep -q '^datarootdir' Makefile.in.in || \
sed -i 's/^\(datadir.*\)/datarootdir = @datarootdir@\n\1/' Makefile.in.in