NetBSD/gnu/dist/gettext/tests/xgettext-8

92 lines
1.7 KiB
Bash

#! /bin/sh
trap 'rm -fr $tmpfiles' 1 2 3 15
tmpfiles="$tmpfiles xg-test8.in.po xg-test8.c xg-test8.cc"
cat <<EOF > xg-test8.in.po
#: file1.c:199
#, fuzzy
msgid "extract me"
msgstr "some text to get fuzzy copied to result"
#: file2.cc:200
msgid "what about me"
msgstr ""
#: file3.c:10
#, c-format, fuzzy
msgid "hello"
msgstr "Again some text for fuzzy"
EOF
cat <<EOF > xg-test8.c
#include <libintl.h>
#include <stdio.h>
int
main (int argc, char *argv[])
{
printf (dcgettext ("hello", "Hello, world."));
return 0;
}
EOF
cat <<EOF > xg-test8.cc
#include <iostream.h>
#include <libintl.h>
#include <locale.h>
int
main (int argc, char *argv[])
{
cout << dcgettext ("hello", "Hello world!", LC_MESSAGES) << endl;
return 0;
}
EOF
tmpfiles="$tmpfiles xg-test8.po"
: ${XGETTEXT=xgettext}
${XGETTEXT} --omit-header -n xg-test8.in.po \
xg-test8.c xg-test8.cc -d xg-test8
tmpfiles="$tmpfiles xg-test8.ok"
cat <<EOF > xg-test8.ok
#: file1.c:199
#, fuzzy
msgid "extract me"
msgstr "some text to get fuzzy copied to result"
#: file2.cc:200
msgid "what about me"
msgstr ""
#: file3.c:10
#, fuzzy, c-format
msgid "hello"
msgstr "Again some text for fuzzy"
#: xg-test8.c:6
msgid "Hello, world."
msgstr ""
#: xg-test8.cc:7
msgid "Hello world!"
msgstr ""
EOF
: ${DIFF=diff}
${DIFF} xg-test8.ok xg-test8.po
result=$?
rm -fr $tmpfiles
exit $result
# Preserve executable bits for this shell script.
# Thanks to Noah Friedman for this great trick.
Local Variables:
eval:(defun frobme () (set-file-modes buffer-file-name file-mode))
eval:(make-local-variable 'file-mode)
eval:(setq file-mode (file-modes (buffer-file-name)))
eval:(make-local-variable 'after-save-hook)
eval:(add-hook 'after-save-hook 'frobme)
End: