summaryrefslogtreecommitdiff
path: root/src/w32.c
diff options
context:
space:
mode:
authorJason Rumney <jasonr@gnu.org>2000-11-24 21:30:06 +0000
committerJason Rumney <jasonr@gnu.org>2000-11-24 21:30:06 +0000
commit69fb0241f4a8ca90caa1ea305a5b85ce375ff781 (patch)
tree9230947ea855e05ca867cd655d1cc0d3e7f21e0c /src/w32.c
parentd3416cca6b42fe8141831ec3421f11e014cf92db (diff)
downloademacs-69fb0241f4a8ca90caa1ea305a5b85ce375ff781.tar.gz
(init_environment): Set LANG environment variable based on
locale settings, if not set.
Diffstat (limited to 'src/w32.c')
-rw-r--r--src/w32.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/w32.c b/src/w32.c
index 9afaa178444..efc0bb5511c 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -702,6 +702,7 @@ init_environment (char ** argv)
int i;
LPBYTE lpval;
DWORD dwType;
+ char locale_name[32];
static struct env_entry
{
@@ -721,9 +722,25 @@ init_environment (char ** argv)
is then ignored. */
/* {"INFOPATH", "%emacs_dir%/info"}, */
{"EMACSDOC", "%emacs_dir%/etc"},
- {"TERM", "cmd"}
+ {"TERM", "cmd"},
+ {"LANG", NULL},
};
+ /* Get default locale info and use it for LANG. */
+ if (GetLocaleInfo (LOCALE_USER_DEFAULT,
+ LOCALE_SABBREVLANGNAME | LOCALE_USE_CP_ACP,
+ locale_name, sizeof (locale_name)))
+ {
+ for (i = 0; i < (sizeof (env_vars) / sizeof (env_vars[0])); i++)
+ {
+ if (strcmp (env_vars[i].name, "LANG") == 0)
+ {
+ env_vars[i].def_value = locale_name;
+ break;
+ }
+ }
+ }
+
#define SET_ENV_BUF_SIZE (4 * MAX_PATH) /* to cover EMACSLOADPATH */
/* Treat emacs_dir specially: set it unconditionally based on our
@@ -752,7 +769,7 @@ init_environment (char ** argv)
}
}
- for (i = 0; i < (sizeof (env_vars) / sizeof (env_vars[0])); i++)
+ for (i = 0; i < (sizeof (env_vars) / sizeof (env_vars[0])); i++)
{
if (!getenv (env_vars[i].name))
{