2 # this script is used on c++ source to modify the _()
3 # gettext calls to use msgqual(ctxt,id) instead.
4 # local context regions are defined by using:
7 # #define MSGQUAL "qual_id"
8 # ... code with _() ...
12 if [ $# -lt 1 -o ! -d "$1" ]; then
13 echo 1>&2 "usage: $0 /<path>/cinelerra-src [/tmp] > /<path>/cin.po"
17 cin_dir=`basename "$1"`
18 tmp_dir=`mktemp -d -p ${2:-/tmp} cin_XXXXXX`
19 trap "rm -rf '$tmp_dir'" EXIT
21 #need a copy of src dir for editing
23 cp -a "$1" "$tmp_dir/."
24 cd "$tmp_dir/$cin_dir"
27 for d in guicast/ cinelerra/ plugins/*; do
28 if [ ! -d "$d" ]; then continue; fi
29 ls -1 $d/*.[Ch] $d/*.inc 2> /dev/null
30 done | while read f ; do
31 #qualifier is reset using #define MSGQUAL "qual_id"
33 # code C_("xxx") [... code _("yyy")]
35 # code D_("qual_id#xxx") [... code D_("qual_id#yyy")]
36 sed -n -i "$f" -f - <<<'1,1{x; s/.*/_("/; x}
37 :n1 s/^\(#define MSGQUAL[ ]\)/\1/; t n4
39 /; t n3; P; d; n; b n1
43 :n4 p; s/^#define MSGQUAL[ ]*"\(.*\)"$/D_("\1#/; t n5
44 s/^.*$/_("/; h; d; n; b n1
49 #scan src and generate cin.po
51 for d in guicast/ cinelerra/ plugins/*; do
52 if [ ! -d "$d" ]; then continue; fi
53 ls -1 $d/*.[Ch] $d/*.inc 2> /dev/null
54 done | xgettext --no-wrap -L C++ -k_ -kN_ -kD_ -f - -o -