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