Skip to content

Commit

Permalink
Merge branch 'translate-aria-label' into develop
Browse files Browse the repository at this point in the history
(close #2120)
  • Loading branch information
zerocrates committed Dec 15, 2023
2 parents 238c3e9 + 14d78a8 commit 0b5d4a2
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public function __invoke(ContainerInterface $container, $name,
callable $callback, array $options = null
) {
$formSelect = $callback();
$formSelect->addTranslatableAttribute('aria-label');
// The data-placeholder attribute is used by Chosen to display default
// field text. This will make sure that attribute is translated.
$formSelect->addTranslatableAttribute('data-placeholder');
Expand Down
2 changes: 1 addition & 1 deletion application/src/View/Helper/BlockThumbnailTypeSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __invoke(SitePageBlockRepresentation $block = null)
$type = $block->dataValue('thumbnail_type');
}

$selectLabel = $view->translate('Thumbnail type');
$selectLabel = 'Thumbnail type'; // @translate
$select = new Select('o:block[__blockIndex__][o:data][thumbnail_type]');
$select->setValueOptions(array_combine($this->thumbnailTypes, $this->thumbnailTypes))->setValue($type);
$select->setAttributes(['title' => $selectLabel, 'aria-label' => $selectLabel]);
Expand Down
10 changes: 5 additions & 5 deletions application/view/common/advanced-search/has-media.phtml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
$element = new \Laminas\Form\Element\Select('has_media');
$element->setLabel($this->translate('Search by media presence'))
$element
->setLabel('Search by media presence') // @translate
->setValueOptions([
'1' => $this->translate('Has media'),
'0' => $this->translate('Has no media'),
'1' => 'Has media', // @translate
'0' => 'Has no media', // @translate
])
->setEmptyOption($this->translate('Select media presence…'))
->setEmptyOption('Select media presence…') // @translate
->setValue($query['has_media'] ?? '')
->setAttribute('id', 'has_media');
echo $this->formRow($element);
?>
2 changes: 1 addition & 1 deletion application/view/common/advanced-search/item-sets.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ if ($this->status()->isSiteRequest()) {
'attributes' => [
'value' => $itemSet['id'],
'class' => 'item-set-select',
'aria-labelledby' => 'by-item-set-label'
'aria-labelledby' => 'by-item-set-label',
],
'options' => $selectOptions,
]); ?>
Expand Down
1 change: 0 additions & 1 deletion application/view/common/advanced-search/owner.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@
]); ?>
</div>
</div>

4 changes: 2 additions & 2 deletions application/view/common/advanced-search/properties.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ if ($this->status()->isSiteRequest()) {
'name' => $stem . '[property]',
'attributes' => [
'class' => 'query-property',
'value' => isset($property['property']) ? $property['property'] : null,
'aria-label' => $translate('Property'),
'value' => $property['property'] ?? null,
'aria-label' => 'Property', // @translate
],
'options' => [
'empty_option' => '[Any Property]', // @translate
Expand Down
12 changes: 6 additions & 6 deletions application/view/common/advanced-search/sort.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ switch ($resourceType) {
$sortConfig = $this->browse()->getBrowseService()->getSortConfig($sortConfigContext, $sortConfigResourceType);

$sortBy = new Element\Select('sort_by');
$sortBy->setAttribute('aria-label', $this->translate('Sort by'));
$sortBy->setEmptyOption($this->translate('Select sort by…'));
$sortBy->setAttribute('aria-label', 'Sort by'); // @translate
$sortBy->setEmptyOption('Select sort by…'); // @translate
$sortBy->setValueOptions($sortConfig);
$sortBy->setValue((!isset($query['sort_by_default']) && isset($query['sort_by'])) ? $query['sort_by'] : '');

$sortOrder = new Element\Select('sort_order');
$sortOrder->setAttribute('aria-label', $this->translate('Sort order'));
$sortOrder->setEmptyOption($this->translate('Select sort order…'));
$sortOrder->setAttribute('aria-label', 'Sort order'); // @translate
$sortOrder->setEmptyOption('Select sort order…'); // @translate
$sortOrder->setValueOptions([
'asc' => $this->translate('Ascending'),
'desc' => $this->translate('Descending'),
'asc' => 'Ascending', // @translate
'desc' => 'Descending', // @translate
]);
$sortOrder->setValue($query['sort_order'] ?? '');
?>
Expand Down
9 changes: 4 additions & 5 deletions application/view/common/advanced-search/visibility.phtml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?php
$element = new \Laminas\Form\Element\Select('is_public');
$element->setLabel($this->translate('Search by visibility'))
$element->setLabel('Search by visibility') // @translate
->setValueOptions([
'1' => $this->translate('Public'),
'0' => $this->translate('Not public'),
'1' => 'Public', // @translate
'0' => 'Not public', // @translate
])
->setEmptyOption($this->translate('Select visibility…'))
->setEmptyOption('Select visibility…') // @translate
->setValue($query['is_public'] ?? '')
->setAttribute('id', 'is_public');
echo $this->formRow($element);
?>

0 comments on commit 0b5d4a2

Please sign in to comment.