[GRASS-dev] String standardization

Hello developers,

I've noticed that there is a wide range of output string formatting
throughout GRASS. Should we standardize on how text in formatted for
various situations (warnings, errors, etc)?

For instance, I've seen mapsets displayed in '', '<>', or no
separation at all from the rest of the text.

Also, I see that text may begin capitalized or lower case and may or may
not end with punctuation.

As has been noted before by ESR and others, modules should be quiet by
default (I am a violator, but correcting).

Too bad we don't have a PSC. :frowning: **nudge**

--
Brad Douglas <rez touchofmadness com> KB8UYR
Address: 37.493,-121.924 / WGS84 National Map Corps #TNMC-3785

Brad wrote:

I've noticed that there is a wide range of output string formatting
throughout GRASS. Should we standardize on how text in formatted for
various situations (warnings, errors, etc)?

For instance, I've seen mapsets displayed in '', '<>', or no
separation at all from the rest of the text.

Also, I see that text may begin capitalized or lower case and may or
may not end with punctuation.

I fully agree.

For i18n reasons mostly I have taken to copying strings from other
modules rather than reinvent my own when doing something new or
i18n'zing a module.

e.g.

raster$ grep -rI -A5 G_open_raster_new * | grep fatal | cut -f2- -d'('

and then pick my favorite:
  _("Unable to create raster map <%s>")

same issue with italicized module names and bolded option convensions
used in the help pages.

Hamish

I raise my hand for all translators!

cat grassmods_cs.po|grep open|grep raster
msgid "Cannot open raster map"
msgid "error opening raster map [%s]."
msgid "Unable to open raster map [%s]"
msgid "Unable to open raster map [%s] in [%s]"
msgid "Unable to open raster map [%s]."
msgid "%s: %s - Unable to open the input raster map\n"
msgid "Cannot open raster map [%s]"
msgid "Unable to open raster map <%s>"
msgid "<%s> unable to open raster file"
msgid "%s - can't open raster file"
msgid "Can't open raster file %s"
msgid "Cannot open terrain raster map <%s@%s>!"
msgid "Cannot open raster file [%s]!"
msgid "can't open raster file [%s] needed for input coordinates"
msgid "%s - can't open raster map"

jachym

On Wed, Jul 19, 2006 at 07:50:45PM +1200, Hamish wrote:

Brad wrote:
> I've noticed that there is a wide range of output string formatting
> throughout GRASS. Should we standardize on how text in formatted for
> various situations (warnings, errors, etc)?
>
> For instance, I've seen mapsets displayed in '', '<>', or no
> separation at all from the rest of the text.
>
> Also, I see that text may begin capitalized or lower case and may or
> may not end with punctuation.

I fully agree.

For i18n reasons mostly I have taken to copying strings from other
modules rather than reinvent my own when doing something new or
i18n'zing a module.

e.g.

raster$ grep -rI -A5 G_open_raster_new * | grep fatal | cut -f2- -d'('

and then pick my favorite:
  _("Unable to create raster map <%s>")

same issue with italicized module names and bolded option convensions
used in the help pages.

Hamish

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://les-ejk.cz/gnupg_public_key/jachym_cepicky-gpg_public_key.asc
-----------------------------------------
OFFICE:
GDF-Hannover
Mengendamm 16d
30177 Hannover
Germany
e-mail: cepicky@gdf-hannover.de
URL: http://gdf-hannover.de
Tel.: +49 511-39088507

On Wed, Jul 19, 2006 at 10:24:54AM +0200, Jachym Cepicky wrote:

I raise my hand for all translators!

cat grassmods_cs.po|grep open|grep raster
msgid "Cannot open raster map"
msgid "error opening raster map [%s]."
msgid "Unable to open raster map [%s]"
msgid "Unable to open raster map [%s] in [%s]"
msgid "Unable to open raster map [%s]."
msgid "%s: %s - Unable to open the input raster map\n"
msgid "Cannot open raster map [%s]"
msgid "Unable to open raster map <%s>"
msgid "<%s> unable to open raster file"
msgid "%s - can't open raster file"
msgid "Can't open raster file %s"
msgid "Cannot open terrain raster map <%s@%s>!"
msgid "Cannot open raster file [%s]!"
msgid "can't open raster file [%s] needed for input coordinates"
msgid "%s - can't open raster map"

We should probably come up with message macros for standard
messages like
MSG_RASTER_NOT_FOUND_IN_MAPSET - "Unable to open raster map [%s] in [%s]"

or so. But I don't know how that's done in C.

Markus

jachym

Hello Jachym,

On Wed, 19 Jul 2006 10:24:54 +0200 Jachym Cepicky
<jachym.cepicky@centrum.cz> wrote:

I raise my hand for all translators!

cat grassmods_cs.po|grep open|grep raster
msgid "Cannot open raster map"
msgid "error opening raster map [%s]."
msgid "Unable to open raster map [%s]"
msgid "Unable to open raster map [%s] in [%s]"
msgid "Unable to open raster map [%s]."
msgid "%s: %s - Unable to open the input raster map\n"
msgid "Cannot open raster map [%s]"
msgid "Unable to open raster map <%s>"
msgid "<%s> unable to open raster file"
msgid "%s - can't open raster file"
msgid "Can't open raster file %s"
msgid "Cannot open terrain raster map <%s@%s>!"
msgid "Cannot open raster file [%s]!"
msgid "can't open raster file [%s] needed for input coordinates"
msgid "%s - can't open raster map"

jupp, thanks for pointing this out. I vote for this to standardize!

Cheers

  Stephan

On Wed, Jul 19, 2006 at 07:50:45PM +1200, Hamish wrote:
> Brad wrote:
> > I've noticed that there is a wide range of output string
> > formatting throughout GRASS. Should we standardize on how text
> > in formatted for various situations (warnings, errors, etc)?
> >
> > For instance, I've seen mapsets displayed in '', '<>', or no
> > separation at all from the rest of the text.
> >
> > Also, I see that text may begin capitalized or lower case and may
> > or may not end with punctuation.
>
> I fully agree.
>
> For i18n reasons mostly I have taken to copying strings from other
> modules rather than reinvent my own when doing something new or
> i18n'zing a module.
>
> e.g.
>
> raster$ grep -rI -A5 G_open_raster_new * | grep fatal | cut -f2-
> -d'('
>
> and then pick my favorite:
> _("Unable to create raster map <%s>")
>
>
> same issue with italicized module names and bolded option
> convensions used in the help pages.
>
>
> Hamish
>
> _______________________________________________
> grass-dev mailing list
> grass-dev@grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev

--
GDF Hannover - Solutions for spatial data analysis and remote sensing
Hannover Office - Mengendamm 16d - D-30177 Hannover
Internet: www.gdf-hannover.de - Email: holl@gdf-hannover.de
Phone : ++49-(0)511.39088507 - Fax: ++49-(0)511.39088508

On Wed, 19 Jul 2006, Markus Neteler wrote:

We should probably come up with message macros for standard
messages like
MSG_RASTER_NOT_FOUND_IN_MAPSET - "Unable to open raster map [%s] in [%s]"

We should probably have some sort of a developer's wiki (as a part of http://grass.gdf-hannover.de/wiki/Development ?) where specifications like this are discussed.

\Flo.

--
Florian Kindl
Institute of Geography
University of Innsbruck

On Wed, 19 Jul 2006, Florian Kindl wrote:

On Wed, 19 Jul 2006, Markus Neteler wrote:

We should probably have some sort of a developer's wiki (as a part of http://grass.gdf-hannover.de/wiki/Development ?) where specifications like this are discussed.

There, for example:
http://grass.gdf-hannover.de/wiki/Development_Specs

\Flo.

--
Florian Kindl
Institute of Geography
University of Innsbruck

Markus Neteler wrote:

> I raise my hand for all translators!
>
> cat grassmods_cs.po|grep open|grep raster
> msgid "Cannot open raster map"
> msgid "error opening raster map [%s]."
> msgid "Unable to open raster map [%s]"
> msgid "Unable to open raster map [%s] in [%s]"
> msgid "Unable to open raster map [%s]."
> msgid "%s: %s - Unable to open the input raster map\n"
> msgid "Cannot open raster map [%s]"
> msgid "Unable to open raster map <%s>"
> msgid "<%s> unable to open raster file"
> msgid "%s - can't open raster file"
> msgid "Can't open raster file %s"
> msgid "Cannot open terrain raster map <%s@%s>!"
> msgid "Cannot open raster file [%s]!"
> msgid "can't open raster file [%s] needed for input coordinates"
> msgid "%s - can't open raster map"

We should probably come up with message macros for standard
messages like
MSG_RASTER_NOT_FOUND_IN_MAPSET - "Unable to open raster map [%s] in [%s]"

or so. But I don't know how that's done in C.

The easiest way to simplify this particular situation is to move the
error message into G_open_cell_old() etc.

Beyond that, I would guess that the vast majority of modules will just
call G_fatal_error() if a map cannot be opened. In which case,
G_open_cell_old() etc should probably just call G_fatal_error(),
relieving individual modules of the burden. Separate "_noerror"
versions can be provided for modules which really need to handle
this issue themselves.

Also, it would be useful if G_parser() would ensure the existence of
input maps, the way it ensures the non-existence of output maps. That
would ensure that failure occurs at an early stage, rather than after
the module has started to create output maps, temporary files etc.
However, there would need to be a way to bypass this check, for use by
modules which need to read maps from another location (e.g. *.proj).

--
Glynn Clements <glynn@gclements.plus.com>