Messages in this thread |  | | Date | Fri, 17 Jan 1997 23:00:12 -0500 (EST) | From | "Adam D. Bradley" <> | Subject | Re: Jive -> Kernel (International Linux) |
| |
On Fri, 17 Jan 1997, Philip Blundell wrote: > On Thu, 16 Jan 1997, William Sowerbutts wrote: > > So, forget that. I propose the following solution: The kernel contains all > > of the messages in English. If the user wants to, they may override some of > > the messages with their own langauge; if a message isn't overridden the > > English default is used. Perhaps the memory used up for the English default > > could be freed in some way? > > > > Of course, I've no idea how to code this, I'm not a kernel hacker ;) Maybe > > an "enhanced_printk" type function? This would allow existing kernel code > > to function, but new code could supplement the existing code. The > > enhanced_printk function could be implemented merely as a wrapper around > > the existing printk? > > You could do this with modules. Create a global variable > printk_language_hook, which defaults to NULL. Then amend printk() to say: > > asmlinkage int printk(const char *fmt, ...) > { > [...] > if (printk_language_hook) > fmt = printk_language_hook(fmt); > [...] > } > > Thus, you can load modules that define printk_language_hook to be a > pointer to some function that substitutes the original English text with > something in the chosen language. You'd have to deal with parameters > somehow, I suppose...
Ack! Worst problem: (1) Strings have to be _recognized_ and then substituted. Have to do a bunch of strstr()'s over a massive string table. Alternately, you could do a hash on the fmt pointer to speed up the search, but still. And this invokes this same overhead on _any_ printk message once the language module is loaded; there's no allowance for "quick+dirty" dumps, eg OOPS data which we don't have/want to think about translating/formatting.
Adam -- He feeds on ashes; a deluded mind has led him Adam Bradley, UNCA Senior astray, and he cannot deliver himself or say, Computer Science "Is there not a lie in my right hand?" Isaiah 44:20 bradley@cs.unca.edu http://www.cs.unca.edu/~bradley <><
|  |