2000-01-04 02:42:28 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
2000-05-08 01:42:37 +04:00
|
|
|
PACKAGE="mc"
|
|
|
|
|
|
|
|
if [ "x$1" = "x--help" ]; then
|
|
|
|
|
|
|
|
echo Usage: ./update.sh langcode
|
|
|
|
echo --help display this help and exit
|
2000-05-15 23:12:55 +04:00
|
|
|
echo --missing search for missing files in POTFILES.in
|
2000-05-08 01:42:37 +04:00
|
|
|
echo
|
|
|
|
echo Examples of use:
|
|
|
|
echo ./update.sh ----- just creates a new pot file from the source
|
|
|
|
echo ./update.sh da -- created new pot file and updated the da.po file
|
|
|
|
|
2000-05-15 23:12:55 +04:00
|
|
|
elif [ "x$1" = "x--missing" ]; then
|
|
|
|
|
|
|
|
echo "Searching for files containing _( ) but missing in POTFILES.in..."
|
|
|
|
find ../ -regex '.*\.[c|y|cc|c++|h]' | xargs grep _\( | cut -d: -f1 | uniq | cut -d/ -f2- > POTFILES.in.missing
|
|
|
|
|
|
|
|
echo Sorting... comparing...
|
|
|
|
sort -d POTFILES.in -o POTFILES.in
|
|
|
|
sort -d POTFILES.in.missing -o POTFILES.in.missing
|
|
|
|
|
|
|
|
diff POTFILES.in POTFILES.in.missing -u0 | grep '^+' |grep -v '^+++'|grep -v '^@@' > POTFILES.in.missing
|
|
|
|
|
|
|
|
if [ -s POTFILES.in.missing ]; then
|
|
|
|
echo && echo "Here are the results:"
|
|
|
|
echo && cat POTFILES.in.missing
|
|
|
|
echo && echo "File POTFILES.in.missing is being placed in directory..."
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
echo &&echo "There are no missing files, thanks God!"
|
|
|
|
rm POTFILES.in.missing
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2000-05-08 01:42:37 +04:00
|
|
|
elif [ "x$1" = "x" ]; then
|
|
|
|
|
|
|
|
echo "Building the $PACKAGE.pot ..."
|
|
|
|
|
|
|
|
xgettext --default-domain=$PACKAGE --directory=.. \
|
2002-10-15 01:41:26 +04:00
|
|
|
--add-comments=TRANSLATORS: --keyword=_ --keyword=N_ \
|
2005-11-13 16:26:12 +03:00
|
|
|
--keyword=Q_ --files-from=./POTFILES.in \
|
2000-05-08 01:42:37 +04:00
|
|
|
&& test ! -f $PACKAGE.po \
|
|
|
|
|| ( rm -f ./$PACKAGE.pot \
|
|
|
|
&& mv $PACKAGE.po ./$PACKAGE.pot );
|
|
|
|
|
|
|
|
else
|
|
|
|
|
2000-05-15 23:12:55 +04:00
|
|
|
if [ -s $1.po ]; then
|
|
|
|
|
2000-05-08 01:42:37 +04:00
|
|
|
xgettext --default-domain=$PACKAGE --directory=.. \
|
2002-10-15 01:41:26 +04:00
|
|
|
--add-comments=TRANSLATORS: --keyword=_ --keyword=N_ \
|
2005-11-13 16:26:12 +03:00
|
|
|
--keyword=Q_ --files-from=./POTFILES.in \
|
2000-05-08 01:42:37 +04:00
|
|
|
&& test ! -f $PACKAGE.po \
|
|
|
|
|| ( rm -f ./PACKAGE.pot \
|
|
|
|
&& mv $PACKAGE.po ./$PACKAGE.pot );
|
|
|
|
|
2000-05-11 00:03:08 +04:00
|
|
|
echo "Building the $PACKAGE.pot ..."
|
|
|
|
echo "Now merging $1.po with $PACKAGE.pot, and creating an updated $1.po ..."
|
2000-05-08 01:42:37 +04:00
|
|
|
|
2005-05-23 07:08:43 +04:00
|
|
|
mv $1.po $1.po.old && msgmerge --no-location $1.po.old $PACKAGE.pot -o $1.po \
|
2000-05-08 01:42:37 +04:00
|
|
|
&& rm $1.po.old;
|
|
|
|
|
2000-05-11 00:03:08 +04:00
|
|
|
msgfmt --statistics $1.po
|
|
|
|
|
2000-05-15 23:12:55 +04:00
|
|
|
else
|
|
|
|
|
|
|
|
echo Sorry $1.po does not exist!
|
|
|
|
|
|
|
|
fi;
|
|
|
|
|
2000-05-08 01:42:37 +04:00
|
|
|
fi;
|