Code

Use subdirectories with icon sizes.
[inkscape.git] / po / update_po_files.sh
1 #!/bin/bash
2 # Updates PO files from the current POT file
3 # Please run this program from the po/ directory
4 # Existing po.old files will be overwritten
6 type -p intltool-update >/dev/null 2>/dev/null
7 if [ "$?" -eq "0" ]; then
8   intltool-update --pot >/dev/null 2>&1
9   POT_FILENAME="`ls -1rt *.pot 2>/dev/null|tail -1 2>/dev/null`"
10   if [ ! -r "$POT_FILENAME" ]; then
11     echo "Could not create POT file. Exiting."
12     exit
13   fi
14 else
15   echo "Could not create POT file (intltool-update not found). Exiting."
16   exit
17 fi
19 PO_FILE_COUNT=0
21 find . -noleaf -type f -name "*.po"|sort|\
22 (
23 while read FILENAME; do
24   PO_FILE_COUNT=`expr $PO_FILE_COUNT + 1`
25   mv -f "$FILENAME" "$FILENAME".old     # do not ask questions, because the answers would come from the pipe
26   if [ "$?" -eq "0" ]; then
27     echo "$FILENAME"
28     msgmerge "$FILENAME".old "$POT_FILENAME" > "$FILENAME"
29     if [ "$?" -ne "0" ]; then
30       echo "Could not merge \"$FILENAME.old\"."
31     fi
32   else
33     echo "Could not rename \"$FILENAME\". File skipped."
34   fi
35 done
37 echo; echo "Total number of PO files: $PO_FILE_COUNT"
38 )
40 echo