~oif-team/qt/touch-end-reentrant

11 by Harald Sitter
* Add MessagesQt.sh (Messages.sh is a link for extract-messages.sh)
1
#! /usr/bin/env bash
2
### TODO: transform Qt's translation template for KDE's Qt template
3
EXTRACTRC=${EXTRACTRC:-extractrc}
4
origdir=`pwd`
5
echo $qtcopydir
6
echo $podir
7
if test -d "$qtcopydir" -a -d "$podir"; then
8
	: # Noop
9
elif test -n "$qtcopydir" -o -n "$podir"; then
10
	echo "ERROR: MessageQt.sh was given wrong directory names!"
11
	exit 1
12
elif test -d ../qt-copy; then
13
	qtcopydir=../qt-copy
14
	podir=`pwd`/templates/messages/qt
15
elif test -d ../../qt-copy; then
16
	qtcopydir=../../qt-copy
17
	podir=`pwd`/../templates/messages/qt
18
else
19
	echo "ERROR: could not find qt-copy !"
20
        exit 1
21
fi
22
cd $qtcopydir/src || exit 2
23
$EXTRACTRC `find gui -name "qp*.ui"` > rc.cpp
24
xgettext --from-code=UTF-8 -C --kde -ci18n -ki18n:1 rc.cpp -o $podir/kdeqt.pot
25
rm rc.cpp
26
find . -name "*.cpp" | fgrep -v moc_ > list
27
### TODO: check that all classes below exist
28
for file in \
29
        qfiledialog qcolordialog \
30
	qurloperator qftp qhttp qlocal qerrormessage \
31
        q3filedialog q3colordialog q3printdialog \
32
	q3urloperator q3ftp q3http q3local q3errormessage \
33
        ; do
34
	fgrep -v $file list > list.new && mv list.new list
35
done
36
37
# Note about Qt contexts/comments:
38
# For Gettext purposes, comment of tr() and translate() is considered msgctxt.
39
# If translate() doesn't have a comment, but does have a context, then context
40
# is used for msgctxt. For info on handling this, see comments to method
41
# KLocale::translateQt in kdelibs/kdecore/localization/klocale.cpp
42
xgettext --join -C --qt \
43
    -ktranslate:1c,2,2t -ktranslate:2,3c,3t -ktr:1,1t -ktr:1,2c,2t \
44
    -kQT_TR_NOOP:1,1t -kQT_TRANSLATE_NOOP:1c,2,2t \
45
    --msgid-bugs-address=qt-bugs@trolltech.com \
46
    --files-from=list -o $podir/kdeqt.pot
47
cd $origdir