summaryrefslogtreecommitdiffstats
path: root/po/messages.sh
blob: bd114d6ddfd9ff71d2ad471e0992503656dd7118 (plain)
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
66
67
68
69
#!/bin/sh

# Modified by Tobi Vollebregt for use with kio-locate.

# Inspired by Makefile.common from coolo
# this script is used to update the .po files

# To update the translations, you will need a specific gettext
# patched for kde and a lot of patience, tenacity, luck, time ..


# I guess one should only update the .po files when all .cpp files
# are generated (after a make or scons)

# If you have a better way to do this, do not keep that info
# for yourself and help me to improve this script, thanks
# (tnagyemail-mail tat yahoo d0tt fr)
#

SRCDIR=../src
TIPSDIR=$SRCDIR/appdata

TDEDIR=`tde-config --prefix`
EXTRACTRC=extractrc
KDEPOT=`tde-config --prefix`/include/tde/kde.pot
XGETTEXT="xgettext -C -ki18n -ktr2i18n -kI18N_NOOP -ktranslate -kaliasLocale -x $KDEPOT "

## check that kde.pot is available
if ! test -e $KDEPOT; then
	echo "$KDEPOT does not exist, there may be something wrong with your installation!"
	XGETTEXT="xgettext -C -ki18n -ktr2i18n -kI18N_NOOP -ktranslate -kaliasLocale "
fi

## extract the strings
echo "extracting the strings"

echo -e 'i18n("_: NAME OF TRANSLATORS\\n"\n"Your names")\ni18n("_: EMAIL OF TRANSLATORS\\n"\n"Your emails")' > $SRCDIR/_translatorinfo.cpp

## bad hack to get strings from *.ui files
# Armin Straub <linux@arminstraub.de>
UIC="uic -tr i18n"
TMPHACK="$SRCDIR/tmphack"
mkdir $TMPHACK || exit 1
for F in "$SRCDIR/"*.ui; do
    echo ".. preparing $F"
    FN=$TMPHACK/$(basename "$F")
    $UIC "$F" > "$FN.h" && $UIC -impl "$FN.h" "$F" > "$FN.cpp"
done
kconfig_compiler -d $TMPHACK $SRCDIR/*.kcfg $SRCDIR/*.kcfgc
## bad hack to get strings from *.ui files

$XGETTEXT `find $SRCDIR -name "*.cpp"` -o kio_locate.pot

## bad hack to get strings from *.ui files
rm -rf "$TMPHACK"
## bad hack to get strings from *.ui files

# remove the intermediate files
rm -f $SRCDIR/_translatorinfo.cpp

## now merge the .po files ..
echo "merging the .po files"

for i in `ls *.po`; do
	msgmerge $i kio_locate.pot -o $i || exit 1
done

## finished
echo "Done"