2011-03-13 06:05:19 +00:00
|
|
|
#!/bin/sh
|
2016-06-17 12:47:43 +00:00
|
|
|
|
2016-06-27 08:58:47 +00:00
|
|
|
# Let this be executed in the po/ subdir.
|
2018-11-12 18:12:48 +00:00
|
|
|
cd "$(dirname "$0")" || exit 1
|
2016-06-17 12:47:43 +00:00
|
|
|
|
|
|
|
echo "Updating translations via TP"
|
2018-11-12 18:12:48 +00:00
|
|
|
# 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
|
2016-06-17 12:47:43 +00:00
|
|
|
|
2021-08-27 10:37:26 +00:00
|
|
|
# This PO file is less than twenty percent translated:
|
|
|
|
rm -v nn.po
|
2021-08-24 08:15:34 +00:00
|
|
|
|
2016-06-17 12:47:43 +00:00
|
|
|
# Are there now PO files that are not in git yet?
|
|
|
|
NEWSTUFF=$(git status --porcelain *.po | grep "^??")
|
|
|
|
|
2016-04-18 03:39:07 +00:00
|
|
|
if [ -n "${NEWSTUFF}" ]; then
|
2016-06-17 12:47:43 +00:00
|
|
|
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
|
2011-03-13 06:05:19 +00:00
|
|
|
fi
|
2016-06-17 12:47:43 +00:00
|
|
|
|
2016-06-27 08:58:47 +00:00
|
|
|
echo "Regenerating POT file and remerging and recompiling PO files..."
|
|
|
|
make update-po
|
2016-10-15 13:06:18 +00:00
|
|
|
|
2019-04-14 08:42:22 +00:00
|
|
|
echo "Removing the dead weight of obsolete and fuzzy translations..."
|
2019-04-14 07:55:23 +00:00
|
|
|
for pofile in *.po; do
|
2019-04-14 08:42:22 +00:00
|
|
|
msgattrib --no-obsolete --no-fuzzy $pofile >trimmed.po || exit 4
|
2019-04-14 07:55:23 +00:00
|
|
|
mv trimmed.po $pofile || exit 4
|
|
|
|
done
|
2020-09-09 07:34:41 +00:00
|
|
|
echo
|
|
|
|
|
|
|
|
if grep "[[:cntrl:]]" ./*.po; then
|
|
|
|
echo "*** PO file contains control character"; exit 5;
|
|
|
|
fi
|
2016-10-15 13:08:14 +00:00
|
|
|
|
2016-10-15 13:06:18 +00:00
|
|
|
# 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
|