From: Pasi Kallinen Date: Mon, 22 Jul 2013 19:08:40 +0000 (+0300) Subject: Fix LP#491712, where the ALT text for format icons in the search results page was... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fpaxed%2Flp491712;p=working%2FEvergreen.git Fix LP#491712, where the ALT text for format icons in the search results page was always in English. Signed-off-by: Pasi Kallinen --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm index e5d5bb280a..b5ba36bc00 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm @@ -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 !~ /^\//) { diff --git a/Open-ILS/src/templates/opac/parts/misc_util.tt2 b/Open-ILS/src/templates/opac/parts/misc_util.tt2 index 5c18d60a96..6d726df7e4 100644 --- a/Open-ILS/src/templates/opac/parts/misc_util.tt2 +++ b/Open-ILS/src/templates/opac/parts/misc_util.tt2 @@ -407,7 +407,20 @@ '//*[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;