Blame gettext-tools/tests/xgettext-po-1

Packit Bot 06c835
#! /bin/sh
Packit Bot 06c835
. "${srcdir=.}/init.sh"; path_prepend_ . ../src
Packit Bot 06c835
Packit Bot 06c835
# Test C, C++, PO extractors.
Packit Bot 06c835
Packit Bot 06c835
cat <<EOF > xg-po-1.in.po
Packit Bot 06c835
#: file1.c:199
Packit Bot 06c835
#, fuzzy
Packit Bot 06c835
msgid "extract me"
Packit Bot 06c835
msgstr "some text to get fuzzy copied to result"
Packit Bot 06c835
Packit Bot 06c835
#: file2.cc:200
Packit Bot 06c835
msgid "what about me"
Packit Bot 06c835
msgstr ""
Packit Bot 06c835
Packit Bot 06c835
#: file3.c:10
Packit Bot 06c835
#, c-format, fuzzy
Packit Bot 06c835
msgid "hello"
Packit Bot 06c835
msgstr "Again some text for fuzzy"
Packit Bot 06c835
EOF
Packit Bot 06c835
Packit Bot 06c835
cat <<EOF > xg-po-1.c
Packit Bot 06c835
#include <libintl.h>
Packit Bot 06c835
#include <stdio.h>
Packit Bot 06c835
int
Packit Bot 06c835
main (int argc, char *argv[])
Packit Bot 06c835
{
Packit Bot 06c835
  printf (dcgettext ("hello", "Hello, world."));
Packit Bot 06c835
  return 0;
Packit Bot 06c835
}
Packit Bot 06c835
EOF
Packit Bot 06c835
Packit Bot 06c835
cat <<EOF > xg-po-1.cc
Packit Bot 06c835
#include <iostream.h>
Packit Bot 06c835
#include <libintl.h>
Packit Bot 06c835
#include <locale.h>
Packit Bot 06c835
int
Packit Bot 06c835
main (int argc, char *argv[])
Packit Bot 06c835
{
Packit Bot 06c835
  cout << dcgettext ("hello", "Hello world!", LC_MESSAGES) << endl;
Packit Bot 06c835
  return 0;
Packit Bot 06c835
}
Packit Bot 06c835
EOF
Packit Bot 06c835
Packit Bot 06c835
: ${XGETTEXT=xgettext}
Packit Bot 06c835
${XGETTEXT} --omit-header -n \
Packit Bot 06c835
  -d xg-po-1.tmp xg-po-1.in.po xg-po-1.c xg-po-1.cc || exit 1
Packit Bot 06c835
LC_ALL=C tr -d '\r' < xg-po-1.tmp.po > xg-po-1.po || exit 1
Packit Bot 06c835
Packit Bot 06c835
cat <<EOF > xg-po-1.ok
Packit Bot 06c835
#: file1.c:199
Packit Bot 06c835
#, fuzzy
Packit Bot 06c835
msgid "extract me"
Packit Bot 06c835
msgstr "some text to get fuzzy copied to result"
Packit Bot 06c835
Packit Bot 06c835
#: file2.cc:200
Packit Bot 06c835
msgid "what about me"
Packit Bot 06c835
msgstr ""
Packit Bot 06c835
Packit Bot 06c835
#: file3.c:10
Packit Bot 06c835
#, fuzzy, c-format
Packit Bot 06c835
msgid "hello"
Packit Bot 06c835
msgstr "Again some text for fuzzy"
Packit Bot 06c835
Packit Bot 06c835
#: xg-po-1.c:6
Packit Bot 06c835
#, c-format
Packit Bot 06c835
msgid "Hello, world."
Packit Bot 06c835
msgstr ""
Packit Bot 06c835
Packit Bot 06c835
#: xg-po-1.cc:7
Packit Bot 06c835
msgid "Hello world!"
Packit Bot 06c835
msgstr ""
Packit Bot 06c835
EOF
Packit Bot 06c835
Packit Bot 06c835
: ${DIFF=diff}
Packit Bot 06c835
${DIFF} xg-po-1.ok xg-po-1.po
Packit Bot 06c835
result=$?
Packit Bot 06c835
Packit Bot 06c835
exit $result