1#!/bin/sh 2 3# Copyright (C) 1987-2015 by Jeffery P. Hansen 4# Copyright (C) 2015-2018 by Andrey V. Skvortsov 5# 6# This program is free software; you can redistribute it and/or modify 7# it under the terms of the GNU General Public License as published by 8# the Free Software Foundation; either version 2 of the License, or 9# (at your option) any later version. 10# 11# This program is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14# GNU General Public License for more details. 15# 16# You should have received a copy of the GNU General Public License along 17# with this program; if not, write to the Free Software Foundation, Inc., 18# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19# 20 21# This script allows to catch errors after converting from PO into messages 22# and it helps to see translators' errors 23# You need gettext installed 24 25# Author: Loginov Alexey (alexl@mageia.org) 26 27result_file="converting_test.diff" 28rm -f $result_file 29 30for lang in `ls -1|grep -v pot|grep -v tcl |grep -v sh|cut -d "/" --fields=1|grep -v en` 31do 32./messages2po.tcl -m en/messages -l $lang/messages -po $lang/"$lang"1.po -lang $lang 33msguniq "$lang/$lang"1.po -o "$lang/$lang"3.po 34msguniq "$lang/messages_$lang".po -o "$lang/$lang"2.po 35cat $lang/"$lang"3.po |sed '1,/#: / d' > $lang/"$lang"4.po 36cat $lang/"$lang"2.po |sed '1,/#: / d' > $lang/"$lang"5.po 37diff -u "$lang/$lang"4.po "$lang/$lang"5.po > $lang/1.diff 38sed -i "/$lang\/messages/d" $lang/1.diff 39sed -i '/en\/messages/d' $lang/1.diff 40sed -i '/@@/d' $lang/1.diff 41#sed -i '/---/d' $lang/1.diff 42cat $lang/1.diff|grep "^-" > $lang/2.diff 43#cat $lang/1.diff|grep "^+" >> $lang/2.diff 44sed -i "s|4.po|.po|g" $lang/2.diff 45sed -i "s|5.po|.po|g" $lang/2.diff 46cat $lang/2.diff >> $result_file 47# cleanup 48rm -f $lang/"$lang"1.po 49rm -f $lang/"$lang"2.po 50rm -f $lang/"$lang"3.po 51rm -f $lang/"$lang"4.po 52rm -f $lang/"$lang"5.po 53rm -f $lang/1.diff 54rm -f $lang/2.diff 55done 56 57echo 58echo "File $result_file was created." 59echo "If file is empty, then everything is OK." 60