blob: 342a2e58c12614f9d9c3e3cd6645cf8b72657326 [file] [log] [blame]
#! /bin/sh
# Copyright (C) 2010 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Check the creation of compiled message catalogs in C# format.
. ./defs || Exit 1
set -e
cat > Makefile.am << 'END'
pkglibdir = $(libdir)/$(PACKAGE)
pkglib_POTS = posub/foo-bar.pot
posub_foo_bar_pot_SOURCES = src/main.cs
posub_foo_bar_pot_LINGUAS = de fr_CA@latin
posub_foo_bar_pot_CATALOGFORMAT = resources.dll
EXTRA_DIST = src/main.cs
END
cat >> configure.in << 'END'
AM_POT_TOOLS
AC_OUTPUT
END
mkdir src
cat > src/main.cs << 'END'
using System; /* String, Console */
using GNU.Gettext; /* GettextResourceManager */
public class Hello {
public static void Main (String[] args) {
GettextResourceManager catalog =
new GettextResourceManager("foo-bar");
Console.WriteLine(catalog.GetString("Hello, world!"));
}
}
END
$ACLOCAL
$AUTOMAKE -a
$AUTOCONF
# .po files for _LINGUAS.
mkdir posub
cat > posub/foo-bar-de.po << 'END'
msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "Hello, world!"
msgstr "Hallo Welt!"
END
cat > posub/foo-bar-fr_CA@latin.po << 'END'
msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "Hello, world!"
msgstr "Salut, le monde!"
END
# A .po file not listed among _LINGUAS, and a junk .resources.dll file.
cat > posub/foo-bar-es.po << 'END'
msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "Hello, world!"
msgstr "Adiós, mundo!"
END
mkdir posub/es
cat > posub/es/foo-bar.resources.dll << 'END'
junk
END
cat > expected << 'END'
# SOME DESCRIPTIVE TITLE.
# This file is put in the public domain.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pot-format-csharp1 1.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/main.cs:7
msgid "Hello, world!"
msgstr ""
END
distdir=$me-1.0
for builddir in . sub; do
for config_options in '' 'LINGUAS="es de"'; do
if test $builddir = '.'; then
sourcedir='.'
else
sourcedir='..'
mkdir $builddir
fi
instdir="`pwd`/instdir"
cd $builddir
env $config_options $sourcedir/configure --prefix="$instdir"
$MAKE
# Check that "make install" creates the expected .pot file, .po files
# and .resources.dll files.
# (They are created under $sourcedir, because the files are distributed.
# Cf. the GNU standards, node "Makefile Basics".)
$MAKE install
test -f $sourcedir/posub/foo-bar.pot
test $builddir = '.' || test ! -r posub/foo-bar.pot
grep -v 'POT-Creation-Date' $sourcedir/posub/foo-bar.pot | LC_ALL=C tr -d '\r' > actual
diff actual $sourcedir/expected
rm -f actual
test -f $sourcedir/posub/foo-bar-de.po
test ! -r $sourcedir/posub/foo-bar-de.resources.dll
test -f $sourcedir/posub/de/foo-bar.resources.dll
test -f $sourcedir/posub/foo-bar-fr_CA@latin.po
test ! -r $sourcedir/posub/foo-bar-fr_CA@latin.resources.dll
test -f $sourcedir/posub/fr-CA-Latn/foo-bar.resources.dll
test ! -r $sourcedir/posub/foo-bar-de.mo
test ! -r $sourcedir/posub/foo-bar-fr_CA@latin.mo
if test -z "$config_options"; then
# Check that "make install" installed de,po and fr_CA@latin.po but not es.po.
test -f "$instdir"/lib/pot-format-csharp1/de/foo-bar.resources.dll
test -f "$instdir"/lib/pot-format-csharp1/fr-CA-Latn/foo-bar.resources.dll
test ! -r "$instdir"/lib/pot-format-csharp1/es/foo-bar.resources.dll
else
# Check that "make install" installed de.po but not fr_CA@latin.po nor es.po.
test -f "$instdir"/lib/pot-format-csharp1/de/foo-bar.resources.dll
test ! -r "$instdir"/lib/pot-format-csharp1/fr-CA-Latn/foo-bar.resources.dll
test ! -r "$instdir"/lib/pot-format-csharp1/es/foo-bar.resources.dll
fi
test ! -r "$instdir"/share/locale/de/LC_MESSAGES/foo-bar.resources.dll
test ! -r "$instdir"/share/locale/fr_CA@latin/LC_MESSAGES/foo-bar.resources.dll
test ! -r "$instdir"/share/locale/es/LC_MESSAGES/foo-bar.resources.dll
test ! -r "$instdir"/share/locale/de/LC_MESSAGES/foo-bar.mo
test ! -r "$instdir"/share/locale/fr_CA@latin/LC_MESSAGES/foo-bar.mo
test ! -r "$instdir"/share/locale/es/LC_MESSAGES/foo-bar.mo
# Check that "make distdir" creates the expected .pot file.
rm -f $sourcedir/posub/foo-bar.pot
$MAKE distdir
test -f $sourcedir/posub/foo-bar.pot
test $builddir = '.' || test ! -r posub/foo-bar.pot
grep -v 'POT-Creation-Date' $sourcedir/posub/foo-bar.pot | LC_ALL=C tr -d '\r' > actual
diff actual $sourcedir/expected
rm -f actual
test -f $sourcedir/posub/foo-bar-de.po
test ! -r $sourcedir/posub/foo-bar-de.resources.dll
test -f $sourcedir/posub/de/foo-bar.resources.dll
test -f $sourcedir/posub/foo-bar-fr_CA@latin.po
test ! -r $sourcedir/posub/foo-bar-fr_CA@latin.resources.dll
test -f $sourcedir/posub/fr-CA-Latn/foo-bar.resources.dll
test ! -r $sourcedir/posub/foo-bar-de.mo
test ! -r $sourcedir/posub/foo-bar-fr_CA@latin.mo
# Check that the tarball contains posub/foo-bar-{de,fr}.{po,resources.dll}
# but not the others, regardless whether LINGUAS was specified or not.
test -d $distdir # sanity check
test -f $distdir/posub/foo-bar-de.po
test -f $distdir/posub/de/foo-bar.resources.dll
test -f $distdir/posub/foo-bar-fr_CA@latin.po
test -f $distdir/posub/fr-CA-Latn/foo-bar.resources.dll
test ! -r $distdir/posub/foo-bar-es.po
test ! -r $distdir/posub/es/foo-bar.resources.dll
test ! -r $distdir/posub/foo-bar-de.mo
test ! -r $distdir/posub/foo-bar-fr_CA@latin.mo
test ! -r $distdir/posub/foo-bar-es.mo
# Sanity check.
$MAKE distcheck
# Clean up.
$MAKE distclean
rm -rf "$instdir"
cd $sourcedir
done
done
: