Make sure LC_MONETARY is initialized
authorKarl Williamson <public@khwilliamson.com>
Sat, 15 Feb 2014 21:31:11 +0000 (14:31 -0700)
committerKarl Williamson <public@khwilliamson.com>
Sat, 15 Feb 2014 22:50:35 +0000 (15:50 -0700)
This is only an issue for those few platforms without LC_ALL, as that
is initialized, and includes LC_MONETARY.  This commit extends the
proper initialization to those other platforms.  Perl doesn't use
LC_MONETARY itself, but it should be properly initialized for modules
that do.

locale.c

index e504a8d..bf55d04 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -524,6 +524,14 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
            setlocale_failure = TRUE;
         }
 #       endif /* USE_LOCALE_MESSAGES */
+#       ifdef USE_LOCALE_MONETARY
+       if (! my_setlocale(LC_MONETARY,
+                        (!done && (lang || PerlEnv_getenv("LC_MONETARY")))
+                                 ? setlocale_init : NULL))
+        {
+           setlocale_failure = TRUE;
+        }
+#       endif /* USE_LOCALE_MONETARY */
     }
 
 #   endif /* LC_ALL */
@@ -600,6 +608,11 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
             if (! (my_setlocale(LC_MESSAGES, trial_locale)))
                 setlocale_failure = TRUE;
 #endif /* USE_LOCALE_MESSAGES */
+#ifdef USE_LOCALE_MONETARY
+            if (! (my_setlocale(LC_MONETARY, trial_locale)))
+                setlocale_failure = TRUE;
+#endif /* USE_LOCALE_MONETARY */
+
             if (! setlocale_failure) {  /* Success */
                 break;
             }