[PATCH] Don't embed URLs in translation strings

Timofei Zhakov <[email protected]>
Newsgroups gmane.comp.version-control.subversion.devel
Message-ID <CAPD1kXQCOoX0h90uRYKhEZxJWnSWoVR1weKLgDieveH3dR9mPQ@mail.gmail.com>
I noticed that there are a few warnings when rolling a tar-ball related to
localisation:

[[[
../libsvn_subr/version.c:147: warning: Message contains an embedded URL.
Better move it out of the translatable string, see
https://www.gnu.org/software/gettext/manual/html_node/No-embedded-URLs.html
../svn/help-cmd.c:93: warning: Message contains an embedded URL.  Better
move it out of the translatable string, see
https://www.gnu.org/software/gettext/manual/html_node/No-embedded-URLs.html
../libsvn_fs_fs/fs_fs.c:445: warning: Message contains an embedded URL.
Better move it out of the translatable string, see
https://www.gnu.org/software/gettext/manual/html_node/No-embedded-URLs.html
../libsvn_wc/wc_db_wcroot.c:329: warning: Message contains an embedded
URL.  Better move it out of the translatable string, see
https://www.gnu.org/software/gettext/manual/html_node/No-embedded-URLs.html
]]]

Seems like it's not the best practice to have strings that carry the URL
directly but they rather suggest to sprintf/printf it into it later. I
think it makes sense.

The question that I have is do we really care or it'd mess it up even more.
I assume it's better to update the PO files in the same commit (which
should be a simple find and replace but I didn't include it in the patch).

-- 
Timofei Zhakov
svn-translation-urls.patch.txt (text/plain, 3.4 KB)
Index: subversion/libsvn_fs_fs/fs_fs.c
===================================================================
--- subversion/libsvn_fs_fs/fs_fs.c	(revision 1936141)
+++ subversion/libsvn_fs_fs/fs_fs.c	(working copy)
@@ -443,10 +443,9 @@ check_format(int format)
   if (format == SVN_FS_FS__PACKED_REVPROP_SQLITE_DEV_FORMAT)
     return svn_error_createf(SVN_ERR_FS_UNSUPPORTED_FORMAT, NULL,
                              _("Found format '%d', only created by "
-                               "unreleased dev builds; see "
-                               "https://subversion.apache.org"
-                               "/docs/release-notes/1.7#revprop-packing"),
-                             format);
+                               "unreleased dev builds; see %s"),
+                             format, "https://subversion.apache.org"
+                             "/docs/release-notes/1.7#revprop-packing");
 
   /* We support all formats from 1-current simultaneously */
   if (1 <= format && format <= SVN_FS_FS__FORMAT_NUMBER)
Index: subversion/libsvn_subr/version.c
===================================================================
--- subversion/libsvn_subr/version.c	(revision 1936141)
+++ subversion/libsvn_subr/version.c	(working copy)
@@ -143,12 +143,12 @@ svn_version_extended(svn_boolean_t verbose,
   info->build_date = __DATE__;
   info->build_time = __TIME__;
   info->build_host = SVN_BUILD_HOST;
-  info->copyright = apr_pstrdup
+  info->copyright = apr_psprintf
     (pool, _("Copyright (C) 2026 The Apache Software Foundation.\n"
              "This software consists of contributions made by many people;\n"
              "see the NOTICE file for more information.\n"
-             "Subversion is open source software, see "
-             "https://subversion.apache.org/\n"));
+             "Subversion is open source software, see %s\n"),
+     "https://subversion.apache.org/");
 
   if (verbose)
     {
Index: subversion/libsvn_wc/wc_db_wcroot.c
===================================================================
--- subversion/libsvn_wc/wc_db_wcroot.c	(revision 1936141)
+++ subversion/libsvn_wc/wc_db_wcroot.c	(working copy)
@@ -329,10 +329,10 @@ svn_wc__db_pdh_create_wcroot(svn_wc__db_wcroot_t *
         _("This client is too old to work with the working copy at\n"
           "'%s' (format %d).\n"
           "You need to get a newer Subversion client. For more details, see\n"
-          "  https://subversion.apache.org/faq.html#working-copy-format-change\n"
-          ),
+          "  %s\n"),
         svn_dirent_local_style(wcroot_abspath, scratch_pool),
-        format);
+        format,
+        "https://subversion.apache.org/faq.html#working-copy-format-change");
     }
 
   /* Verify that no work items exists. If they do, then our integrity is
Index: subversion/svn/help-cmd.c
===================================================================
--- subversion/svn/help-cmd.c	(revision 1936141)
+++ subversion/svn/help-cmd.c	(working copy)
@@ -89,9 +89,10 @@ svn_cl__help(apr_getopt_t *os,
      "\n"
      "Available subcommands:\n");
 
-  char help_footer[] =
-  N_("Subversion is a tool for version control.\n"
-     "For additional information, see https://subversion.apache.org/\n");
+  char *help_footer = apr_psprintf(pool, N_(
+        "Subversion is a tool for version control.\n"
+        "For additional information, see %s\n"),
+        "https://subversion.apache.org/");
 
   if (baton)
     {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.