From 867901db9efbdae05270931daeb92042dc285710 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 3 Apr 2002 05:39:33 +0000 Subject: Locale support is on by default. The choice of locale is done in initdb and/or with GUC variables. --- src/backend/main/main.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'src/backend/main/main.c') diff --git a/src/backend/main/main.c b/src/backend/main/main.c index b1be0781412..9c79e7b78d9 100644 --- a/src/backend/main/main.c +++ b/src/backend/main/main.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.49 2001/11/05 17:46:25 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.50 2002/04/03 05:39:29 petere Exp $ * *------------------------------------------------------------------------- */ @@ -21,9 +21,7 @@ #include #include -#if defined(USE_LOCALE) || defined(ENABLE_NLS) #include -#endif #if defined(__alpha) && defined(__osf__) #include @@ -122,11 +120,25 @@ main(int argc, char *argv[]) new_argv[i] = strdup(argv[i]); new_argv[argc] = NULL; - /* Initialize NLS settings so we can give localized error messages */ -#ifdef ENABLE_NLS + /* + * Set up locale information from environment. Note that CTYPE + * and COLLATE will be overridden later from pg_control if we are + * in an already-initialized database. We set them here so that + * they will be available to fill pg_control during initdb. The + * other ones will get reset later in ResetAllOptions, but we set + * them here to get already localized behavior during startup + * (e.g., error messages). + */ + setlocale(LC_COLLATE, ""); + setlocale(LC_CTYPE, ""); #ifdef LC_MESSAGES setlocale(LC_MESSAGES, ""); #endif + setlocale(LC_MONETARY, ""); + setlocale(LC_NUMERIC, ""); + setlocale(LC_TIME, ""); + +#ifdef ENABLE_NLS bindtextdomain("postgres", LOCALEDIR); textdomain("postgres"); #endif @@ -178,20 +190,6 @@ main(int argc, char *argv[]) } } - /* - * Set up locale information from environment, in only the categories - * needed by Postgres; leave other categories set to default "C". - * (Note that CTYPE and COLLATE will be overridden later from - * pg_control if we are in an already-initialized database. We set - * them here so that they will be available to fill pg_control during - * initdb.) - */ -#ifdef USE_LOCALE - setlocale(LC_CTYPE, ""); - setlocale(LC_COLLATE, ""); - setlocale(LC_MONETARY, ""); -#endif - /* * Now dispatch to one of PostmasterMain, PostgresMain, or * BootstrapMain depending on the program name (and possibly first -- cgit v1.2.3