#! /bin/bash # FIXME: TMPDIR=$PWD TEMP=$TMPDIR/msgdiff.po-cut$1 #set -x function format_string () { echo "$2" | if $1 ; then sed 's%&%\&%g;s%<%\<%g;s%>%\>%g;s%$%
%g' else sed 's%&%\&%g;s%<%\<%g;s%>%\>%g;s%$%\ %g' fi | if test "${2% }" = "$2" ; then if $1 ; then sed '$s%
$%%' ; else sed '$s% $%%' ; fi ; else cat ; fi | tr -d '\n' } STARTING_STRING=true STARTING_PLURAL=false RUNNING_PLURAL=false if test -f $TMPDIR/msgdiff.plural-in-progress$1 ; then if test "${MSGEXEC_MSGID_PLURAL+yes}" = "yes" -a "$MSGEXEC_PLURAL_FORM" != 0 ; then RUNNING_PLURAL=true STARTING_STRING=false else rm $TMPDIR/msgdiff.plural-in-progress$1 echo '' fi fi if test "${MSGEXEC_MSGID_PLURAL+yes}" = "yes" -a "$MSGEXEC_PLURAL_FORM" = 0 ; then STARTING_PLURAL=true RUNNING_PLURAL=true touch $TMPDIR/msgdiff.plural-in-progress$1 fi if $STARTING_STRING ; then echo '
' if $2 ; then echo -n '

Changed string

' else echo -n '

Added string

' fi # Do if msgctxt is present (it may be empty): if test "${MSGEXEC_MSGCTXT+yes}" = "yes" ; then echo '

Context:

' echo -n '
'
		format_string true "$MSGEXEC_MSGCTXT"
		echo -n '
' fi echo '

English string:

' echo -n '
'
	format_string true "$MSGEXEC_MSGID"
	echo -n '
' if $STARTING_PLURAL ; then echo '

Plural form of English string:

' echo -n '
'
		format_string true "$MSGEXEC_MSGID_PLURAL"
		echo -n '
' fi fi if test -n "$MSGEXEC_PLURAL_FORM" ; then echo '
' echo '

Plural form '"$MSGEXEC_PLURAL_FORM"'

' else echo '' fi if $2 ; then CNT=$(<$TEMP/CNT) # Trick: bash ignores trailing EOL. Work-around it by adding "END" MSGEXEC_MSGSTR_ORIG="$(cat $TEMP/$CNT ; echo END)" MSGEXEC_MSGSTR_ORIG="${MSGEXEC_MSGSTR_ORIG%END}" echo '

Original translation:

' echo -n '' echo -n '
'
	format_string true "$MSGEXEC_MSGSTR_ORIG"
	echo '
' let CNT++ echo $CNT >$TEMP/CNT fi # Trick: bash ignores trailing EOL. Work-around it by adding "END" MSGEXEC_MSGSTR="$(cat ; echo END)" MSGEXEC_MSGSTR="${MSGEXEC_MSGSTR%END}" echo '

Proposed translation:

' echo -n '' echo -n '
'
format_string true "$MSGEXEC_MSGSTR"
echo '
' echo '

Or specify custom translation:

' echo '' echo '' echo -n '
' echo '
' echo '' if ! $RUNNING_PLURAL ; then echo '
' fi