Applied MC indentation policy.
[kaloumi3.git] / po / update.sh
blob75bdb49f46ce2406c78f1c8fe4e858c749dea5f3
1 #!/bin/sh
3 PACKAGE="mc"
5 if [ "x$1" = "x--help" ]; then
7 echo Usage: ./update.sh langcode
8 echo --help display this help and exit
9 echo --missing search for missing files in POTFILES.in
10 echo
11 echo Examples of use:
12 echo ./update.sh ----- just creates a new pot file from the source
13 echo ./update.sh da -- created new pot file and updated the da.po file
15 elif [ "x$1" = "x--missing" ]; then
17 echo "Searching for files containing _( ) but missing in POTFILES.in..."
18 find ../ -regex '.*\.[c|y|cc|c++|h]' | xargs grep _\( | cut -d: -f1 | uniq | cut -d/ -f2- > POTFILES.in.missing
20 echo Sorting... comparing...
21 sort -d POTFILES.in -o POTFILES.in
22 sort -d POTFILES.in.missing -o POTFILES.in.missing
24 diff POTFILES.in POTFILES.in.missing -u0 | grep '^+' |grep -v '^+++'|grep -v '^@@' > POTFILES.in.missing
26 if [ -s POTFILES.in.missing ]; then
27 echo && echo "Here are the results:"
28 echo && cat POTFILES.in.missing
29 echo && echo "File POTFILES.in.missing is being placed in directory..."
31 else
33 echo &&echo "There are no missing files, thanks God!"
34 rm POTFILES.in.missing
36 fi
38 elif [ "x$1" = "x" ]; then
40 echo "Building the $PACKAGE.pot ..."
42 xgettext --default-domain=$PACKAGE --directory=.. \
43 --add-comments=TRANSLATORS: --keyword=_ --keyword=N_ \
44 --keyword=Q_ --files-from=./POTFILES.in \
45 && test ! -f $PACKAGE.po \
46 || ( rm -f ./$PACKAGE.pot \
47 && mv $PACKAGE.po ./$PACKAGE.pot );
49 else
51 if [ -s $1.po ]; then
53 xgettext --default-domain=$PACKAGE --directory=.. \
54 --add-comments=TRANSLATORS: --keyword=_ --keyword=N_ \
55 --keyword=Q_ --files-from=./POTFILES.in \
56 && test ! -f $PACKAGE.po \
57 || ( rm -f ./PACKAGE.pot \
58 && mv $PACKAGE.po ./$PACKAGE.pot );
60 echo "Building the $PACKAGE.pot ..."
61 echo "Now merging $1.po with $PACKAGE.pot, and creating an updated $1.po ..."
63 mv $1.po $1.po.old && msgmerge --no-location $1.po.old $PACKAGE.pot -o $1.po \
64 && rm $1.po.old;
66 msgfmt --statistics $1.po
68 else
70 echo Sorry $1.po does not exist!
72 fi;
74 fi;