Add a move-generator API.
[tagua/yd.git] / extract-messages.sh
blob7db380a2aefc20f02edd06c51c4ce3a9ffbb9d34
1 #!/bin/sh
2 set -e
4 WDIR=`pwd`
5 BASEDIR=$1
6 [ $BASEDIR ] || BASEDIR=$WDIR # root of translatable sources
7 SRCDIR=$BASEDIR/src
8 PROJECT="tagua" # project name
9 BUGADDR="http://trac.tagua-project.org"
11 echo "Preparing rc files"
12 cd ${SRCDIR}
13 # we use simple sorting to make sure the lines do not jump around too much from system to system
14 find . -name '*.rc' -o -name '*.ui' -o -name '*.kcfg' | sort > ${WDIR}/rcfiles.list
15 xargs --arg-file=${WDIR}/rcfiles.list extractrc > ${WDIR}/extractedrc.cpp
16 # additional string for KAboutData
17 echo 'i18nc("NAME OF TRANSLATORS","Your names");' >> ${WDIR}/extractedrc.cpp
18 echo 'i18nc("EMAIL OF TRANSLATORS","Your emails");' >> ${WDIR}/extractedrc.cpp
19 cd ${WDIR}
20 echo "Done preparing rc files"
23 echo "Extracting messages"
24 cd ${SRCDIR}
25 # see above on sorting
26 find . -name '*.cpp' -o -name '*.h' -o -name '*.c' | sort > ${WDIR}/infiles.list
27 echo "extractedrc.cpp" >> ${WDIR}/infiles.list
28 cd ${WDIR}
29 xgettext --from-code=UTF-8 -C -kde -ci18n -ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 -ktr2i18n:1 \
30 -kI18N_NOOP:1 -kI18N_NOOP2:1c,2 -kaliasLocale -kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 \
31 --msgid-bugs-address="${BUGADDR}" \
32 --files-from=infiles.list -D ${SRCDIR} -D ${WDIR} -o ${PROJECT}.pot || { echo "error while calling xgettext. aborting."; exit 1; }
33 echo "Done extracting messages"
36 echo "Merging translations"
37 catalogs=`find translations -name '*.po'`
38 for cat in $catalogs; do
39 echo $cat
40 msgmerge -o $cat.new $cat ${PROJECT}.pot
41 mv $cat.new $cat
42 done
43 echo "Done merging translations"
46 echo "Cleaning up"
47 cd ${WDIR}
48 rm rcfiles.list
49 rm infiles.list
50 rm extractedrc.cpp
51 echo "Done"