On Sat, Oct 06, 2007 at 05:09:15PM +0200, Bruno Haible wrote: > Michael Geng wrote: > > My intention is in fact to invoke xgettext on the parser files which > > genparse generates. ... You can watch the genparse > > generated parser for it from > > http://genparse.sourceforge.net/examples/wc_clp.c. > > OK, this kind of generated code is not bad; it's acceptable to have > translators look at it. > > But there are still two problems: > > 1) The gettext documentation [1] recommends to not make the _() arguments > unnecessarily large. > > printf (_("\ > --files0-from=F read input from the files specified by\n\ > NUL-terminated names in file F\n\ > -L, --max-line-length print the length of the longest line\n\ > -w, --words print the word counts\n")); > > This is too large. When the maintainer adds another option, the translator > should not have to re-proofread the 3 existing options. So you should better > generate code like this:
The text is partitioned exactly as it is in the existing code of tail.c (I'm looking at a cvs archive copy from sept 9). This is from tail.c: fputs (_("\ --files0-from=F read input from the files specified by\n\ NUL-terminated names in file F\n\ -L, --max-line-length print the length of the longest line\n\ -w, --words print the word counts\n\ "), stdout); --------------------------------------------- > printf (_("\ > --files0-from=F read input from the files specified by\n\ > NUL-terminated names in file F\n")); > printf (_("\ > -L, --max-line-length print the length of the longest line\n")); > printf (_("\ > -w, --words print the word counts\n")); Genparse could easily generate the above code if you added more __NEW_PRINT__ directives to the genparse file like this: NONE / files0-from=F string "read input from the files specified by" " NUL-terminated names in file F__NEW_PRINT__" L / max-line-length flag "print the length of the longest line__NEW_PRINT__" w / words flag "print the word counts__NEW_PRINT__" > 2) What about translator comments? How can a maintainer provide > additional information for the translators? Does this work? > > /* TRANSLATORS: the length here is actually the screen width */ > L / max-line-length flag "print the length of the longest line" > > > /* TRANSLATORS: Keep the colons aligned. */ > Usage: __PROGRAM_NAME__ [OPTION]... [FILE]... > or: __PROGRAM_NAME__ [OPTION]... --files0-from=F__NEW_PRINT__ > > > Bruno > > > [1] > http://www.gnu.org/software/gettext/manual/html_node/Preparing-Strings.html That could be a reason for a new directive in the genparse file. When I grep for "TRANSLATORS" in the coreutils src/ directory I can find only 3 hits however and none of them is directly in the command line parsing code. system.h contains a TRANSLATORS comment in the emit_bug_reporting_address () function but that can stay as it is because genparse only instanstiates the call to emit_bug_reporting_address () (see e.g. http://genparse.sourceforge.net/examples/wc_clp.c). Do you see more examples of translator comments in the coreutils code for which you think genparse should handle them? Michael _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils