LP#1717777: Ensure the en-US is always represented in the dropdown
authorMike Rylander <mrylander@gmail.com>
Thu, 21 Sep 2017 17:51:41 +0000 (13:51 -0400)
committerBen Shum <ben@evergreener.net>
Thu, 21 Sep 2017 17:55:38 +0000 (13:55 -0400)
The assumption of an array in the eval'd code was causing the forced
en_us tag to fail.  Here we push the default en_us into the list of
locales in a more structured way to ensure that failure doesn't happen.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Ben Shum <ben@evergreener.net>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm

index 965c7ca..8dc09cb 100644 (file)
@@ -374,7 +374,7 @@ sub find_template {
 sub load_locale_handlers {
     my $ctx = shift;
     my @raw = @_;
-    my %locales;
+    my %locales = (en_us => []);
     while (@raw) {
         my ($l,$file) = (shift(@raw),shift(@raw)); 
         $locales{$l} ||= [];
@@ -384,9 +384,6 @@ sub load_locale_handlers {
     my $editor = new_editor();
     my @locale_tags = sort { length($a) <=> length($b) } keys %locales;
 
-    # always fall back to en_us, the assumed template language
-    push(@locale_tags, 'en_us');
-
     for my $idx (0..$#locale_tags) {
 
         my $tag = $locale_tags[$idx];