Re: [AD] Figuring out the language from the environment variable LANG

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> Here's a patch to fix the situation told about in Alleg5's "GNU
> gettext support" thread.

Ok for mainline, with the following minor corrections:

+   install_allegro automatically calls this function, and if you have an
+   environment variable named LANG, it will use it's two first letters to
+   set the system language.

"its", not "it's".

+   /* try to guess language setting from environment variable */
+   if ((env_lang = getenv("LANG")) && env_lang[0] && env_lang[1]) {
+      char lang[3] = "en";

Kill the "3".

+      /* yes, this is bad, but we only read the first two letters */
+      lang[0] = env_lang[0];
+      lang[1] = env_lang[1];
+      reload_config_texts(lang);

"two first letters".

+      AL_CONST char *ext, *datafile;
+      char filename[1024], *namecpy = ustrdup(name);

Don't mix char[] and char* variables.

-- 
Eric Botcazou




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/