Thread: String changes

String changes

From
Dennis Björklund
Date:
Here are some small string changes for psql.

--
/Dennis

Attachment

Re: String changes

From
Patrick Welche
Date:
On Sat, Mar 08, 2003 at 11:23:31AM +0100, Dennis Björklund wrote:
> Here are some small string changes for psql.
>
> --
> /Dennis

> Index: command.c
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/bin/psql/command.c,v
> retrieving revision 1.90
> diff -u -r1.90 command.c
> --- command.c    2003/02/19 04:04:04    1.90
> +++ command.c    2003/03/08 10:19:52
> @@ -1901,7 +1901,7 @@
>              if (popt->topt.pager == 1)
>                  puts(gettext("Using pager is on."));
>              else if (popt->topt.pager == 2)
> -                puts(gettext("Using pager is always."));
> +                puts(gettext("Always use pager."));
>              else
>                  puts(gettext("Using pager is off."));

Then how about "Never use pager." ?

> -    fprintf(output, _("\n"));
> +    fprintf(output, "\n");

and what about all the other _( ) ? (Looks a bit like php to me..)

Cheers,

Patrick

Re: String changes

From
Dennis Björklund
Date:
On Sat, 8 Mar 2003, Patrick Welche wrote:

> > -                puts(gettext("Using pager is always."));
> > +                puts(gettext("Always use pager."));
> >              else
> >                  puts(gettext("Using pager is off."));
>
> Then how about "Never use pager." ?

This setting is still mostly boolean, it toggles between on and off if you
don't explicitly set it. I left it as is because most other settings are
still on/off.

I changed "Using pager is always." because it is not good english.

For me it's fine with "Using pager is off." but I wouldn't protest if it
was changed. Both are just as fine if you ask me.

> > -    fprintf(output, _("\n"));
> > +    fprintf(output, "\n");
>
> and what about all the other _( ) ? (Looks a bit like php to me..)

I don't know what you ask here. Do you have an example of a _( ) that is
not needed then it should be removed of course. The rest that I saw was
needed.

_() is used for translations. To mark "\n" for translation make no sense.

--
/Dennis


Re: String changes

From
Tom Lane
Date:
=?ISO-8859-1?Q?Dennis_Bj=F6rklund?= <db@zigo.dhs.org> writes:
> _() is used for translations. To mark "\n" for translation make no sense.

Yeah, but making those printfs different from the others is a recipe
for future mistakes.  I thought that proposed patch was useless
micro-optimization, too.

            regards, tom lane

Re: String changes

From
Patrick Welche
Date:
On Sat, Mar 08, 2003 at 07:44:39PM +0100, Dennis Björklund wrote:
>
> I don't know what you ask here. Do you have an example of a _( ) that is
> not needed then it should be removed of course. The rest that I saw was
> needed.
>
> _() is used for translations. To mark "\n" for translation make no sense.

I didn't know that..

Cheers,

Patrick

Re: String changes

From
Dennis Björklund
Date:
On Sat, 8 Mar 2003, Tom Lane wrote:

> Yeah, but making those printfs different from the others is a recipe
> for future mistakes.  I thought that proposed patch was useless
> micro-optimization, too.

The reason to remove it is to help the translators.

When I find the string "\n" in the translation file I have to look that up
in the source to understand what it is and what it should be translated
to. Of course I could just translate it to "\n" but my experience as a
translator tells me that it's usually a sign of a misstake. When there is
many translations, and each translator has the same problem, then it may
be worth it to remove it.

It has nothing to do with the 0.00001s it takes to do the call to gettext.

--
/Dennis


Re: String changes

From
Tom Lane
Date:
=?ISO-8859-1?Q?Dennis_Bj=F6rklund?= <db@zigo.dhs.org> writes:
> On Sat, 8 Mar 2003, Tom Lane wrote:
>> Yeah, but making those printfs different from the others is a recipe
>> for future mistakes.  I thought that proposed patch was useless
>> micro-optimization, too.

> The reason to remove it is to help the translators.

It would only help if you were to find and nuke every single instance of
gettext("\n"), and make sure that no new ones get introduced.  I think
that adds more current and future work than the translators are likely
to save.  And no, I don't believe that translators will expend great
effort on translating it ;-)

            regards, tom lane

Re: String changes

From
Dennis Björklund
Date:
On Sat, 8 Mar 2003, Tom Lane wrote:

> It would only help if you were to find and nuke every single instance of
> gettext("\n"), and make sure that no new ones get introduced.  I think
> that adds more current and future work than the translators are likely
> to save.

Well, I did.

> And no, I don't believe that translators will expend great
> effort on translating it ;-)

Oh, you'd be surprised of how many such things that translators complain
about :-)

The reason why strings like "\n", "  ", "\t " and such things are hard is
because often it's most often used to layout things. And when you change
the translation in one place the translated string is usually longer
(english is fairly compact), then the translator have to fix up whitespace
to make it match the other strings. For example "\n" maybe should have
been translated to "\n\n" if some other string had to be two lines in a
language with longer sentences then english (like Finnish, or to a
smaller extent swedish).

But it's just a string. It won't change the world in any way! I'll not send
more mails about it.

--
/Dennis


Re: String changes

From
Bruce Momjian
Date:
I have applied your space change to \connect help, and cleaned up the
pager setting display.  Patch attached.

---------------------------------------------------------------------------

Dennis Bj�rklund wrote:
> Here are some small string changes for psql.
>
> --
> /Dennis

Content-Description:

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/bin/psql/command.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/command.c,v
retrieving revision 1.90
diff -c -c -r1.90 command.c
*** src/bin/psql/command.c    19 Feb 2003 04:04:04 -0000    1.90
--- src/bin/psql/command.c    10 Mar 2003 15:30:08 -0000
***************
*** 1899,1909 ****
          if (!quiet)
          {
              if (popt->topt.pager == 1)
!                 puts(gettext("Using pager is on."));
              else if (popt->topt.pager == 2)
!                 puts(gettext("Using pager is always."));
              else
!                 puts(gettext("Using pager is off."));
          }
      }

--- 1899,1909 ----
          if (!quiet)
          {
              if (popt->topt.pager == 1)
!                 puts(gettext("Pager is on (for long output)."));
              else if (popt->topt.pager == 2)
!                 puts(gettext("Pager is always (used)."));
              else
!                 puts(gettext("Pager is off."));
          }
      }

Index: src/bin/psql/help.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/help.c,v
retrieving revision 1.69
diff -c -c -r1.69 help.c
*** src/bin/psql/help.c    7 Jan 2003 20:56:07 -0000    1.69
--- src/bin/psql/help.c    10 Mar 2003 15:30:12 -0000
***************
*** 173,179 ****
       */
      fprintf(output, _("General\n"));
      fprintf(output, _("  \\c[onnect] [DBNAME|- [USER]]\n"
!                       "                connect to new database (currently \"%s\")\n"),
              PQdb(pset.db));
      fprintf(output, _("  \\cd [DIR]      change the current working directory\n"));
      fprintf(output, _("  \\copyright     show PostgreSQL usage and distribution terms\n"));
--- 173,179 ----
       */
      fprintf(output, _("General\n"));
      fprintf(output, _("  \\c[onnect] [DBNAME|- [USER]]\n"
!                       "                 connect to new database (currently \"%s\")\n"),
              PQdb(pset.db));
      fprintf(output, _("  \\cd [DIR]      change the current working directory\n"));
      fprintf(output, _("  \\copyright     show PostgreSQL usage and distribution terms\n"));