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