File: Messages.sh

package info (click to toggle)
marble 4:17.08.3-3.2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 141,596 kB
  • sloc: cpp: 189,322; xml: 39,420; ansic: 7,204; python: 2,244; sh: 1,137; makefile: 236; perl: 222; ruby: 97; java: 66
file content (50 lines) | stat: -rwxr-xr-x 2,147 bytes parent folder | download | duplicates (2)
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
#! /bin/sh

### creates marble_qt.pot: strings from marble-maps, marble-qt, libs & plugins

# collect strings from DGML files
# TODO: is there a way to make lupdate pick up the filename and line of the original string?
for fname in  `find data/maps -iname \*.dgml`; do
  for field in name description heading text ; do
    grep -inH "<$field>.*<\/$field>" $fname \
    | sed 's/\"/\\\"/g' \
    | sed 's/<!\[CDATA\[\(.*\)\]\]>/\1/' \
    | sed "s/\\([^:]*\\):\\([^:]*\\):.*<$field>\(.*\)<\/$field>.*/\
           \/\/: file \1:\2\n\
           QCoreApplication::translate(\"DGML\", \"\3\");\
           /i" \
    >> rc.cpp
  done
done

# collect strings from legend.html file
cat data/legend.html \
  | tr -d '\n' \
  | sed -e 's/.*<body>\(.*\)<\/body>/\1/' \
        -e 's/^<!DOCTYPE html>//' \
        -e 's@<link href="legend.css" rel="stylesheet" type="text/css" />@@' \
        -e 's/%!{bootstrap}%//' \
        -e 's/body *{ *padding: 10px; *}//' \
        -e 's/<!--[- "&'\''./0-9:;<=>A-Z_a-z]*-->[\t ]*/\n/g' \
        -e 's/<[A-Za-z0-9]*\( [a-z:]*=\"[-A-Za-z0-9:/_.% ]*\"\)*>[\t ]*/\n/g' \
        -e 's/<\/[A-Za-z0-9]*>[\t ]*/\n/g' \
  | sed -e 's/^ *//' -e 's/ *$//' -e 's/^&nbsp;$//' -e '/^$/d' \
  | sed -e 's/^\(.*\)$/\/\/: file data\/legend.html\nQCoreApplication::translate(\"Legends\", \"\1\");/' \
  >> rc.cpp

# collect strings from stars file
cut -d ';' -f 1 data/stars/names.csv | sed -e 's/^/\/\/: file data\/stars\/names.csv\nQCoreApplication::translate(\"StarNames\", \"/' -e 's/$/\");/' >> rc.cpp

# Eliminate empty translate calls (expects one comment line above each translate call)
egrep -B1 'QCoreApplication::translate\(".*", ".*[^ ].*"\)' rc.cpp > rc.cpp.1
mv rc.cpp.1 rc.cpp

$EXTRACT_TR_STRINGS \
    `find src/apps/marble-maps -name '*.cpp' -o -name '*.qml'` \
    src/apps/marble-qt/QtMainWindow.cpp src/apps/marble-qt/qtmain.cpp \
    src/apps/marble-ui/ControlView.cpp \
    `find src/plugins -name '*.cpp' -o -name '*.ui' | grep -v '/test/'` \
    `find src/lib     -name '*.cpp' -o -name '*.ui'` \
    src/lib/marble/PluginInterface.h \
    src/lib/marble/MarbleGlobal.h rc.cpp \
    -o $podir/marble_qt.pot