File indexing completed on 2024-04-14 03:49:00

0001 #! /bin/sh
0002 
0003 ### creates marble_qt.pot: strings from marble-maps, marble-qt, libs & plugins
0004 
0005 # collect strings from DGML files
0006 # TODO: is there a way to make lupdate pick up the filename and line of the original string?
0007 for fname in  `find data/maps -iname \*.dgml`; do
0008   for field in name description heading text ; do
0009     grep -inH "<$field>.*<\/$field>" $fname \
0010     | sed 's/\"/\\\"/g' \
0011     | sed 's/<!\[CDATA\[\(.*\)\]\]>/\1/' \
0012     | sed "s/\\([^:]*\\):\\([^:]*\\):.*<$field>\(.*\)<\/$field>.*/\
0013            \/\/: file \1:\2\n\
0014            QCoreApplication::translate(\"DGML\", \"\3\");\
0015            /i" \
0016     >> rc.cpp
0017   done
0018 done
0019 
0020 # collect strings from legend.html file
0021 cat data/legend.html \
0022   | tr -d '\n' \
0023   | sed -e 's/.*<body>\(.*\)<\/body>/\1/' \
0024         -e 's/^<!DOCTYPE html>//' \
0025         -e 's@<link href="legend.css" rel="stylesheet" type="text/css" />@@' \
0026         -e 's/%!{bootstrap}%//' \
0027         -e 's/body *{ *padding: 10px; *}//' \
0028         -e 's/<!--[- "&'\''./0-9:;<=>A-Z_a-z]*-->[\t ]*/\n/g' \
0029         -e 's/<[A-Za-z0-9]*\( [a-z:]*=\"[-A-Za-z0-9:/_.% ]*\"\)*>[\t ]*/\n/g' \
0030         -e 's/<\/[A-Za-z0-9]*>[\t ]*/\n/g' \
0031   | sed -e 's/^ *//' -e 's/ *$//' -e 's/^&nbsp;$//' -e '/^$/d' -e 's/"/\\"/g' \
0032   | sed -e 's/^\(.*\)$/\/\/: file data\/legend.html\nQCoreApplication::translate(\"Legends\", \"\1\");/' \
0033   >> rc.cpp
0034 
0035 # collect strings from stars file
0036 cut -d ';' -f 1 data/stars/names.csv | sed -e 's/^/\/\/: file data\/stars\/names.csv\nQCoreApplication::translate(\"StarNames\", \"/' -e 's/$/\");/' >> rc.cpp
0037 
0038 # Eliminate empty translate calls (expects one comment line above each translate call)
0039 egrep -B1 'QCoreApplication::translate\(".*", ".*[^ ].*"\)' rc.cpp > rc.cpp.1
0040 mv rc.cpp.1 rc.cpp
0041 
0042 $EXTRACT_TR_STRINGS \
0043     `find src/apps/marble-maps -name '*.cpp' -o -name '*.qml'` \
0044     src/apps/marble-qt/QtMainWindow.cpp src/apps/marble-qt/qtmain.cpp \
0045     src/apps/marble-ui/ControlView.cpp \
0046     `find src/plugins -name '*.cpp' -o -name '*.ui' | grep -v '/test/'` \
0047     `find src/lib     -name '*.cpp' -o -name '*.ui'` \
0048     src/lib/marble/PluginInterface.h \
0049     src/lib/marble/MarbleGlobal.h rc.cpp \
0050     -o $podir/marble_qt.pot