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