Re: Jive -> Kernel (International Linux)

Charlie Ross (s253343@gettysburg.edu)
Sat, 18 Jan 1997 20:34:46 -0500 (EST)


Try this one...

In generic.h:
#ifndef HELLO
#define HELLO "Hello!"
#endif
#ifndef BYE
#define BYE "Bye!"
#endif
#ifndef PRINTER_ERROR
#define PRINTER_ERROR "Your printer is on fire."
#endif
#ifndef KERNEL_OOPS
#define KERNEL_OOPS "OOPS!"
#endif

In english.h:
#ifndef HELLO
#define HELLO "Hi there!"
#endif
#ifndef BYE
#define BYE "See you later!"
#endif
#ifndef PRINTER_ERROR
#define PRINTER_ERROR "Somthing is wrong with the printer."
#endif

In slang.h:
#ifndef HELLO
#define HELLO "YO!"
#endif
#ifndef BYE
#define BYE "PISS OFF!"
#endif

In language.h
#ifdef LANGH1
#include LANGH1
#ifdef LANGH2
#include LANGH2
#endif
#endif
#include "generic_lang.h"

Actual program:
printk(HELLO);
printk(BYE);
printk(PRINTER_ERROR);
printk(KERNEL_OOPS);

compile with -DLANGH1=\"english.h\" and you get:
Hi there!
See you later!
Somthing is wrong with the printer.
OOPS!

compile with -DLANGH1=\"slang.h\" -DLANGH2=\"english.h\" and you get:
YO!
PISS OFF!
Somthing is wrong with the printer.
OOPS!

compile with -DLANGH1=\"slang.h\" and you get:
YO!
PISS OFF!
Your printer is on fire
OOPS!

compile with nothing and you get:
HELLO!
BYE!
Your printer is on fire
OOPS!

This could be expanded to use LANGH1-LANGH999999999 if nessacary, giving
you as many fallback languages as you want.. plus if you define nothing, or
if your choice of languages fails to contain a string for a particular
event, you get generic.

Adding a new language would be preety easy, only add the strings you want
changed.. plus you could include a fallback language there.. IE:

In proper_english.h:
#ifndef HELLO
#define HELLO "I send my greetings to you!"
#endif
#ifndef BYE
#define BYE "I'm sure we will meet again!"
#endif
#include "english.h"

if you then compile with -DLANGH1=\"proper_english.h\" you will get proper
english whenever possible, followed by normal english, followed by
generic... you'd get:
I send my greetings to you!
I'm sure we will meet again!
Somthing is wrong with the printer.
OOPS!

This particular feature would be usefull in dialects, like the various
neuances in speech in the US:

In texas_english.h:
#ifndef HELLO
#define HELLO "Howdy!"
#endif
#include "english.h"

In south_english.h:
#ifndef BYE
#define BYE "Y'all come back now, ya hear?"
#endif
#include "english.h"

Anyway, the point is, that LANGH1 is used whenever possible, then LANGH2,
then generic.. adding a new language is fairly easy and wont cause any
errors... and if its a dialect of another language you could save time by
only putting in the differences, and including the "parrent" language at
the end.

Any comments?

-Chuck

s253343@gettysburg.edu
(717)-337-8212

"God is real, unless declared integer."