From e9ff7108bc5b61c7db42cc1f5b6a4c794b86b71f Mon Sep 17 00:00:00 2001
From: Bill Erickson <berick@esilibrary.com>
Date: Mon, 12 Sep 2011 14:13:42 -0400
Subject: [PATCH] TPac: Default to en_us if no locales are configured

Code will create an en_us handler that falls through to the strings in
the templates.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
---
 Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm
index b5812e688f..20a2e4df73 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm
@@ -229,6 +229,9 @@ sub load_locale_handlers {
 
     my @locale_tags = sort { length($a) <=> length($b) } keys %locales;
 
+    # If no locales are defined, fall back to en_us so that at least 1 handler exists
+    push(@locale_tags, 'en_us') unless @registered_locales or @locale_tags;
+
     for my $idx (0..$#locale_tags) {
 
         my $tag = $locale_tags[$idx];
@@ -247,8 +250,7 @@ sub load_locale_handlers {
             }
         }
 
-        my $messages = $locales{$tag};
-        $messages = '' if ref $messages; # empty {}
+        my $messages = $locales{$tag} || '';
 
         # TODO Can we do this without eval?
         my $eval = <<"        EVAL";
-- 
2.11.0