X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fpo%2Fxlat.sh;h=f4c7182dbc6a1abf51d018423bb860558098ecbc;hp=7f7110ec638209fdd01d8f7783aa74b8a5de157f;hb=3badd817d6f012b5e882940db0c5d7e61cec15d7;hpb=20dab381c3f5c0c0bd48cd7014ab67857eb80155 diff --git a/cinelerra-5.1/po/xlat.sh b/cinelerra-5.1/po/xlat.sh index 7f7110ec..f4c7182d 100755 --- a/cinelerra-5.1/po/xlat.sh +++ b/cinelerra-5.1/po/xlat.sh @@ -1,7 +1,57 @@ #!/bin/bash +# this script is used on c++ source to modify the _() +# gettext calls to use msgqual(ctxt,id) instead. +# local context regions are defined by using: +# +# #undef MSGQUAL +# #define MSGQUAL "qual_id" +# ... code with _() ... +# #undef MSGQUAL +# #define MSGQUAL 0 +# +if [ $# -lt 1 -o ! -d "$1" ]; then + echo 1>&2 "usage: $0 //cinelerra-src [/tmp] > //cin.po" + exit 1 +fi +cin_dir=`basename "$1"` +tmp_dir=`mktemp -d -p ${2:-/tmp} cin_XXXXXX` +trap "rm -rf '$tmp_dir'" EXIT + +#need a copy of src dir for editing +echo 1>&2 "copy" +cp -a "$1" "$tmp_dir/." +cd "$tmp_dir/$cin_dir" + +echo 1>&2 "edit" +for d in guicast/ cinelerra/ plugins/*; do + if [ ! -d "$d" ]; then continue; fi + ls -1 $d/*.[Ch] $d/*.inc 2> /dev/null +done | while read f ; do +#qualifier is reset using #define MSGQUAL "qual_id" +#this changes: +# code C_("xxx") [... code _("yyy")] +#to: +# code D_("qual_id#xxx") [... code D_("qual_id#yyy")] + sed -n -i "$f" -f - <<<'1,1{x; s/.*/_("/; x} +:n1 s/^\(#define MSGQUAL[ ]\)/\1/; t n4 +:n2 s/\&2 "scan" for d in guicast/ cinelerra/ plugins/*; do if [ ! -d "$d" ]; then continue; fi - ls -1 $d/*.[Ch] $d/*.inc 2> /dev/null; -done | xgettext --no-wrap -L C++ -k_ -kN_ -f - -o - + ls -1 $d/*.[Ch] $d/*.inc 2> /dev/null +done | xgettext --no-wrap -L C++ -k_ -kN_ -kD_ -f - -o - + +echo 1>&2 "done"