On Mon, Nov 2, 2015, at 16:41, Chet Ramey wrote:
> On 10/19/15 3:07 PM, Benno Schulenberg wrote:
> > As the command synopses are gettextized only in order to allow
> > translators to translate *possible arguments*, there is no need to
> > gettextize them when a command takes no options nor arguments.
> 
> Well, the short docs are marked with N_ in the generated builtins.c,
> but I guess the gettext tools aren't smart enough to not put them in
> the pot files.

??  But they *should* be in the POT file, at least most of them.
What I'm saying is:

> > Would it be possible to change the script that converts the *.def
> > files into a builtins.c in such a way that when $BUILTIN == $SHORT_DOC
> > the $SHORT_DOC is not gettextized?

When the BUILTIN string in a def file equals the SHORT_DOC string in
the def file, there is no need to gettextize that string, because
apparently the command does not take any argument.

> That's a C program.  It might be better to just not run the short doc
> through gettext in builtin_help().

Well, that would be suboptimal: the strings would still be in the
POT file, they just wouldn't get used.  The change I meant was as
in the attached patch (not adjusted for whitespace).

Benno

-- 
http://www.fastmail.com - mmm... Fastmail...

From e8e2b53ef651b86c0b59dff08ec5ddeef81f04cd Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensb...@justemail.net>
Date: Mon, 2 Nov 2015 19:30:12 +0100
Subject: [PATCH] don't mark as translatable commands that take no arguments

Signed-off-by: Benno Schulenberg <bensb...@justemail.net>
---
 builtins/mkbuiltins.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/builtins/mkbuiltins.c b/builtins/mkbuiltins.c
index 6f556a4..0ccba5e 100644
--- a/builtins/mkbuiltins.c
+++ b/builtins/mkbuiltins.c
@@ -1246,6 +1246,17 @@ write_builtins (defs, structfile, externfile)
 		    (builtin->flags & BUILTIN_FLAG_POSIX_BUILTIN) ? " | POSIX_BUILTIN" : "",
 		    document_name (builtin));
 
+	if (builtin->shortdoc == builtin->name) {
+		  if (inhibit_functions)
+		    fprintf
+		      (structfile, "     \"%s\", \"%s\" },\n",
+		       builtin->shortdoc ? builtin->shortdoc : builtin->name,
+		       document_name (builtin));
+		  else
+		    fprintf
+		      (structfile, "     \"%s\", (char *)NULL },\n",
+		       builtin->shortdoc ? builtin->shortdoc : builtin->name);
+	} else {
 		  if (inhibit_functions)
 		    fprintf
 		      (structfile, "     N_(\"%s\"), \"%s\" },\n",
@@ -1255,7 +1266,7 @@ write_builtins (defs, structfile, externfile)
 		    fprintf
 		      (structfile, "     N_(\"%s\"), (char *)NULL },\n",
 		       builtin->shortdoc ? builtin->shortdoc : builtin->name);
-
+	}
 		}
 
 	      if (structfile || separate_helpfiles)
-- 
1.7.0.4

Reply via email to