[sane-devel] "Well known" Colour mode strings

Matthew Duggan stauff@guarana.org
Wed, 28 Apr 2004 15:08:02 +1000

Hi all,

I have a suggestion regarding the values for the SCAN_MODE option.  In
saneopts.h we currently have SANE_[NAME|TITLE|DESC]_SCAN_MODE, all in
nicely translatable strings.  Unfortunately, a quick grep through the
backend source shows that each backend has "accepted" values for this
option hard-coded in (wc tells me that it's in 88 different places for

Worse, some backends initially define values as SANE_I18N, then do
strcmps in other places without the SANE_I18N decoration.  This will
surely cause trouble for people using translated versions of SANE.

What brought this to my attention was a bug (#300689) filed against the
canon_pp backend noting that it returns an error if you request Color or
Gray modes.. the reason being that as a hangover from when I wrote a
stand-alone test program, I've spelt them "Colour" and "Greyscale".. the
former being the correct spelling in my part of the world (and anywhere
outside of en.US for that matter).  This is also possibly a bug in
scanimage for not giving the backend-provided stringlist options for the
--mode option.

So, my suggestion is that we also have VALUE strings defined in
saneopts.h in a translatable fashion, to avoid the repetition of string
constants, avoid the logical errors in translated versions, and avoid
the inconsistancies that can develop between backends.

I realise we're currently frozen, that's partly why I haven't gotten as
far as making a patch to do this, but I forsee something like:

#define	SANE_NAME_SCAN_MODE			"mode"





- Matthew Duggan
(Native en.AU speaker)