[GRASS-dev] Re: [GRASS-SVN] r42980 - grass/trunk/vector/v.db.connect

Hi,

2010/8/3 <svn_grass@osgeo.org>:

                   else \{

- fprintf(stdout,
- _("layer <%d> table <%s> in database <%s> through driver "
- "<%s> with key <%s>\n"), fi->number,
- fi->table, fi->database, fi->driver, fi->key);
+ G_message(_("layer <%d>"), fi->number);
}
+ G_message(_("table <%s>"), fi->table);
+ G_message(_("in database <%s>"), fi->database);;
+ G_message(_("through driver <%s>"), fi->driver);
+ G_message(_("with key <%s>"), fi->key);

here I would suggest to use fprintf() instead of G_message(). It's
module's output, not messages. E.g. `v.db.connect vzorky -p --q`
prints nothing.

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

Martin Landa wrote:

Hi,

2010/8/3 <svn_grass@osgeo.org>:

                   else \{

- fprintf(stdout,
- _("layer <%d> table <%s> in database <%s> through driver "
- "<%s> with key <%s>\n"), fi->number,
- fi->table, fi->database, fi->driver, fi->key);
+ G_message(_("layer <%d>"), fi->number);
}
+ G_message(_("table <%s>"), fi->table);
+ G_message(_("in database <%s>"), fi->database);;
+ G_message(_("through driver <%s>"), fi->driver);
+ G_message(_("with key <%s>"), fi->key);

here I would suggest to use fprintf() instead of G_message(). It's
module's output, not messages. E.g. `v.db.connect vzorky -p --q`
prints nothing.

Ah ok, I'll fix it.

Markus M

That was too fast. There is a problem with the new format. It works
just fine for standard output for one layer, but it has broken some
modules and wxGUI which rely on one line per layer in the form
<layer/name>;<table>;<key>;<database>;<driver>
<layer/name>;<table>;<key>;<database>;<driver>
etc.

I tend to revert it. OK?

Markus M

Markus Metz wrote:

Martin Landa wrote:

Hi,

2010/8/3 <svn_grass@osgeo.org>:

                   else \{

- fprintf(stdout,
- _("layer <%d> table <%s> in database <%s> through driver "
- "<%s> with key <%s>\n"), fi->number,
- fi->table, fi->database, fi->driver, fi->key);
+ G_message(_("layer <%d>"), fi->number);
}
+ G_message(_("table <%s>"), fi->table);
+ G_message(_("in database <%s>"), fi->database);;
+ G_message(_("through driver <%s>"), fi->driver);
+ G_message(_("with key <%s>"), fi->key);

here I would suggest to use fprintf() instead of G_message(). It's
module's output, not messages. E.g. `v.db.connect vzorky -p --q`
prints nothing.

Ah ok, I'll fix it.

Markus M

Markus Metz wrote:

That was too fast. There is a problem with the new format. It works
just fine for standard output for one layer, but it has broken some
modules and wxGUI which rely on one line per layer in the form
<layer/name>;<table>;<key>;<database>;<driver>
<layer/name>;<table>;<key>;<database>;<driver>
etc.

reverted, sorry for the noise.

Markus M

Markus Metz wrote:

Martin Landa wrote:

Hi,

2010/8/3 <svn_grass@osgeo.org>:

                   else \{

- fprintf(stdout,
- _("layer <%d> table <%s> in database <%s> through driver "
- "<%s> with key <%s>\n"), fi->number,
- fi->table, fi->database, fi->driver, fi->key);
+ G_message(_("layer <%d>"), fi->number);
}
+ G_message(_("table <%s>"), fi->table);
+ G_message(_("in database <%s>"), fi->database);;
+ G_message(_("through driver <%s>"), fi->driver);
+ G_message(_("with key <%s>"), fi->key);

here I would suggest to use fprintf() instead of G_message(). It's
module's output, not messages. E.g. `v.db.connect vzorky -p --q`
prints nothing.

Ah ok, I'll fix it.

Markus M

Markus Metz wrote:

That was too fast. There is a problem with the new format. It
works just fine for standard output for one layer, but it has
broken some modules and wxGUI which rely on one line per layer
in the form
<layer/name>;<table>;<key>;<database>;<driver>
<layer/name>;<table>;<key>;<database>;<driver>
etc.

ah, yes. it's easy to forget about layer 2+ ...

(see also r.univar + multiple input maps, similar problems)

btw, please do not add _() i18n to module output sent to stdout,
scripts parsing the result get confused. only for G_message()s.

thanks,
Hamish

Hamish wrote:

btw, please do not add _() i18n to module output sent to stdout,
scripts parsing the result get confused. only for G_message()s.

Hmm, original and restored behaviour is to print non-i18n for -g and
i18n for -p output. The -p output does go to stdout but is much more
difficult to parse (translated or not) than -g output. IMHO, it's ok
to say that -g output must be parsable whereas -p output must be
readable, also translated if possible?

Markus M