diff options
-rw-r--r-- | loader/lang.c | 16 | ||||
-rw-r--r-- | loader/lang.h | 1 | ||||
-rw-r--r-- | loader/loader.c | 7 |
3 files changed, 20 insertions, 4 deletions
diff --git a/loader/lang.c b/loader/lang.c index bd75e11a3..962e08c00 100644 --- a/loader/lang.c +++ b/loader/lang.c @@ -212,6 +212,20 @@ static int loadFont(char * fontFile, int flags) { return 0; } +void setLanguage (char * key) { + int i; + + for (i = 0; i < numLanguages; i++) { + if (!strcmp(languages[i].key, key)) + break; + } + if (i < numLanguages) { + setenv("LANG", languages[i].key, 1); + setenv("LC_ALL", languages[i].lc_all, 1); + setenv("LINGUAS", languages[i].key, 1); + } +} + int chooseLanguage(char ** lang, int flags) { int choice = 0; char ** langs; @@ -356,8 +370,6 @@ int chooseKeyboard(char ** keymap, char ** kbdtypep, int flags) { gzFile f; struct kmapHeader hdr; struct kmapInfo * infoTable; - char ** argv; - int argc; char ** kbds; char buf[16384]; /* I hope this is big enough */ int i; diff --git a/loader/lang.h b/loader/lang.h index ce5c6fd0d..aaacb4437 100644 --- a/loader/lang.h +++ b/loader/lang.h @@ -7,6 +7,7 @@ int chooseLanguage(char ** lang, int flags); int chooseKeyboard(char ** keymap, char ** kbdtypep, int flags); char * translateString(char * str); +void setLanguage (char * key); /* define ask johnsonm@redhat.com where this came from */ #define KMAP_MAGIC 0x8B39C07F diff --git a/loader/loader.c b/loader/loader.c index 25adabac8..ec3e8dcb1 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -1456,13 +1456,13 @@ static int parseCmdLineFlags(int flags, char * cmdLine, char ** ksSource) { flags |= LOADER_FLAGS_KICKSTART; else if (!strcasecmp(argv[i], "ks=floppy")) flags |= LOADER_FLAGS_KSFLOPPY; - else if (!strncasecmp(argv[i], "lang=", 5)) - setenv("LANG", argv[i] + 5, 1); else if (!strncasecmp(argv[i], "display=", 8)) setenv("DISPLAY", argv[i] + 8, 1); else if (!strncasecmp(argv[i], "ks=hd:", 6)) { flags |= LOADER_FLAGS_KSHD; *ksSource = argv[i] + 6; + } else if (!strncasecmp(argv[i], "lang=", 5)) { + setLanguage (argv[i] + 5); } } @@ -1909,6 +1909,9 @@ int main(int argc, char ** argv) { *argptr++ = ksFile; } + if (!lang) + lang = getenv ("LC_ALL"); + if (lang) { *argptr++ = "--lang"; *argptr++ = lang; |