From: Bruno Haible Date: Tue, 25 Nov 2003 11:05:37 +0000 (+0000) Subject: Test for extraction of tagged comments. X-Git-Tag: v0.13~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=569845286dbb89f52ca0c0034ea43139f57ca3d8;p=thirdparty%2Fgettext.git Test for extraction of tagged comments. --- diff --git a/gettext-tools/tests/xgettext-awk-1 b/gettext-tools/tests/xgettext-awk-1 new file mode 100755 index 000000000..c0422b9df --- /dev/null +++ b/gettext-tools/tests/xgettext-awk-1 @@ -0,0 +1,51 @@ +#!/bin/sh + +# Test awk support: --add-comments option. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles xg-a-1.awk" +cat < xg-a-1.awk +# This comment will not be extracted. +print _"help" +# TRANSLATORS: This is an extracted comment. +print _"me" +# Not extracted either. +print _"Hey Jude" +# TRANSLATORS: +# Nickname of the Beatles +print _"The Fabulous Four" +EOF + +tmpfiles="$tmpfiles xg-a-1.po" +: ${XGETTEXT=xgettext} +${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \ + xg-a-1.awk -d xg-a-1 +test $? = 0 || { rm -fr $tmpfiles; exit 1; } + +tmpfiles="$tmpfiles xg-a-1.ok" +cat < xg-a-1.ok +msgid "help" +msgstr "" + +#. TRANSLATORS: This is an extracted comment. +msgid "me" +msgstr "" + +msgid "Hey Jude" +msgstr "" + +#. TRANSLATORS: +#. Nickname of the Beatles +msgid "The Fabulous Four" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-a-1.ok xg-a-1.po +result=$? + +rm -fr $tmpfiles + +exit $result diff --git a/gettext-tools/tests/xgettext-c-9 b/gettext-tools/tests/xgettext-c-9 new file mode 100755 index 000000000..b09095409 --- /dev/null +++ b/gettext-tools/tests/xgettext-c-9 @@ -0,0 +1,53 @@ +#!/bin/sh + +# Test C support: --add-comments option. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles xg-c-9.c" +cat < xg-c-9.c +// This comment will not be extracted. +print (gettext ("help")); +// TRANSLATORS: This is an extracted comment. +print (gettext ("me")); +/* Not extracted either. */ +print (gettext ("Hey Jude")); +/* TRANSLATORS: + Nickname of the Beatles +*/ +print (gettext ("The Fabulous Four")); +EOF + +tmpfiles="$tmpfiles xg-c-9.po" +: ${XGETTEXT=xgettext} +${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \ + xg-c-9.c -d xg-c-9 +test $? = 0 || { rm -fr $tmpfiles; exit 1; } + +tmpfiles="$tmpfiles xg-c-9.ok" +cat < xg-c-9.ok +msgid "help" +msgstr "" + +#. TRANSLATORS: This is an extracted comment. +msgid "me" +msgstr "" + +msgid "Hey Jude" +msgstr "" + +#. TRANSLATORS: +#. Nickname of the Beatles +#. +msgid "The Fabulous Four" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-c-9.ok xg-c-9.po +result=$? + +rm -fr $tmpfiles + +exit $result diff --git a/gettext-tools/tests/xgettext-elisp-1 b/gettext-tools/tests/xgettext-elisp-1 new file mode 100755 index 000000000..addbdc675 --- /dev/null +++ b/gettext-tools/tests/xgettext-elisp-1 @@ -0,0 +1,51 @@ +#!/bin/sh + +# Test EmacsLisp support: --add-comments option. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles xg-el-1.el" +cat < xg-el-1.el +; This comment will not be extracted. +(princ (_ "help")) +;; TRANSLATORS: This is an extracted comment. +(princ (_ "me")) +; Not extracted either. +(princ (_ "Hey Jude")) +; TRANSLATORS: +; Nickname of the Beatles +(princ (_ "The Fabulous Four")) +EOF + +tmpfiles="$tmpfiles xg-el-1.po" +: ${XGETTEXT=xgettext} +${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \ + xg-el-1.el -d xg-el-1 +test $? = 0 || { rm -fr $tmpfiles; exit 1; } + +tmpfiles="$tmpfiles xg-el-1.ok" +cat < xg-el-1.ok +msgid "help" +msgstr "" + +#. TRANSLATORS: This is an extracted comment. +msgid "me" +msgstr "" + +msgid "Hey Jude" +msgstr "" + +#. TRANSLATORS: +#. Nickname of the Beatles +msgid "The Fabulous Four" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-el-1.ok xg-el-1.po +result=$? + +rm -fr $tmpfiles + +exit $result diff --git a/gettext-tools/tests/xgettext-java-5 b/gettext-tools/tests/xgettext-java-5 new file mode 100755 index 000000000..0d77a50c3 --- /dev/null +++ b/gettext-tools/tests/xgettext-java-5 @@ -0,0 +1,53 @@ +#!/bin/sh + +# Test Java support: --add-comments option. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles xg-j-5.java" +cat < xg-j-5.java +// This comment will not be extracted. +System.out.println(gettext("help")); +// TRANSLATORS: This is an extracted comment. +System.out.println(gettext("me")); +/* Not extracted either. */ +System.out.println(gettext("Hey Jude")); +/* TRANSLATORS: + Nickname of the Beatles +*/ +System.out.println(gettext("The Fabulous Four")); +EOF + +tmpfiles="$tmpfiles xg-j-5.po" +: ${XGETTEXT=xgettext} +${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \ + xg-j-5.java -d xg-j-5 +test $? = 0 || { rm -fr $tmpfiles; exit 1; } + +tmpfiles="$tmpfiles xg-j-5.ok" +cat < xg-j-5.ok +msgid "help" +msgstr "" + +#. TRANSLATORS: This is an extracted comment. +msgid "me" +msgstr "" + +msgid "Hey Jude" +msgstr "" + +#. TRANSLATORS: +#. Nickname of the Beatles +#. +msgid "The Fabulous Four" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-j-5.ok xg-j-5.po +result=$? + +rm -fr $tmpfiles + +exit $result diff --git a/gettext-tools/tests/xgettext-librep-1 b/gettext-tools/tests/xgettext-librep-1 new file mode 100755 index 000000000..0c92cb307 --- /dev/null +++ b/gettext-tools/tests/xgettext-librep-1 @@ -0,0 +1,53 @@ +#!/bin/sh + +# Test librep support: --add-comments option. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles xg-lr-1.jl" +cat < xg-lr-1.jl +; This comment will not be extracted. +(princ (_ "help")) +;; TRANSLATORS: This is an extracted comment. +(princ (_ "me")) +#| Not extracted either. |# +(princ (_ "Hey Jude")) +#| TRANSLATORS: + Nickname of the Beatles +|# +(princ (_ "The Fabulous Four")) +EOF + +tmpfiles="$tmpfiles xg-lr-1.po" +: ${XGETTEXT=xgettext} +${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \ + xg-lr-1.jl -d xg-lr-1 +test $? = 0 || { rm -fr $tmpfiles; exit 1; } + +tmpfiles="$tmpfiles xg-lr-1.ok" +cat < xg-lr-1.ok +msgid "help" +msgstr "" + +#. TRANSLATORS: This is an extracted comment. +msgid "me" +msgstr "" + +msgid "Hey Jude" +msgstr "" + +#. TRANSLATORS: +#. Nickname of the Beatles +#. +msgid "The Fabulous Four" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-lr-1.ok xg-lr-1.po +result=$? + +rm -fr $tmpfiles + +exit $result diff --git a/gettext-tools/tests/xgettext-lisp-1 b/gettext-tools/tests/xgettext-lisp-1 new file mode 100755 index 000000000..1db3955b6 --- /dev/null +++ b/gettext-tools/tests/xgettext-lisp-1 @@ -0,0 +1,53 @@ +#!/bin/sh + +# Test Lisp support: --add-comments option. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles xg-ls-1.lisp" +cat < xg-ls-1.lisp +; This comment will not be extracted. +(write-line (gettext "help")) +;; TRANSLATORS: This is an extracted comment. +(write-line (gettext "me")) +#| Not extracted either. |# +(write-line (gettext "Hey Jude")) +#| TRANSLATORS: + Nickname of the Beatles +|# +(write-line (gettext "The Fabulous Four")) +EOF + +tmpfiles="$tmpfiles xg-ls-1.po" +: ${XGETTEXT=xgettext} +${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \ + xg-ls-1.lisp -d xg-ls-1 +test $? = 0 || { rm -fr $tmpfiles; exit 1; } + +tmpfiles="$tmpfiles xg-ls-1.ok" +cat < xg-ls-1.ok +msgid "help" +msgstr "" + +#. TRANSLATORS: This is an extracted comment. +msgid "me" +msgstr "" + +msgid "Hey Jude" +msgstr "" + +#. TRANSLATORS: +#. Nickname of the Beatles +#. +msgid "The Fabulous Four" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-ls-1.ok xg-ls-1.po +result=$? + +rm -fr $tmpfiles + +exit $result diff --git a/gettext-tools/tests/xgettext-perl-5 b/gettext-tools/tests/xgettext-perl-5 new file mode 100755 index 000000000..de64eecf3 --- /dev/null +++ b/gettext-tools/tests/xgettext-perl-5 @@ -0,0 +1,51 @@ +#!/bin/sh + +# Test Perl support: --add-comments option. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles xg-pl-5.pl" +cat < xg-pl-5.pl +# This comment will not be extracted. +print gettext "help"; +# TRANSLATORS: This is an extracted comment. +print gettext "me"; +# Not extracted either. +print gettext "Hey Jude"; +# TRANSLATORS: +# Nickname of the Beatles +print gettext "The Fabulous Four"; +EOF + +tmpfiles="$tmpfiles xg-pl-5.po" +: ${XGETTEXT=xgettext} +${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \ + xg-pl-5.pl -d xg-pl-5 +test $? = 0 || { rm -fr $tmpfiles; exit 1; } + +tmpfiles="$tmpfiles xg-pl-5.ok" +cat < xg-pl-5.ok +msgid "help" +msgstr "" + +#. TRANSLATORS: This is an extracted comment. +msgid "me" +msgstr "" + +msgid "Hey Jude" +msgstr "" + +#. TRANSLATORS: +#. Nickname of the Beatles +msgid "The Fabulous Four" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-pl-5.ok xg-pl-5.po +result=$? + +rm -fr $tmpfiles + +exit $result diff --git a/gettext-tools/tests/xgettext-php-1 b/gettext-tools/tests/xgettext-php-1 new file mode 100755 index 000000000..2ba6f5a6f --- /dev/null +++ b/gettext-tools/tests/xgettext-php-1 @@ -0,0 +1,61 @@ +#!/bin/sh + +# Test PHP support: --add-comments option. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles xg-ph-1.php" +cat < xg-ph-1.php + +EOF + +tmpfiles="$tmpfiles xg-ph-1.po" +: ${XGETTEXT=xgettext} +${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \ + xg-ph-1.php -d xg-ph-1 +test $? = 0 || { rm -fr $tmpfiles; exit 1; } + +tmpfiles="$tmpfiles xg-ph-1.ok" +cat < xg-ph-1.ok +msgid "help" +msgstr "" + +#. TRANSLATORS: This is an extracted comment. +msgid "me" +msgstr "" + +#. TRANSLATORS: This is extracted too. +msgid "and you" +msgstr "" + +msgid "Hey Jude" +msgstr "" + +#. TRANSLATORS: +#. Nickname of the Beatles +#. +msgid "The Fabulous Four" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-ph-1.ok xg-ph-1.po +result=$? + +rm -fr $tmpfiles + +exit $result diff --git a/gettext-tools/tests/xgettext-python-2 b/gettext-tools/tests/xgettext-python-2 new file mode 100755 index 000000000..22518b722 --- /dev/null +++ b/gettext-tools/tests/xgettext-python-2 @@ -0,0 +1,51 @@ +#!/bin/sh + +# Test Python support: --add-comments option. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles xg-py-2.py" +cat < xg-py-2.py +# This comment will not be extracted. +print gettext.gettext("help") +# TRANSLATORS: This is an extracted comment. +print gettext.gettext("me") +# Not extracted either. +print gettext.gettext("Hey Jude") +# TRANSLATORS: +# Nickname of the Beatles +print gettext.gettext("The Fabulous Four") +EOF + +tmpfiles="$tmpfiles xg-py-2.po" +: ${XGETTEXT=xgettext} +${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \ + xg-py-2.py -d xg-py-2 +test $? = 0 || { rm -fr $tmpfiles; exit 1; } + +tmpfiles="$tmpfiles xg-py-2.ok" +cat < xg-py-2.ok +msgid "help" +msgstr "" + +#. TRANSLATORS: This is an extracted comment. +msgid "me" +msgstr "" + +msgid "Hey Jude" +msgstr "" + +#. TRANSLATORS: +#. Nickname of the Beatles +msgid "The Fabulous Four" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-py-2.ok xg-py-2.po +result=$? + +rm -fr $tmpfiles + +exit $result diff --git a/gettext-tools/tests/xgettext-sh-2 b/gettext-tools/tests/xgettext-sh-2 new file mode 100755 index 000000000..395ed8307 --- /dev/null +++ b/gettext-tools/tests/xgettext-sh-2 @@ -0,0 +1,51 @@ +#!/bin/sh + +# Test Shell support: --add-comments option. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles xg-sh-2.sh" +cat < xg-sh-2.sh +# This comment will not be extracted. +gettext "help" +# TRANSLATORS: This is an extracted comment. +gettext "me" +# Not extracted either. +gettext "Hey Jude" +# TRANSLATORS: +# Nickname of the Beatles +gettext "The Fabulous Four" +EOF + +tmpfiles="$tmpfiles xg-sh-2.po" +: ${XGETTEXT=xgettext} +${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \ + xg-sh-2.sh -d xg-sh-2 +test $? = 0 || { rm -fr $tmpfiles; exit 1; } + +tmpfiles="$tmpfiles xg-sh-2.ok" +cat < xg-sh-2.ok +msgid "help" +msgstr "" + +#. TRANSLATORS: This is an extracted comment. +msgid "me" +msgstr "" + +msgid "Hey Jude" +msgstr "" + +#. TRANSLATORS: +#. Nickname of the Beatles +msgid "The Fabulous Four" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-sh-2.ok xg-sh-2.po +result=$? + +rm -fr $tmpfiles + +exit $result diff --git a/gettext-tools/tests/xgettext-smalltalk-1 b/gettext-tools/tests/xgettext-smalltalk-1 new file mode 100755 index 000000000..669559086 --- /dev/null +++ b/gettext-tools/tests/xgettext-smalltalk-1 @@ -0,0 +1,53 @@ +#!/bin/sh + +# Test Smalltalk support: --add-comments option. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles xg-st-1.st" +cat < xg-st-1.st +"This comment will not be extracted." +Transcript showCr: (NLS ? 'help'). +" TRANSLATORS: This is an extracted comment." +Transcript showCr: (NLS ? 'me'). +"Not extracted either." +Transcript showCr: (NLS ? 'Hey Jude'). +"TRANSLATORS: + Nickname of the Beatles +" +Transcript showCr: (NLS ? 'The Fabulous Four'). +EOF + +tmpfiles="$tmpfiles xg-st-1.po" +: ${XGETTEXT=xgettext} +${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \ + xg-st-1.st -d xg-st-1 +test $? = 0 || { rm -fr $tmpfiles; exit 1; } + +tmpfiles="$tmpfiles xg-st-1.ok" +cat < xg-st-1.ok +msgid "help" +msgstr "" + +#. TRANSLATORS: This is an extracted comment. +msgid "me" +msgstr "" + +msgid "Hey Jude" +msgstr "" + +#. TRANSLATORS: +#. Nickname of the Beatles +#. +msgid "The Fabulous Four" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-st-1.ok xg-st-1.po +result=$? + +rm -fr $tmpfiles + +exit $result diff --git a/gettext-tools/tests/xgettext-tcl-2 b/gettext-tools/tests/xgettext-tcl-2 new file mode 100755 index 000000000..b572b5ee5 --- /dev/null +++ b/gettext-tools/tests/xgettext-tcl-2 @@ -0,0 +1,51 @@ +#!/bin/sh + +# Test Tcl support: --add-comments option. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles xg-t-2.tcl" +cat < xg-t-2.tcl +# This comment will not be extracted. +puts [_ "help"] +# TRANSLATORS: This is an extracted comment. +puts [_ "me"] +# Not extracted either. +puts [_ "Hey Jude"] +# TRANSLATORS: +# Nickname of the Beatles +puts [_ "The Fabulous Four"] +EOF + +tmpfiles="$tmpfiles xg-t-2.po" +: ${XGETTEXT=xgettext} +${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: -k_ \ + xg-t-2.tcl -d xg-t-2 +test $? = 0 || { rm -fr $tmpfiles; exit 1; } + +tmpfiles="$tmpfiles xg-t-2.ok" +cat < xg-t-2.ok +msgid "help" +msgstr "" + +#. TRANSLATORS: This is an extracted comment. +msgid "me" +msgstr "" + +msgid "Hey Jude" +msgstr "" + +#. TRANSLATORS: +#. Nickname of the Beatles +msgid "The Fabulous Four" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-t-2.ok xg-t-2.po +result=$? + +rm -fr $tmpfiles + +exit $result diff --git a/gettext-tools/tests/xgettext-ycp-2 b/gettext-tools/tests/xgettext-ycp-2 new file mode 100755 index 000000000..08d811217 --- /dev/null +++ b/gettext-tools/tests/xgettext-ycp-2 @@ -0,0 +1,59 @@ +#!/bin/sh + +# Test YCP support: --add-comments option. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles xg-y-2.ycp" +cat < xg-y-2.ycp +// This comment will not be extracted. +print (_("help")); +// TRANSLATORS: This is an extracted comment. +print (_("me")); +# TRANSLATORS: This is extracted too. +print (_("and you")); +/* Not extracted either. */ +print (_("Hey Jude")); +/* TRANSLATORS: + Nickname of the Beatles +*/ +print (_("The Fabulous Four")); +EOF + +tmpfiles="$tmpfiles xg-y-2.po" +: ${XGETTEXT=xgettext} +${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \ + xg-y-2.ycp -d xg-y-2 +test $? = 0 || { rm -fr $tmpfiles; exit 1; } + +tmpfiles="$tmpfiles xg-y-2.ok" +cat < xg-y-2.ok +msgid "help" +msgstr "" + +#. TRANSLATORS: This is an extracted comment. +msgid "me" +msgstr "" + +#. TRANSLATORS: This is extracted too. +msgid "and you" +msgstr "" + +msgid "Hey Jude" +msgstr "" + +#. TRANSLATORS: +#. Nickname of the Beatles +#. +msgid "The Fabulous Four" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-y-2.ok xg-y-2.po +result=$? + +rm -fr $tmpfiles + +exit $result