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