International Linux

Andrew Lewycky (plewycky@oise.utoronto.ca)
Sun, 19 Jan 1997 22:48:42 -0500


I've got a scheme for internationalisation that I rather like. I think
it's sort of like the one Buddha Buck posted. Here goes:

There is a include/linux/language.h file that gets included by each
source file needing an internationalised string:

#ifndef __LINUX_LANGUAGE_H
#define __LINUX_LANGUAGE_H

#include <linux/language/generic.h>

#include LANGUAGE_H

#endif

LANGUAGE_H is defined in a -D switch, which may look like:
-DLANGUAGE_H=</linux/language/hoser.h>
(I forget the syntax, but I'm sure there's a way to include by
preprocessor define. If not, there are ways of getting around this.)

Then, there is include/linux/language/generic.h:

#define HELLO "Hello"
#define GOODBYE "Goodbye"
#define KERNEL_PANIC "Kernel Panic"
#define DISK_BUSTED "Disk %s is busted."

Then, include/linux/language/hoser.h (for example):

#undef HELLO
#define HELLO "Grab a beer, buddy."
#undef KERNEL_PANIC
#define KERNEL_PANIC "Oh no! We're out of beer!"

This is probably the simplest system I've seen yet. No ifdefs or any
sillyness. Of course, a static system may be the totally wrong idea
anyway. I haven't thought about that much.

This makes things quite regular too, so it would be easy to write a
program to assist in managing the string include files.

Well, how does this sound?

Andrew Lewycky
plewycky@oise.utoronto.ca

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d+ s-:- a--- C++++$ UL++++ P- L+++>++++ E W+ N++ o+ K w-- O M- V--
PS+ PE- Y+ PGP t+@ 5- X- R- tv- b++ DI+ D+(---) G e- h! r-- !y
------END GEEK CODE BLOCK------