File tree 1 file changed +2
-31
lines changed 1 file changed +2
-31
lines changed Original file line number Diff line number Diff line change @@ -2354,42 +2354,13 @@ icu_validate_locale(const char *loc_str)
2354
2354
}
2355
2355
2356
2356
/*
2357
- * Determine default ICU locale by opening the default collator and reading
2358
- * its locale.
2359
- *
2360
- * NB: The default collator (opened using NULL) is different from the collator
2361
- * for the root locale (opened with "", "und", or "root"). The former depends
2362
- * on the environment (useful at initdb time) and the latter does not.
2357
+ * Determine the default ICU locale
2363
2358
*/
2364
2359
static char *
2365
2360
default_icu_locale (void )
2366
2361
{
2367
2362
#ifdef USE_ICU
2368
- UCollator * collator ;
2369
- UErrorCode status ;
2370
- const char * valid_locale ;
2371
- char * default_locale ;
2372
-
2373
- status = U_ZERO_ERROR ;
2374
- collator = ucol_open (NULL , & status );
2375
- if (U_FAILURE (status ))
2376
- pg_fatal ("could not open collator for default locale: %s" ,
2377
- u_errorName (status ));
2378
-
2379
- status = U_ZERO_ERROR ;
2380
- valid_locale = ucol_getLocaleByType (collator , ULOC_VALID_LOCALE ,
2381
- & status );
2382
- if (U_FAILURE (status ))
2383
- {
2384
- ucol_close (collator );
2385
- pg_fatal ("could not determine default ICU locale" );
2386
- }
2387
-
2388
- default_locale = pg_strdup (valid_locale );
2389
-
2390
- ucol_close (collator );
2391
-
2392
- return default_locale ;
2363
+ return pg_strdup (uloc_getDefault ());
2393
2364
#else
2394
2365
pg_fatal ("ICU is not supported in this build" );
2395
2366
#endif
You can’t perform that action at this time.
0 commit comments