]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Change some tests to give more insights.
authorBruno Haible <bruno@clisp.org>
Wed, 14 Jun 2023 13:06:34 +0000 (15:06 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 15 Jun 2023 09:26:58 +0000 (11:26 +0200)
* gettext-tools/tests/format-c-3-prg.c (_): Remove macro.
(main): Test also a simple translation.
* gettext-tools/tests/format-c-4-prg.c: Likewise.
* gettext-tools/tests/format-c-5-prg.c: Likewise.
* gettext-tools/tests/format-c-3: Update.
* gettext-tools/tests/format-c-4: Likewise.
* gettext-tools/tests/format-c-5: Likewise.

gettext-tools/tests/format-c-3
gettext-tools/tests/format-c-3-prg.c
gettext-tools/tests/format-c-4
gettext-tools/tests/format-c-4-prg.c
gettext-tools/tests/format-c-5
gettext-tools/tests/format-c-5-prg.c

index 3fb9c370375cc067c44a9906fb8fa015d5aaf29d..ce60c578aa804321d8557ccae57204a55b01ec0e 100755 (executable)
@@ -8,6 +8,9 @@ ${XGETTEXT} -o fc3.tmp --omit-header --no-location "$wabs_srcdir"/format-c-3-prg
 LC_ALL=C tr -d '\r' < fc3.tmp > fc3.pot || Exit 1
 
 cat <<EOF > fc3.ok
+msgid "the president"
+msgstr ""
+
 #, c-format
 msgid "father of %<PRId8> children"
 msgstr ""
@@ -17,6 +20,9 @@ EOF
 ${DIFF} fc3.ok fc3.pot || Exit 1
 
 cat <<EOF > fc3-de.po
+msgid "the president"
+msgstr "der Vorsitzende"
+
 #, c-format
 msgid "father of %<PRId8> children"
 msgstr "Vater von %<PRId8> Kindern"
index 804d468d5b33159e893ac9ae45921ea8ac40f08c..4725e591af41a3ab2015696d7521778ab6c9cf17 100644 (file)
@@ -1,5 +1,5 @@
 /* Test program, used by the format-c-3 test.
-   Copyright (C) 2002, 2009, 2013, 2018, 2020 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2009, 2013, 2018, 2020, 2023 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
@@ -45,8 +45,6 @@
 extern char *setlocale (int category, const char *locale);
 #endif
 
-#define _(string) gettext (string)
-
 /* Fallback definition.  */
 #if !defined PRId8
 # define PRId8 "d"
@@ -71,6 +69,12 @@ main (int argc, char *argv[])
   textdomain ("fc3");
   bindtextdomain ("fc3", "fc3-dir");
 
+  if (strcmp (gettext ("the president"), "der Vorsitzende") != 0)
+    {
+      fprintf (stderr, "Simple messages not translated.\n");
+      exit (1);
+    }
+
   s = gettext ("father of %"PRId8" children");
   c1 = "Vater von %"; c2 = " Kindern";
 
index accd1173c2db72f3d73d3e06c0c4026dd018a20d..37f871fa5769acff3ed6b8b558eea1694309454c 100755 (executable)
@@ -8,6 +8,9 @@ ${XGETTEXT} -o fc4.tmp --omit-header --no-location "$wabs_srcdir"/format-c-4-prg
 LC_ALL=C tr -d '\r' < fc4.tmp > fc4.pot || Exit 1
 
 cat <<EOF > fc4.ok
+msgid "the president"
+msgstr ""
+
 #, c-format
 msgid "father of %<PRId8> child"
 msgid_plural "father of %<PRId8> children"
@@ -19,6 +22,9 @@ EOF
 ${DIFF} fc4.ok fc4.pot || Exit 1
 
 cat <<EOF > fc4-de.po
+msgid "the president"
+msgstr "der Vorsitzende"
+
 #, c-format
 msgid "father of %<PRId8> child"
 msgid_plural "father of %<PRId8> children"
index 4dac6af79ad2cfddc822f9cf9d31ec346bebfbe5..754b66ce8683eef055a388fd4d9cc2ebdb2cb9f6 100644 (file)
@@ -1,5 +1,5 @@
 /* Test program, used by the format-c-4 test.
-   Copyright (C) 2002, 2009, 2013, 2018, 2020 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2009, 2013, 2018, 2020, 2023 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
@@ -45,8 +45,6 @@
 extern char *setlocale (int category, const char *locale);
 #endif
 
-#define _(string) gettext (string)
-
 /* Fallback definition.  */
 #if !defined PRId8
 # define PRId8 "d"
@@ -71,6 +69,12 @@ main (int argc, char *argv[])
   textdomain ("fc4");
   bindtextdomain ("fc4", "fc4-dir");
 
+  if (strcmp (gettext ("the president"), "der Vorsitzende") != 0)
+    {
+      fprintf (stderr, "Simple messages not translated.\n");
+      exit (1);
+    }
+
   s = ngettext ("father of %"PRId8" child", "father of %"PRId8" children", n);
   c1 = "Vater von %"; c2 = " Kindern";
 
index b8111eed357969a945f86b7db34011f0f347a519..d0cba225c2d4e3db1de342ecf2c44ef645bb29f2 100755 (executable)
@@ -8,6 +8,9 @@ ${XGETTEXT} -o fc5.tmp --omit-header --no-location "$wabs_srcdir"/format-c-5-prg
 LC_ALL=C tr -d '\r' < fc5.tmp > fc5.pot || Exit 1
 
 cat <<EOF > fc5.ok
+msgid "the president"
+msgstr ""
+
 #, c-format
 msgid "father of %d children"
 msgstr ""
@@ -18,6 +21,9 @@ ${DIFF} fc5.ok fc5.pot || Exit 1
 
 # This should better be Farsi, not German. Can some translator help me?
 cat <<EOF > fa.po
+msgid "the president"
+msgstr "der Vorsitzende"
+
 #, c-format
 msgid "father of %d children"
 msgstr "Vater von %Id Kindern"
index 9efffacd1a01c6a96e92607c1818b586955ca3a5..eacbbf91a51f973afeac96a253ff2bbc910350c6 100644 (file)
@@ -1,5 +1,5 @@
 /* Test program, used by the format-c-5 test.
-   Copyright (C) 2004, 2006, 2010, 2018 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006, 2010, 2018, 2023 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
@@ -38,8 +38,6 @@
 # include "libgnuintl.h"
 #endif
 
-#define _(string) gettext (string)
-
 int
 main (int argc, char *argv[])
 {
@@ -58,6 +56,12 @@ main (int argc, char *argv[])
   textdomain ("fc5");
   bindtextdomain ("fc5", ".");
 
+  if (strcmp (gettext ("the president"), "der Vorsitzende") != 0)
+    {
+      fprintf (stderr, "Simple messages not translated.\n");
+      exit (1);
+    }
+
   s = gettext ("father of %d children");
   en = "father of %d children";
 #if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) && !defined __UCLIBC__
@@ -70,7 +74,7 @@ main (int argc, char *argv[])
 
   if (strcmp (s, en) == 0)
     {
-      fprintf (stderr, "String untranslated.\n");
+      fprintf (stderr, "String not translated.\n");
       exit (1);
     }
   if (strcmp (s, expected_translation) != 0)