On 26/01/2026 16:01, [email protected] wrote:

Op 25-01-2026 om 22:08 schreef Pádraig Brady:
Another existing issue I noticed in a few places in hu.po
(and some other translations), is inadequate separation
between the --option and description.

Well, I sometimes choose to use just one space when otherwise
there is not enough room for the description to fit (in 80 columns)
or to align nicely with the surrounding ones.  So I think it should
be the prerogative of the translator to layout their texts as they
see fit.


(With the new format -- option and description on separate lines --
there will seldom be a need for the translator to choose an adjusted
layout, and the problem with too few spaces will probably go away.)

OK I agree.

This will impact man page layout if one was generating
those for various languages.

Are there actually any man pages generated from --help texts?

Well all the default ones of course.
But they're not impacted.
I presume there are lang specific man pages available,
though I've not looked TBH.
Anyway given help2man will follow our generated highlighting
the man pages will also be fine following this patch.

Also it would impact
the new option highlighting in --help.

Can that highlighting not be made to work when there is only
one space between option and description?

I'll apply the attached to our highlighting matcher,
which makes --long-option matching a bit more strict,
thus avoiding the issue.

thanks,
Padraig
From f2af245ebaf88c15f236217b6d43cefcff0eda43 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Tue, 27 Jan 2026 17:45:02 +0000
Subject: [PATCH] doc: improve highlighting of single spaced translations

* src/system.h (oputs_): Translations sometimes use a single space
between an option and its description.  They only do this though
for long options since they result in less available screen space.
Therefore be more strict with option matching once we've encountered
a long option, which supports the more varied formats often
associated with short options.
---
 src/system.h | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/system.h b/src/system.h
index 3695954db..7e1fdbff0 100644
--- a/src/system.h
+++ b/src/system.h
@@ -567,7 +567,6 @@ oputs_ (MAYBE_UNUSED char const* program, char const *option)
       return;
     }
 
-
   char const* first_word = option + strspn (option, " \t\n");
   char const *option_text = strchr (option, '-');
   if (!option_text)
@@ -577,11 +576,24 @@ oputs_ (MAYBE_UNUSED char const* program, char const *option)
   /* Set highlighted text up to spacing after the full option text.
      Any single space is included in highlighted text,
      double space or TAB or newline terminates the option text.  */
+  bool long_option = false;
   char const *desc_text = option_text + anchor_len;
-  while (*desc_text && *desc_text != '\n'
-         && (! isspace (*desc_text)
-             || (*desc_text != '\t' && ! isspace (*(desc_text + 1)))))
-    desc_text++;
+  while (*desc_text && *desc_text != '\n')
+    {
+      if (*desc_text == '-' && *(desc_text + 1) == '-')
+        long_option = true;
+      if (isspace (*desc_text))
+        {
+          if (*desc_text == '\t' || isspace (*(desc_text + 1)))
+            break;
+          /* With long options we restrict the match as some translations
+             delimit a long option and description with a single space.  */
+          if (long_option && *(desc_text + 1) != '-')
+            break;
+        }
+
+      desc_text++;
+    }
 
   /* write spaces before option text. */
   fwrite (option, 1, first_word - option, stdout);
-- 
2.52.0

Reply via email to