[GRASS-user] bash scripts and NLS

Glynn Clements glynn at gclements.plus.com
Wed Mar 28 17:35:12 EDT 2007


Hamish wrote:

> > > ...d.what.vect -1 -t  map=lines|grep category|awk '{print $2}'>>cat.txt...
> > > 
> > > I compiled grass with NLS (national languages suports) and script
> > > stop  working becouse there is no category (grep) but kategoria
> > > (category in  polish). In my few scripts it is no problem (or rather
> > > I will never use  NLS), but what about scripts in grass add-ons and
> > > nls?
> 
> Glynn:
> > If a script parses output which is meant to be human-readable, it
> > needs to explicitly set the locale to "C" for that command, e.g.:
> > 
> > 	LC_ALL=C d.what.vect -1 -t ...
> 
> d.what.vect's -t specifically says it is for parsing:
> 
>   -t   Terse output. For parsing by programs

Ah. Either the description is wrong, or the use of _(...) is a bug.

> the i18n is not new, it's been there for 2.3 years. (but maybe the
> translation is)
> 
> 
> 
> so a question: should std output intended for parsing be strictly
> english only? (as debug messages are)

If it's meant to be machine-readable, it shouldn't depend upon the
locale in any way.

> e.g. north: south: etc by g.region -p  (not talking about g.region -g)
> [-p is currently not translated]

I would say that -p output should be human-readable (if it isn't, then
how do you view the current region settings in a human-readable
form?).

Having said that, it wouldn't surprise me if there are a lot of
scripts which parse "g.region -p" output, so we would first need to
fix those to use -g instead.

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




More information about the grass-user mailing list