-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/translate aria label #2120
Fix/translate aria label #2120
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,7 @@ public function __invoke($partialName = null, array $query = null) | |
switch ($key) { | ||
// Fulltext | ||
case 'fulltext_search': | ||
$filterLabel = $translate('Search full-text'); | ||
$filterLabel = $translate('Search full-text'); // @translate | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Generally the comment is only needed where the string literal is not used directly in a call to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment applies to all the changes in this file, I believe |
||
$filters[$filterLabel][] = $value; | ||
break; | ||
|
||
|
@@ -57,15 +57,15 @@ public function __invoke($partialName = null, array $query = null) | |
if (!is_array($value)) { | ||
$value = [$value]; | ||
} | ||
$filterLabel = $translate('Class'); // @translate | ||
foreach ($value as $subValue) { | ||
if (!is_numeric($subValue)) { | ||
continue; | ||
} | ||
$filterLabel = $translate('Class'); | ||
try { | ||
$filterValue = $translate($api->read('resource_classes', $subValue)->getContent()->label()); | ||
} catch (NotFoundException $e) { | ||
$filterValue = $translate('Unknown class'); | ||
$filterValue = $translate('Unknown class'); // @translate | ||
} | ||
$filters[$filterLabel][] = $filterValue; | ||
} | ||
|
@@ -103,10 +103,10 @@ public function __invoke($partialName = null, array $query = null) | |
if ($property) { | ||
$propertyLabel = $translate($property->label()); | ||
} else { | ||
$propertyLabel = $translate('Unknown property'); | ||
$propertyLabel = $translate('Unknown property'); // @translate | ||
} | ||
} else { | ||
$propertyLabel = $translate('[Any property]'); | ||
$propertyLabel = $translate('[Any property]'); // @translate | ||
} | ||
if (!isset($queryTypes[$queryType])) { | ||
continue; | ||
|
@@ -125,7 +125,7 @@ public function __invoke($partialName = null, array $query = null) | |
} | ||
break; | ||
case 'search': | ||
$filterLabel = $translate('Search'); | ||
$filterLabel = $translate('Search'); // @translate | ||
$filters[$filterLabel][] = $value; | ||
break; | ||
|
||
|
@@ -134,15 +134,15 @@ public function __invoke($partialName = null, array $query = null) | |
if (!is_array($value)) { | ||
$value = [$value]; | ||
} | ||
$filterLabel = $translate('Template'); // @translate | ||
foreach ($value as $subValue) { | ||
if (!is_numeric($subValue)) { | ||
continue; | ||
} | ||
$filterLabel = $translate('Template'); | ||
try { | ||
$filterValue = $api->read('resource_templates', $subValue)->getContent()->label(); | ||
} catch (NotFoundException $e) { | ||
$filterValue = $translate('Unknown template'); | ||
$filterValue = $translate('Unknown template'); // @translate | ||
} | ||
$filters[$filterLabel][] = $filterValue; | ||
} | ||
|
@@ -153,15 +153,15 @@ public function __invoke($partialName = null, array $query = null) | |
if (!is_array($value)) { | ||
$value = [$value]; | ||
} | ||
$filterLabel = $translate('In item set'); // @translate | ||
foreach ($value as $subValue) { | ||
if (!is_numeric($subValue)) { | ||
continue; | ||
} | ||
$filterLabel = $translate('In item set'); | ||
try { | ||
$filterValue = $api->read('item_sets', $subValue)->getContent()->displayTitle(); | ||
} catch (NotFoundException $e) { | ||
$filterValue = $translate('Unknown item set'); | ||
$filterValue = $translate('Unknown item set'); // @translate | ||
} | ||
$filters[$filterLabel][] = $filterValue; | ||
} | ||
|
@@ -171,53 +171,57 @@ public function __invoke($partialName = null, array $query = null) | |
if (!is_array($value)) { | ||
$value = [$value]; | ||
} | ||
$filterLabel = $translate('Not in item set'); // @translate | ||
foreach ($value as $subValue) { | ||
if (!is_numeric($subValue)) { | ||
continue; | ||
} | ||
$filterLabel = $translate('Not in item set'); | ||
try { | ||
$filterValue = $api->read('item_sets', $subValue)->getContent()->displayTitle(); | ||
} catch (NotFoundException $e) { | ||
$filterValue = $translate('Unknown item set'); | ||
$filterValue = $translate('Unknown item set'); // @translate | ||
} | ||
$filters[$filterLabel][] = $filterValue; | ||
} | ||
break; | ||
|
||
// Search user | ||
case 'owner_id': | ||
$filterLabel = $translate('User'); | ||
$filterLabel = $translate('User'); // @translate | ||
try { | ||
$filterValue = $api->read('users', $value)->getContent()->name(); | ||
} catch (NotFoundException $e) { | ||
$filterValue = $translate('Unknown user'); | ||
$filterValue = $translate('Unknown user'); // @translate | ||
} | ||
$filters[$filterLabel][] = $filterValue; | ||
break; | ||
|
||
case 'site_id': | ||
$filterLabel = $translate('Site'); | ||
$filterLabel = $translate('Site'); // @translate | ||
try { | ||
$filterValue = $api->read('sites', $value)->getContent()->title(); | ||
} catch (NotFoundException $e) { | ||
$filterValue = $translate('Unknown site'); | ||
$filterValue = $translate('Unknown site'); // @translate | ||
} | ||
$filters[$filterLabel][] = $filterValue; | ||
break; | ||
|
||
case 'is_public': | ||
$filterLabel = $translate('Visibility'); | ||
$filters[$filterLabel][] = $value ? $translate('Public') : $translate('Not public'); | ||
$filterLabel = $translate('Visibility'); // @translate | ||
$filters[$filterLabel][] = $value | ||
? $translate('Public') // @translate | ||
: $translate('Not public'); // @translate | ||
break; | ||
|
||
case 'has_media': | ||
$filterLabel = $translate('Media presence'); | ||
$filters[$filterLabel][] = $value ? $translate('Has media') : $translate('Has no media'); | ||
$filterLabel = $translate('Media presence'); // @translate | ||
$filters[$filterLabel][] = $value | ||
? $translate('Has media') // @translate | ||
: $translate('Has no media'); // @translate | ||
break; | ||
|
||
case 'id': | ||
$filterLabel = $translate('ID'); | ||
$filterLabel = $translate('ID'); // @translate | ||
$ids = $value; | ||
if (is_string($ids) || is_int($ids)) { | ||
$ids = false === strpos($ids, ',') ? [$ids] : explode(',', $ids); | ||
|
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); | ||
?> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,3 @@ | |
]); ?> | ||
</div> | ||
</div> | ||
|
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); | ||
?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
title
is a default translatable attribute defined in the Laminas abstract form view helper so I don't believe this line is needed