]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
doc: Move libgettextpo example to the front subsection.
authorMiguel Ángel Arruga Vivas <rosen644835@gmail.com>
Mon, 6 May 2019 11:34:27 +0000 (13:34 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 26 Jul 2020 16:36:29 +0000 (18:36 +0200)
* gettext-tools/doc/gettext.texi (po_message_t API): Move example from
here...
(libgettextpo): ... back to here.

gettext-tools/doc/gettext.texi

index 8a30a827b2c2fbef671064eafbc224adc1e411d6..e40ba14a3c9a68e38e4e5ba32a62c35d15137873 100644 (file)
@@ -5338,6 +5338,42 @@ defined in a library called @samp{libgettextpo}.
 * po_message_t API::            The basic units of the file
 @end menu
 
+Here is an example code how these functions can be used.
+
+@example
+const char *filename = @dots{};
+po_file_t file = po_file_read (filename);
+
+if (file == NULL)
+  error (EXIT_FAILURE, errno, "couldn't open the PO file %s", filename);
+@{
+  const char * const *domains = po_file_domains (file);
+  const char * const *domainp;
+
+  for (domainp = domains; *domainp; domainp++)
+    @{
+      const char *domain = *domainp;
+      po_message_iterator_t iterator = po_message_iterator (file, domain);
+
+      for (;;)
+        @{
+          po_message_t *message = po_next_message (iterator);
+
+          if (message == NULL)
+            break;
+          @{
+            const char *msgid = po_message_msgid (message);
+            const char *msgstr = po_message_msgstr (message);
+
+            @dots{}
+          @}
+        @}
+      po_message_iterator_free (iterator);
+    @}
+@}
+po_file_free (file);
+@end example
+
 @node Error Handling
 @subsection Error Handling
 
@@ -5506,42 +5542,6 @@ The @code{po_message_msgstr_plural} function returns the
 the @var{index} is out of range or for a message without plural.
 @end deftypefun
 
-Here is an example code how these functions can be used.
-
-@example
-const char *filename = @dots{};
-po_file_t file = po_file_read (filename);
-
-if (file == NULL)
-  error (EXIT_FAILURE, errno, "couldn't open the PO file %s", filename);
-@{
-  const char * const *domains = po_file_domains (file);
-  const char * const *domainp;
-
-  for (domainp = domains; *domainp; domainp++)
-    @{
-      const char *domain = *domainp;
-      po_message_iterator_t iterator = po_message_iterator (file, domain);
-
-      for (;;)
-        @{
-          po_message_t *message = po_next_message (iterator);
-
-          if (message == NULL)
-            break;
-          @{
-            const char *msgid = po_message_msgid (message);
-            const char *msgstr = po_message_msgstr (message);
-
-            @dots{}
-          @}
-        @}
-      po_message_iterator_free (iterator);
-    @}
-@}
-po_file_free (file);
-@end example
-
 @node Binaries
 @chapter Producing Binary MO Files