From a782673dfe49a0ee690389b79c29633fb303cf33 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 15 Feb 2014 14:26:46 -0700 Subject: [PATCH] Initialize LC_MESSAGES at start-up The code did not explicitly iinitialize LC_MESSAGES at startup, unlike most of the other standard categories; I don't know why. This is only an issue for those few platforms without LC_ALL, as that is initialized, and includes LC_MESSAGES. This commit extends the proper initialization to those other platforms. --- locale.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/locale.c b/locale.c index e024f35..e504a8d 100644 --- a/locale.c +++ b/locale.c @@ -516,6 +516,14 @@ Perl_init_i18nl10n(pTHX_ int printwarn) else curnum = savepv(curnum); # endif /* USE_LOCALE_NUMERIC */ +# ifdef USE_LOCALE_MESSAGES + if (! my_setlocale(LC_MESSAGES, + (!done && (lang || PerlEnv_getenv("LC_MESSAGES"))) + ? setlocale_init : NULL)) + { + setlocale_failure = TRUE; + } +# endif /* USE_LOCALE_MESSAGES */ } # endif /* LC_ALL */ @@ -588,6 +596,10 @@ Perl_init_i18nl10n(pTHX_ int printwarn) else curnum = savepv(curnum); #endif /* USE_LOCALE_NUMERIC */ +#ifdef USE_LOCALE_MESSAGES + if (! (my_setlocale(LC_MESSAGES, trial_locale))) + setlocale_failure = TRUE; +#endif /* USE_LOCALE_MESSAGES */ if (! setlocale_failure) { /* Success */ break; } @@ -621,7 +633,7 @@ Perl_init_i18nl10n(pTHX_ int printwarn) if (! curnum) PerlIO_printf(Perl_error_log, "LC_NUMERIC "); #endif /* USE_LOCALE_NUMERIC */ - PerlIO_printf(Perl_error_log, "\n"); + PerlIO_printf(Perl_error_log, "and possibly others\n"); #endif /* LC_ALL */ -- 2.7.4