Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Baurjan Ismagulov <ibr@ata.cs.hun.edu.tr>,
	gdb-patches@sources.redhat.com
Subject: Re: an i18n sample
Date: Sun, 24 Oct 2004 20:18:00 -0000	[thread overview]
Message-ID: <20041024201802.GA17380@nevyn.them.org> (raw)
In-Reply-To: <01c4b9ff$Blat.v2.2.2$1ebcb860@zahav.net.il>

On Sun, Oct 24, 2004 at 09:23:43PM +0200, Eli Zaretskii wrote:
> > -          fprintf_unfiltered (gdb_stderr, "Type ");
> > +          fprintf_unfiltered (gdb_stderr, _("Type "));
> >            if (type == NULL)
> > -            fprintf_unfiltered (gdb_stderr, "(null)");
> > +            fprintf_unfiltered (gdb_stderr, _("(null)"));
> >            else
> >              type_print (type, "", gdb_stderr, -1);
> > -          error (" is not a structure or union type");
> > +          error (_(" is not a structure or union type"));
> 
> This fragment should be rewritten to use full sentences, like in
> "Type (null) is not a structure or union type", instead of marking
> each part separately.  That way, a translator will be able to
> translate the entire sentence as a single entity, rather than each
> part.  (Translating sentences in parts usually leads to bad
> translations, unless the translator makes an effort to read the
> source.)

I agree about partial translations, of course.  In this particular
case, it looks like the file needs type_sprint or type_to_string.
The type_print interface is unfriendly for i18n.

> > @@ -6005,7 +6005,7 @@ empty_record (struct objfile *objfile)
> >    TYPE_CODE (type) = TYPE_CODE_STRUCT;
> >    TYPE_NFIELDS (type) = 0;
> >    TYPE_FIELDS (type) = NULL;
> > -  TYPE_NAME (type) = "<empty>";
> > +  TYPE_NAME (type) = _("<empty>");
> >    TYPE_TAG_NAME (type) = NULL;
> >    TYPE_FLAGS (type) = 0;
> >    TYPE_LENGTH (type) = 0;

I'm not sure this sort of string should be translated.  I guess it does
no harm (if nothing checks for the string, of course).

> > @@ -6167,8 +6167,8 @@ ada_template_to_fixed_record_type_1 (str
> >       the current RTYPE length might be good enough for our purposes.  */
> >    if (TYPE_LENGTH (type) <= 0)
> >      {
> > -      warning ("Invalid type size for `%s' detected: %d.",
> > -               TYPE_NAME (rtype) ? TYPE_NAME (rtype) : "<unnamed>",
> > +      warning (_("Invalid type size for `%s' detected: %d."),
> > +               TYPE_NAME (rtype) ? TYPE_NAME (rtype) : _("<unnamed>"),
> >                 TYPE_LENGTH (type));
> >      }
> 
> Same here.

Actually, I disagree about this one.  Whether or not "<unnamed>"
should be translated, is there any reason not to translate the format
string?

> > @@ -537,12 +537,12 @@ print_variant_clauses (struct type *type
> >  
> >    for (i = 0; i < TYPE_NFIELDS (var_type); i += 1)
> >      {
> > -      fprintf_filtered (stream, "\n%*swhen ", level + 4, "");
> > +      fprintf_filtered (stream, _("\n%*swhen "), level + 4, "");
> >        print_choices (var_type, i, stream, discr_type);
> >        fprintf_filtered (stream, " =>");
> >        if (print_record_field_types (TYPE_FIELD_TYPE (var_type, i),
> >  				    outer_type, stream, show, level + 4) <= 0)
> > -	fprintf_filtered (stream, " null;");
> > +	fprintf_filtered (stream, _(" null;"));
> >      }
> 
> This also, and in addition I think it plays character-counting games
> that are no-no in translatable messages.

It's only character-counting blank space, to indent appropriately -
since I don't believe it's aligning with an earlier line, it should be
OK.  That said, the "when" is a partial sentence, and the \n%*s doesn't
need to be translated.

-- 
Daniel Jacobowitz


  parent reply	other threads:[~2004-10-24 20:18 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-24 10:45 Baurjan Ismagulov
2004-10-24 19:28 ` Eli Zaretskii
2004-10-24 19:57   ` Baurjan Ismagulov
2004-10-24 20:18   ` Daniel Jacobowitz [this message]
2004-10-25 20:10     ` Eli Zaretskii
2004-10-25 20:20       ` Daniel Jacobowitz
2004-10-26  4:47         ` Eli Zaretskii
2004-10-26 20:02           ` Daniel Jacobowitz
2004-10-27  5:03             ` Eli Zaretskii
2004-10-25 21:59   ` Andrew Cagney
2004-10-26  5:02     ` Eli Zaretskii
2004-10-26  7:54       ` Baurjan Ismagulov
2004-10-26 19:56         ` Eli Zaretskii
2004-10-27 17:28           ` Andrew Cagney
2004-11-27 20:54 ` Baurjan Ismagulov
2004-11-27 22:18   ` Eli Zaretskii
2004-11-27 22:54     ` Baurjan Ismagulov
2004-12-04 19:55     ` Baurjan Ismagulov
2004-12-04 22:31       ` Baurjan Ismagulov
2004-12-12 17:12         ` Andrew Cagney
2004-12-12 18:42           ` Daniel Jacobowitz
2004-12-12 21:07             ` Andrew Cagney
2004-12-13  3:37               ` Eli Zaretskii
2004-12-04 23:04       ` Eli Zaretskii
2004-12-05 23:46     ` Baurjan Ismagulov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041024201802.GA17380@nevyn.them.org \
    --to=drow@false.org \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=ibr@ata.cs.hun.edu.tr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox