Re: Supressing a %d parameter in a string
- From: "Raphael Higino" <raphaelh uai com br>
- To: "Behdad Esfahbod" <behdad cs toronto edu>, <dsplat rochester rr com>
- Cc: GNOME I18N List <gnome-i18n gnome org>, Åsmund Skjæveland <aasmunds fys uio no>
- Subject: Re: Supressing a %d parameter in a string
- Date: Sat, 26 Feb 2005 16:37:12 -0300
Hi all,
> > I actually expected to get an error, so I tried it with gcc last night:
> >
> > printf( "arg %2$d, arg %3$d\n", 1, 2, 3 );
> >
> > gcc didn't even feel a need to warn me.
> >
> > I didn't try getting any of the gettext tools to accept it.
> > If they won't, we may want to consider whether it should be
> > possible to tell them to treat it as a warning rather than an
> > error. I wouldn't make that the default behavior. It is
> > almost always an error to omit a parameter. However, it would
> > be nice to be able to override it when necessary.
>
> It's definitely an error to leave a parameter out during
> translation, but not in general. I can think of like a
> customizable error message format that gives you the option to
> leave out fields you don't want...
>
> behdad
>
>
> > - Dale
> >
> >
> > ----- Original Message -----
> > From: Åsmund Skjæveland <aasmunds fys uio no>
> > Date: Friday, February 25, 2005 7:30 am
> > Subject: Re: Supressing a %d parameter in a string
> >
> > > > When you are using the numbered version of the formatting
> > > parameters,
> > > > you should just be able to leave out the ones that you don't
> > > want. Does
> > > > that parameter ever have any other value besides 1 for that message?
> > >
> > > No, you can't. If you leave out parameter#1 and use parameter#2,
> > > you get
> > > an error.
In fact, I realized Brazilian Portuguese translations for Nautilus were
already leaving out some %d parameters in strings like that I told you and
Nautilus doesn't show any error dialog or something (I haven't checked
error/warning messages output on console).
Translations like these below,
"Open in 1 New Window" -> "Abrir em nova janela"
"Open in 3 New Windows" -> "Abrir em 3 novas janelas"
are correctly shown by Nautilus. Since omiting the parameter sounds more
natural in Portuguese and Nautilus didn't complain of it, I left all them
this way.
Thank you all anyway.
Raphael Higino
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]