parallel translations

This commit is contained in:
Seth Hillbrand 2023-01-01 15:12:41 -08:00
parent 83e2959f82
commit 1c2573d867
1 changed files with 20 additions and 15 deletions

View File

@ -59,6 +59,7 @@ CSVFILE=${PWD}/i18n_status.csv
POTDIRS=`cat $LOCALDIR/POTDIRS|grep -v '^#'|grep -v '^\s*$'` #Read file without comment and empty lines POTDIRS=`cat $LOCALDIR/POTDIRS|grep -v '^#'|grep -v '^\s*$'` #Read file without comment and empty lines
cd $SOURCEDIR cd $SOURCEDIR
NPROC=`nproc --ignore=1`
#Generate/update template pot file #Generate/update template pot file
find $POTDIRS -name '*.cpp' -or -name '*.h' -or -name '*.xml.in' -or -name '*.desktop.in' | find $POTDIRS -name '*.cpp' -or -name '*.h' -or -name '*.xml.in' -or -name '*.desktop.in' |
@ -89,21 +90,17 @@ fi
echo "Writing summary to ${CSVFILE}" echo "Writing summary to ${CSVFILE}"
echo "LANG;TRANSLATED;FUZZY;UNTRANSLATED" > "${CSVFILE}" echo "LANG;TRANSLATED;FUZZY;UNTRANSLATED" > "${CSVFILE}"
for i in $LINGUAS translate () {
do if [ "$1" = "en" ] ; then
echo "## $i" msgmerge --no-location --no-fuzzy-matching --force-po $LOCALDIR/pofiles/$1.po $LOCALDIR/pofiles/kicad.pot -o $LOCALDIR/pofiles/$1.po 2> /dev/null
if [ "$i" = "en" ] ; then msgen $LOCALDIR/pofiles/$1.po -o $LOCALDIR/pofiles/$1.po.tmp && mv $LOCALDIR/pofiles/$1.po.tmp $LOCALDIR/pofiles/$1.po
msgmerge --no-location --no-fuzzy-matching --force-po $LOCALDIR/pofiles/$i.po $LOCALDIR/pofiles/kicad.pot -o $LOCALDIR/pofiles/$i.po 2> /dev/null
msgen $LOCALDIR/pofiles/$i.po -o $LOCALDIR/pofiles/$i.po.tmp && mv $LOCALDIR/pofiles/$i.po.tmp $LOCALDIR/pofiles/$i.po
else else
msgmerge --force-po $LOCALDIR/pofiles/$i.po $LOCALDIR/pofiles/kicad.pot -o $LOCALDIR/pofiles/$i.po 2> /dev/null msgmerge --force-po $LOCALDIR/pofiles/$1.po $LOCALDIR/pofiles/kicad.pot -o $LOCALDIR/pofiles/$1.po 2> /dev/null
fi fi
msgfmt --statistics $LOCALDIR/pofiles/$i.po -o $LOCALDIR/pofiles/messages.mo 2>&1 >>/dev/null |
msgfmt --statistics $LOCALDIR/pofiles/$1.po -o $LOCALDIR/pofiles/$1_messages.mo 2>&1 >>/dev/null |
while IFS=",." read A B C D ; do while IFS=",." read A B C D ; do
echo $A echo -e "## $1\n$A\n$B\n$C\n$D"
echo $B
echo $C
echo $D
for STRING in "$A" "$B" "$C" "$D" ; do for STRING in "$A" "$B" "$C" "$D" ; do
STRING=${STRING# } STRING=${STRING# }
@ -120,15 +117,23 @@ do
"" ) "" )
;; ;;
* ) * )
echo >&2 "$0: Unknown format of \"msgfmt --statistics $LOCALDIR/$i/kicad.po \": \"$STRING\"" echo >&2 "$0: Unknown format of \"msgfmt --statistics $LOCALDIR/$1/kicad.po \": \"$STRING\""
exit 1 exit 1
;; ;;
esac esac
done done
echo "$i;${TRANSLATED};${FUZZY};${UNTRANSLATED}">>"${CSVFILE}" echo "$1;${TRANSLATED};${FUZZY};${UNTRANSLATED}">>"${CSVFILE}"
done done
rm $LOCALDIR/pofiles/messages.mo rm $LOCALDIR/pofiles/$1_messages.mo
}
for i in $LINGUAS
do
{
translate $i
} &
done done
wait
if [ "$PLOT" = "1" ]; then if [ "$PLOT" = "1" ]; then
cd $LOCALDIR cd $LOCALDIR