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 _() ...
13 cin_dir=`mktemp -d -p /tmp cin_XXXXXX`
14 trap "rm -rf '$cin_dir'" EXIT
18 for d in guicast cinelerra plugins/*; do
19 if [ ! -d "$d" ]; then continue; fi
20 mkdir -p "$cin_dir/$d"
21 ls -1 "$d"/*.[Ch] "$d"/*.inc 2> /dev/null
22 done | while read f ; do
23 #qualifier is reset using #define MSGQUAL "qual_id"
25 # code C_("xxx") [... code _("yyy")]
27 # code D_("qual_id#xxx") [... code D_("qual_id#yyy")]
28 bn=${f##*/}; fn=${bn%.*}
29 sed -n "$f" > "$cin_dir/$f" -f - <<<'1,1{x; s/.*/D_("'$fn'#/; x}; t n1
30 :n1 s/^\(#define MSGQUAL[ ]\)/\1/; t n4
32 /; t n3; P; d; n; b n1
36 :n4 p; s/^#define MSGQUAL[ ]*"\(.*\)"$/D_("\1#/; t n5
37 s/^.*$/_("/; h; d; n; b n1
42 #scan src and generate cin.po
45 for d in guicast cinelerra plugins/*; do
46 if [ ! -d "$d" ]; then continue; fi
47 ls -1 $d/*.[Ch] $d/*.inc 2> /dev/null
48 done | xgettext --from-code utf-8 --no-wrap -L C++ -k_ -kN_ -kD_ -f - -o -