Skip to content
Snippets Groups Projects
Commit 7be3eaf0 authored by Robert Lange's avatar Robert Lange Committed by Sebastian Kehr
Browse files

refs #16891 [fid_adlr] sync short labels for search quickfilter

* add translation in adlr layout
* use same translations in js as in php searchTabs
parent a235b4c2
No related merge requests found
......@@ -52,6 +52,10 @@
'close' => 'close',
'collection_empty' => 'collection_empty',
'error_occurred' => 'An error has occurred',
'filter-All' => 'All',
'filter-AVMedia' => 'SearchTabs::AV Media',
'filter-Releases' => 'SearchTabs::Releases',
'filter-Texts' => 'Texts',
'go_to_list' => 'go_to_list',
'hold_available' => 'hold_available',
'libphonenumber_invalid' => 'libphonenumber_invalid',
......
......@@ -157,12 +157,21 @@ $hiddenFilterParams = $this->searchTabs()->getCurrentHiddenFilterParams($this->s
});
$('input[name="format-pre-filter"]').change(function() {
setCategoryFilterText($('label[for="' + $(this)[0].id + '"]').html());
setCategoryFilterText($(this)[0].id);
});
function setCategoryFilterText(text) {
$('#quickfilter-format')
.html("<span class=\"sr-only\">Select format pre-filter</span>" + text.substring(0,6) + "<i class=\"icon icon-caret-down\" aria-hidden=\"true\"></i>");
function setCategoryFilterText(id) {
let text = VuFind.translate(id);
if(text) {
let maxLength = 5;
let padEnd = text.length <= 3 ? 1 : 0;
let padStart = Math.max(maxLength - text.length - padEnd, 0);
$('#quickfilter-format')
.html("<span class=\"sr-only\">Select format pre-filter</span>"
+ "&nbsp;".repeat(padStart) + text + "&nbsp;".repeat(padEnd)
+ "<i class=\"icon icon-caret-down\" aria-hidden=\"true\"></i>"
);
}
}
});
</script>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment