#!/bin/sh . "${srcdir=.}/init.sh"; path_prepend_ . ../src # Test of ITS support. : ${XGETTEXT=xgettext} GETTEXTDATADIR=. export GETTEXTDATADIR cat <<\EOF > empty.xml EOF ${XGETTEXT} --itstool -o empty.pot empty.xml 2>empty.err || { cat empty.err; Exit 1; } test -d its || mkdir its cat <<\EOF > its/empty-1.loc EOF ${XGETTEXT} --itstool -o empty.pot empty.xml 2>empty.err || { cat empty.err; Exit 1; } cat <<\EOF > its/empty-2.loc EOF ${XGETTEXT} --itstool -o empty.pot empty.xml 2>empty.err || { cat empty.err; Exit 1; } cat <<\EOF > its/empty.its EOF ${XGETTEXT} --itstool -o empty.pot empty.xml 2>empty.err || { cat empty.err; Exit 1; } cat <<\EOF > its/messages.loc EOF cat <<\EOF > its/messages.its This is code This is a comment EOF cat <<\EOF >messages.xml ]>

This is a test message &foo;><&""

This is a non-translatable message

This is a test message, with an element in a text

$ echo ' ' >> /dev/null $ cat < /dev/yes $ sleep 10 &

This is a test message, with an attribute

This is a localization note

This is a test message, with a localization note

This is a test message, with a local localization note

This is a message with space preserved

This is a non-translatable string

This is a non-translatable string

context|A translatable string with a context prefixed

Leading/trailing whitespaces are removed, but not middle

This is an unescaped element <>&"

EOF cat <<\EOF >messages.ok #. (itstool) path: message/p #: messages.xml:8 msgid "This is a test message &foo;><&\"\"" msgstr "" #. (itstool) path: message/p #: messages.xml:14 msgid "This is a test message, with an element in a text" msgstr "" #. This is code #. (itstool) path: message/code #: messages.xml:17 #, no-wrap msgid "" " $ echo ' ' >> /dev/null\n" " $ cat < /dev/yes\n" " $ sleep 10 &\n" msgstr "" #. This is a comment #. (itstool) path: messages/message@comment #: messages.xml:22 msgid "This is a comment <>&"" msgstr "" #. (itstool) path: message/p #: messages.xml:23 msgid "This is a test message, with an attribute" msgstr "" #. This is a localization note #. (itstool) path: message/p #: messages.xml:29 msgid "This is a test message, with a localization note" msgstr "" #. This is a local localization note #. (itstool) path: message/p #: messages.xml:32 msgid "This is a test message, with a local localization note" msgstr "" #. (itstool) path: message/p #: messages.xml:41 #, no-wrap msgid " This is a message with space preserved" msgstr "" #. This is a comment #. (itstool) path: message/p #: messages.xml:51 msgctxt "context" msgid "A translatable string with a context prefixed" msgstr "" #. (itstool) path: message/p #: messages.xml:54 msgid "" "Leading/trailing whitespaces are removed,\n" " but not middle" msgstr "" #. (itstool) path: message/p #: messages.xml:59 msgid "This is an unescaped element <>&\"" msgstr "" #. (itstool) path: messages/message@unescaped #: messages.xml:61 msgid "This is an unescaped attribute <>&\"" msgstr "" EOF : ${DIFF=diff} ${XGETTEXT} --itstool --no-wrap --omit-header -o messages.pot messages.xml 2>messages.err || { cat messages.err; Exit 1; } ${DIFF} messages.ok messages.pot result=$? test $result = 0 || exit $result # Check if locating rules can work with --directory, and extra ".in" # file name extension. test -d data || mkdir data test -d po || mkdir po cp messages.xml data/messages.msg.in cd po GETTEXTDATADIR=.. export GETTEXTDATADIR ${XGETTEXT} --itstool --no-wrap --omit-header --directory=.. -o messages.pot.in data/messages.msg.in 2>messages.err || { cat messages.err; Exit 1; } sed -e 's!^#: data/messages.msg.in!#: messages.xml!' \ < messages.pot.in > messages.pot ${DIFF} ../messages.ok messages.pot result=$? test $result = 0 || exit $result