Re: Jive -> Kernel (International Linux)

cloister bell (cloister@foo.hhhh.org)
Sat, 18 Jan 1997 15:27:49 -0800 (PST)


> This is probably the simplest approach...it does make every occurrence of
> printk() a little ugly, however ;-). A similar alternative (that I
> presented at first) is to do the same thing, but define symbolic names for
> the strings in a separate file (one in each directory, for example):
>
> #define STRING_FLOPPY_SCREWED "Your floppy is screwed!"
> etc...
>
> And use "printk(KERN_DEBUG STRING_FLOPPY_SCREWED);" instead. It would be
> easier to consolidate per-language stuff here, rather than going through
> every file and fiddling with the whoel #ifdef logic. Just $0.02.

agreed. isn't there an even easier way, though? something that uses the
pre-processor's ## operator, like this:

/* begin example */
#define HELLO_generic "generic greeting"
#define HELLO_english "hello!"
#define HELLO_french "bonjour!"
#define HELLO_spanish "buenos dias!"

#ifndef LANGUAGE
#define LANGUAGE _generic
#endif

#define INTERNATIONAL(x) PREINTL2(x,LANG)
#define PREINTL2(x,y) PREINTL(x,y)
#define PREINTL(x,y) x##y

printk(INTERNATIONAL(HELLO));
/* end example */

then all you have to do is stick a -DLANGUAGE=_whatever in the arguments
to gcc when you compile the kernel. and yes, somebody has to provide all
the language specific strings, but like somebody else pointed out, that
can be done incrementally by means of patches.