Improve locale file parsing feedback/log for tpac user/berick/tpac-locale-log-errors
authorBill Erickson <berick@esilibrary.com>
Mon, 20 Aug 2012 20:26:29 +0000 (16:26 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 20 Aug 2012 20:26:29 +0000 (16:26 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm

index 44c6018..3ba4111 100644 (file)
@@ -149,7 +149,7 @@ sub load_context {
     $ctx->{template_paths} = [ reverse @template_paths ];
 
     my %locales = $r->dir_config->get('OILSWebLocale');
-    load_locale_handlers($ctx, %locales);
+    load_locale_handlers($r, $ctx, %locales);
 
     $ctx->{locales} = \%registered_locales;
 
@@ -260,6 +260,7 @@ sub find_template {
 # Create an I18N sub-module for each supported locale
 # Each module creates its own MakeText lexicon by parsing .po/.mo files
 sub load_locale_handlers {
+    my $r = shift;
     my $ctx = shift;
     my %locales = @_;
 
@@ -319,8 +320,9 @@ sub load_locale_handlers {
         eval $eval;
 
         if ($@) {
-            warn "$@\n" if $@;
+            $r->log->error("egweb: error loading .po file for $tag / $locale_name: $@");
         } else {
+            $r->log->debug("egweb: successfully loaded .po file for $tag / $locale_name");
             $registered_locales{"$tag"} = $locale_name;
         }
     }