Fix LP#491712, where the ALT text for format icons in the search results page was... user/paxed/lp491712
authorPasi Kallinen <pasi.kallinen@pttk.fi>
Mon, 22 Jul 2013 19:08:40 +0000 (22:08 +0300)
committerPasi Kallinen <pasi.kallinen@pttk.fi>
Mon, 22 Jul 2013 19:54:19 +0000 (22:54 +0300)
Signed-off-by: Pasi Kallinen <pasi.kallinen@pttk.fi>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm
Open-ILS/src/templates/opac/parts/misc_util.tt2

index e5d5bb2..b5ba36b 100644 (file)
@@ -173,7 +173,7 @@ sub load_context {
         parse_accept_lang($r->headers_in->get('Accept-Language'));
 
     # set the editor default locale for each page load
-    $OpenILS::Utils::CStoreEditor::default_locale = parse_eg_locale($ctx->{locale});
+    $ctx->{canonical_locale} = $OpenILS::Utils::CStoreEditor::default_locale = parse_eg_locale($ctx->{locale});
 
     my $mprefix = $ctx->{media_prefix};
     if($mprefix and $mprefix !~ /^http/ and $mprefix !~ /^\//) {
index 5c18d60..6d726df 100644 (file)
                 '//*[local-name()="attributes"]/*[local-name()="field"][@name="' _ icon_style _ '"]');
             IF node AND node.textContent;
                 type = node.textContent;
-                args.format_label = node.getAttribute('coded-value')
+                args.format_label = node.getAttribute('coded-value');
+
+                find_text_id = ctx.search_ccvm('ctype', icon_style, 'value', node.getAttribute('coded-value'));
+
+                IF find_text_id.0.id && ctx.canonical_locale != 'en-US';
+                    format_label_i18n = ctx.search_i18n('fq_field', 'ccvm.value', 'identity_value', find_text_id.0.id);
+                    FOR xi18n IN format_label_i18n;
+                        IF xi18n.translation == ctx.canonical_locale;
+                            args.format_label = xi18n.string;
+                            LAST;
+                        END;
+                    END;
+                END;
+
                 args.schema.itemtype = schema_typemap.$type;
                 args.format_icon = ctx.media_prefix _ '/images/format_icons/' _ icon_style _ '/' _ type _ '.png';
                 LAST;