93627819c24a5dd12e2ba8634fec228f7c9fb425
[claws.git] / po / poconv.sh
1 #!/bin/sh
2 for pofile in *.po; do
3     pocharset=`grep "Content-Type: text/plain; charset" $pofile | sed -e 's/\"Content-Type: text\/plain; charset=\\(.*\\)\\\n\"/\\1/'`
4     echo "$pofile:"
5     if test -z $pocharset; then
6         echo "missing charset!"
7     elif test "$pocharset" = "UTF-8"; then
8         echo "charset is already UTF-8. skipping..."
9     else
10         echo -n "converting $pocharset to UTF-8..."
11         iconv -f $pocharset -t UTF-8 $pofile > $pofile.utf8
12         echo "done!"
13         echo -n "Replace charset description to UTF-8..."
14         cp $pofile $pofile.bak
15         sed -e 's/Content-Type: text\/plain; charset=.*\\n/Content-Type: text\/plain; charset=UTF-8\\n/' < $pofile.utf8 > $pofile
16         echo "done!"
17         rm $pofile.utf8
18     fi
19     echo
20 done