File: extract-messages.sh

package info (click to toggle)
kup-backup 0.7.1+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,480 kB
  • sloc: cpp: 7,263; sh: 51; makefile: 6
file content (65 lines) | stat: -rwxr-xr-x 2,876 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
BASEDIR="../"	# root of translatable sources
PROJECT="kup"	# project name
BUGADDR="http://kde-apps.org/content/show.php/Kup+Backup+System?content=147465"	# MSGID-Bugs
WDIR=`pwd`	# working dir
 
 
echo "Preparing rc files"
cd ${BASEDIR}
# we use simple sorting to make sure the lines do not jump around too much from system to system
find . -name 'libgit2*' -prune -o '(' -name '*.rc' -o -name '*.ui' -o -name '*.kcfg' ')' -print | sort > ${WDIR}/rcfiles.list
xargs --arg-file=${WDIR}/rcfiles.list extractrc > ${WDIR}/rc.cpp

#extract strings from .desktop file
intltool-extract --quiet --type=gettext/ini kcm/kcm_kup.desktop.template
cat kcm/kcm_kup.desktop.template.h >> ${WDIR}/rc.cpp
rm kcm/kcm_kup.desktop.template.h
intltool-extract --quiet --type=gettext/ini daemon/kupdaemon.notifyrc.template
cat daemon/kupdaemon.notifyrc.template.h >> ${WDIR}/rc.cpp
rm daemon/kupdaemon.notifyrc.template.h
intltool-extract --quiet --type=gettext/ini dataengine/plasma-dataengine-kup.desktop.template
cat dataengine/plasma-dataengine-kup.desktop.template.h >> ${WDIR}/rc.cpp
rm dataengine/plasma-dataengine-kup.desktop.template.h
intltool-extract --quiet --type=gettext/ini plasmoid/metadata.desktop.template
cat plasmoid/metadata.desktop.template.h >> ${WDIR}/rc.cpp
rm plasmoid/metadata.desktop.template.h

cd ${WDIR}
echo "Done preparing rc files"


echo "Extracting messages"
cd ${BASEDIR}
# see above on sorting
find . -name 'libgit2*' -prune -o '(' -name '*.cpp' -o -name '*.h' -o -name '*.qml' ')' -print | sort > ${WDIR}/infiles.list
echo "rc.cpp" >> ${WDIR}/infiles.list
cd ${WDIR}
xgettext --from-code=UTF-8 -C --kde -ci18n -ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 -ktr2i18n:1 \
	-kI18N_NOOP:1 -kI18N_NOOP2:1c,2 -kaliasLocale -kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 \
	-kN_:1 -kxi18nc:1c,2 -kxi18ncp:1c,2,3 --msgid-bugs-address="${BUGADDR}" \
	--files-from=infiles.list -D ${BASEDIR} -D ${WDIR} -o ${PROJECT}.pot || { echo "error while calling xgettext. aborting."; exit 1; }
echo "Done extracting messages"


echo "Merging translations"
catalogs=`find . -name '*.po'`
for cat in $catalogs; do
  echo $cat
  msgmerge -o $cat.new $cat ${PROJECT}.pot
  mv $cat.new $cat
done
cd ${WDIR}
intltool-merge --quiet --desktop-style ${WDIR} ${BASEDIR}/kcm/kcm_kup.desktop.template ${BASEDIR}/kcm/kcm_kup.desktop
intltool-merge --quiet --desktop-style ${WDIR} ${BASEDIR}/daemon/kupdaemon.notifyrc.template ${BASEDIR}/daemon/kupdaemon.notifyrc
intltool-merge --quiet --desktop-style ${WDIR} ${BASEDIR}/dataengine/plasma-dataengine-kup.desktop.template ${BASEDIR}/dataengine/plasma-dataengine-kup.desktop
intltool-merge --quiet --desktop-style ${WDIR} ${BASEDIR}/plasmoid/metadata.desktop.template ${BASEDIR}/plasmoid/metadata.desktop
echo "Done merging translations"


echo "Cleaning up"
cd ${WDIR}
rm rcfiles.list
rm infiles.list
rm rc.cpp
echo "Done"