psql: Fix translation marking
authorPeter Eisentraut <[email protected]>
Fri, 8 Apr 2022 13:07:35 +0000 (15:07 +0200)
committerPeter Eisentraut <[email protected]>
Fri, 8 Apr 2022 13:16:33 +0000 (15:16 +0200)
Commit 5a2832465fd8984d089e8c44c094e6900d987fcd added
addFooterToPublicationDesc() as a wrapper around
printTableAddFooter().  The translation marker _() was moved to the
body of addFooterToPublicationDesc(), but addFooterToPublicationDesc()
was not added to GETTEXT_TRIGGERS, so those strings were lost for
translation.  To fix, add the translation markers to the call sites of
addFooterToPublicationDesc() and remove the translation marker from
the body of the function.  This seems easiest since there were only
two callers and it keeps the API consistent with
printTableAddFooter().  While we're here, add some const decorations
to the prototype of addFooterToPublicationDesc() for consistency with
printTableAddFooter().

src/bin/psql/describe.c

index 797ef233c90d5941bf81a6702a5cba8a428a7e91..e8919ab0be2da872cb2d07ac82c6e0a4a07e176d 100644 (file)
@@ -5966,8 +5966,8 @@ listPublications(const char *pattern)
  * Add footer to publication description.
  */
 static bool
-addFooterToPublicationDesc(PQExpBuffer buf, char *footermsg,
-                                                  bool as_schema, printTableContent *cont)
+addFooterToPublicationDesc(PQExpBuffer buf, const char *footermsg,
+                                                  bool as_schema, printTableContent *const cont)
 {
        PGresult   *res;
        int                     count = 0;
@@ -5980,7 +5980,7 @@ addFooterToPublicationDesc(PQExpBuffer buf, char *footermsg,
                count = PQntuples(res);
 
        if (count > 0)
-               printTableAddFooter(cont, _(footermsg));
+               printTableAddFooter(cont, footermsg);
 
        for (i = 0; i < count; i++)
        {
@@ -6149,7 +6149,7 @@ describePublications(const char *pattern)
                                                          "  AND c.oid = pr.prrelid\n"
                                                          "  AND pr.prpubid = '%s'\n"
                                                          "ORDER BY 1,2", pubid);
-                       if (!addFooterToPublicationDesc(&buf, "Tables:", false, &cont))
+                       if (!addFooterToPublicationDesc(&buf, _("Tables:"), false, &cont))
                                goto error_return;
 
                        if (pset.sversion >= 150000)
@@ -6161,7 +6161,7 @@ describePublications(const char *pattern)
                                                                  "     JOIN pg_catalog.pg_publication_namespace pn ON n.oid = pn.pnnspid\n"
                                                                  "WHERE pn.pnpubid = '%s'\n"
                                                                  "ORDER BY 1", pubid);
-                               if (!addFooterToPublicationDesc(&buf, "Tables from schemas:",
+                               if (!addFooterToPublicationDesc(&buf, _("Tables from schemas:"),
                                                                                                true, &cont))
                                        goto error_return;
                        }