update_linguas.sh (1271B)
1 #!/bin/sh 2 3 # Let this be executed in the po/ subdir. 4 cd "$(dirname "$0")" || exit 1 5 6 echo "Updating translations via TP" 7 # First remove existing PO files, as wget will not overwrite them. 8 rm *.po 9 wget --recursive --level=1 --accept=po --no-directories --no-verbose \ 10 https://translationproject.org/latest/nano/ || exit 2 11 12 # This PO file is less than twenty percent translated: 13 rm -v nn.po 14 15 # Are there now PO files that are not in git yet? 16 NEWSTUFF=$(git status --porcelain *.po | grep "^??") 17 18 if [ -n "${NEWSTUFF}" ]; then 19 echo "New languages found; updating LINGUAS" 20 echo "# List of available languages." >LINGUAS 21 echo $(printf '%s\n' *.po | LC_ALL=C sort | sed 's/\.po//g') >>LINGUAS 22 fi 23 24 echo "Regenerating POT file and remerging and recompiling PO files..." 25 make update-po 26 27 echo "Removing the dead weight of obsolete and fuzzy translations..." 28 for pofile in *.po; do 29 msgattrib --no-obsolete --no-fuzzy $pofile >trimmed.po || exit 4 30 mv trimmed.po $pofile || exit 4 31 done 32 echo 33 34 if grep "[[:cntrl:]]" ./*.po; then 35 echo "*** PO file contains control character"; exit 5; 36 fi 37 38 # If needed, fix a problem in the Makefile template. 39 grep -q '^datarootdir' Makefile.in.in || \ 40 sed -i 's/^\(datadir.*\)/datarootdir = @datarootdir@\n\1/' Makefile.in.in