aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Rumney2000-11-24 21:30:06 +0000
committerJason Rumney2000-11-24 21:30:06 +0000
commit69fb0241f4a8ca90caa1ea305a5b85ce375ff781 (patch)
tree9230947ea855e05ca867cd655d1cc0d3e7f21e0c
parentd3416cca6b42fe8141831ec3421f11e014cf92db (diff)
downloademacs-69fb0241f4a8ca90caa1ea305a5b85ce375ff781.tar.gz
emacs-69fb0241f4a8ca90caa1ea305a5b85ce375ff781.zip
(init_environment): Set LANG environment variable based on
locale settings, if not set.
-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)
702 int i; 702 int i;
703 LPBYTE lpval; 703 LPBYTE lpval;
704 DWORD dwType; 704 DWORD dwType;
705 char locale_name[32];
705 706
706 static struct env_entry 707 static struct env_entry
707 { 708 {
@@ -721,9 +722,25 @@ init_environment (char ** argv)
721 is then ignored. */ 722 is then ignored. */
722 /* {"INFOPATH", "%emacs_dir%/info"}, */ 723 /* {"INFOPATH", "%emacs_dir%/info"}, */
723 {"EMACSDOC", "%emacs_dir%/etc"}, 724 {"EMACSDOC", "%emacs_dir%/etc"},
724 {"TERM", "cmd"} 725 {"TERM", "cmd"},
726 {"LANG", NULL},
725 }; 727 };
726 728
729 /* Get default locale info and use it for LANG. */
730 if (GetLocaleInfo (LOCALE_USER_DEFAULT,
731 LOCALE_SABBREVLANGNAME | LOCALE_USE_CP_ACP,
732 locale_name, sizeof (locale_name)))
733 {
734 for (i = 0; i < (sizeof (env_vars) / sizeof (env_vars[0])); i++)
735 {
736 if (strcmp (env_vars[i].name, "LANG") == 0)
737 {
738 env_vars[i].def_value = locale_name;
739 break;
740 }
741 }
742 }
743
727#define SET_ENV_BUF_SIZE (4 * MAX_PATH) /* to cover EMACSLOADPATH */ 744#define SET_ENV_BUF_SIZE (4 * MAX_PATH) /* to cover EMACSLOADPATH */
728 745
729 /* Treat emacs_dir specially: set it unconditionally based on our 746 /* Treat emacs_dir specially: set it unconditionally based on our
@@ -752,7 +769,7 @@ init_environment (char ** argv)
752 } 769 }
753 } 770 }
754 771
755 for (i = 0; i < (sizeof (env_vars) / sizeof (env_vars[0])); i++) 772 for (i = 0; i < (sizeof (env_vars) / sizeof (env_vars[0])); i++)
756 { 773 {
757 if (!getenv (env_vars[i].name)) 774 if (!getenv (env_vars[i].name))
758 { 775 {