]> Pileus Git - ~andy/gtk/blob - po/update.sh
Updated Ukrainian translation
[~andy/gtk] / po / update.sh
1 #!/bin/sh
2
3 VERSION="1.2.5"
4 PACKAGE="gtk20"
5
6 if [ "x$1" = "x--help" ]; then
7
8 echo Usage: ./update.sh langcode
9 echo --help                  display this help and exit
10 echo --missing               search for missing files in POTFILES.in
11 echo --version               shows the version
12 echo
13 echo Examples of use:
14 echo ./update.sh ----- just creates a new pot file from the source
15 echo ./update.sh da -- created new pot file and updated the da.po file 
16
17 elif [ "x$1" = "x--version" ]; then
18
19 echo "update.sh release $VERSION"
20
21 elif [ "x$1" = "x--missing" ]; then
22
23 echo "Searching for files containing _( ) but missing in POTFILES.in..."
24 echo
25 find ../ -print | egrep '.*\.(c|y|cc|c++|h|gob)' | xargs grep _\( | cut -d: -f1 | uniq | cut -d/ -f2- > POTFILES.in.missing
26 wait
27
28 echo "Sorting data..." 
29 sort -d POTFILES.in -o POTFILES.in &&
30 sort -d POTFILES.in.missing -o POTFILES.in.missing 
31 wait
32 echo "Comparing data..."
33 diff POTFILES.in POTFILES.in.missing -u0 | grep '^+' |grep -v '^+++'|grep -v '^@@' > POTFILES.in.missing
34 wait
35
36 if [ -s POTFILES.ignore ]; then
37
38 sort -d POTFILES.ignore -o POTFILES.tmp
39 echo "Evaluating ignored files..."
40 wait 
41 diff POTFILES.tmp POTFILES.in.missing -u0 | grep '^+' |grep -v '^+++'|grep -v '^@@' > POTFILES.in.missing 
42 rm POTFILES.tmp
43
44 fi
45
46 if [ -s POTFILES.in.missing ]; then
47
48 echo && echo "Here are the results:"
49 echo && cat POTFILES.in.missing
50 echo && echo "File POTFILES.in.missing is being placed in directory..."
51 echo "Please add the files that should be ignored in POTFILES.ignore"
52
53 else
54
55 echo &&echo "There are no missing files, thanks God!" 
56 rm POTFILES.in.missing
57
58 fi 
59
60 elif [ "x$1" = "x" ]; then 
61
62 echo "Building the $PACKAGE.pot ..."
63
64 xgettext --default-domain=$PACKAGE --directory=.. \
65   --add-comments --keyword=_ --keyword=N_ \
66   --files-from=./POTFILES.in \
67 && test ! -f $PACKAGE.po \
68    || ( rm -f ./$PACKAGE.pot \
69 && mv $PACKAGE.po ./$PACKAGE.pot );
70
71 else
72
73 if [ -s $1.po ]; then
74
75 xgettext --default-domain=$PACKAGE --directory=.. \
76   --add-comments --keyword=_ --keyword=N_ \
77   --files-from=./POTFILES.in \
78 && test ! -f $PACKAGE.po \
79    || ( rm -f ./PACKAGE.pot \
80 && mv $PACKAGE.po ./$PACKAGE.pot );
81
82 echo "Building the $PACKAGE.pot ..."
83 echo "Now merging $1.po with $PACKAGE.pot, and creating an updated $1.po ..." 
84
85 mv $1.po $1.po.old && msgmerge $1.po.old $PACKAGE.pot -o $1.po \
86 && rm $1.po.old;
87
88 msgfmt --statistics $1.po
89
90 else
91
92 echo Sorry $1.po does not exist!
93
94 fi;
95
96 fi;