Skip to content

Commit ef8bd33

Browse files
[6.x] Fix listing translations (#12263)
1 parent 58a2bef commit ef8bd33

3 files changed

Lines changed: 17 additions & 29 deletions

File tree

resources/js/components/ui/Listing/TableBody.vue

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,24 @@ function isSelected(id) {
3030
function getCheckboxLabel(row) {
3131
const rowTitle = getRowTitle(row);
3232
return isSelected(row.id)
33-
? __('deselect_title', { title: rowTitle })
34-
: __('select_title', { title: rowTitle });
35-
}
36-
37-
function getCheckboxAriaLabel(row) {
38-
const rowTitle = getRowTitle(row);
39-
return isSelected(row.id)
40-
? __('deselect_title', { title: rowTitle })
41-
: __('select_title', { title: rowTitle });
33+
? __('Deselect :title', { title: rowTitle })
34+
: __('Select :title', { title: rowTitle });
4235
}
4336
4437
function getCheckboxDescription(row) {
4538
const rowTitle = getRowTitle(row);
4639
const isDisabled = hasReachedSelectionLimit.value && allowsMultipleSelections.value && !isSelected(row.id);
4740
4841
if (isDisabled) {
49-
return __('selection_limit_reached', { title: rowTitle });
42+
return __('messages.selections_limit_reached', { title: rowTitle });
5043
}
5144
5245
return isSelected(row.id)
53-
? __('item_selected_description', { title: rowTitle })
54-
: __('item_not_selected_description', { title: rowTitle });
46+
? __('messages.selections_item_selected', { title: rowTitle })
47+
: __('messages.selections_item_unselected', { title: rowTitle });
5548
}
5649
5750
function getRowTitle(row) {
58-
// Try to get a meaningful title from common fields
5951
return row.title || row.name || row.label || row.id || __('item');
6052
}
6153

resources/js/components/ui/Listing/ToggleAll.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,25 @@ function checkMaximumAmountOfItems() {
1919
2020
function getAriaLabel() {
2121
if (indeterminate.value) {
22-
return __('select_all_items');
22+
return __('Select all items');
2323
}
24-
return anyItemsChecked.value ? __('deselect_all_items') : __('select_all_items');
24+
25+
return anyItemsChecked.value ? __('Deselect all items') : __('Select all items');
2526
}
2627
2728
function getScreenReaderText() {
2829
const totalItems = items.value.length;
2930
const selectedItems = selections.value.length;
3031
3132
if (indeterminate.value) {
32-
return __('items_selected_count', { selected: selectedItems, total: totalItems });
33+
return __('messages.selections_select_all', { selected: selectedItems, total: totalItems });
3334
}
3435
3536
if (anyItemsChecked.value) {
36-
return __('all_items_selected', { total: totalItems });
37+
return __('messages.selections_click_to_deselect_all', { total: totalItems });
3738
}
3839
39-
return __('no_items_selected', { total: totalItems });
40+
return __('messages.selections_click_to_select_all', { total: totalItems });
4041
}
4142
</script>
4243

resources/lang/en/messages.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -224,17 +224,12 @@
224224
'role_title_instructions' => 'Use a singular noun, such as \'Editor\' or \'Admin\'',
225225
'search_utility_description' => 'Manage and view important information about Statamic\'s search indexes.',
226226
'search_with_count_filters_applied' => 'Search (1 filter applied)|Search (:count filters applied)',
227-
'select_all_items' => 'Select all items',
228-
'deselect_all_items' => 'Deselect all items',
229-
'items_selected_count' => ':selected of :total items selected. Check to select all items.',
230-
'all_items_selected' => 'All :total items selected. Uncheck to deselect all items.',
231-
'no_items_selected' => 'No items selected. Check to select all :total items.',
232-
'select_title' => 'Select :title',
233-
'deselect_title' => 'Deselect :title',
234-
'selection_limit_reached' => 'Selection limit reached. Cannot select :title',
235-
'item_selected_description' => ':title is currently selected. Click to deselect.',
236-
'item_not_selected_description' => ':title is not selected. Click to select.',
237-
'item' => 'item',
227+
'selections_click_to_deselect_all' => 'All :total items selected. Uncheck to deselect all items.',
228+
'selections_click_to_select_all' => 'No items selected. Check to select all :total items.',
229+
'selections_item_selected' => ':title is currently selected. Click to deselect.',
230+
'selections_item_unselected' => ':title is not selected. Click to select.',
231+
'selections_limit_reached' => 'Selection limit reached. Cannot select :title',
232+
'selections_select_all' => ':selected of :total items selected. Check to select all items.',
238233
'session_expiry_enter_password' => 'Enter your password to continue.',
239234
'session_expiry_enter_two_factor_code' => 'Enter your authenticator code to continue.',
240235
'session_expiry_enter_two_factor_recovery_code' => 'Enter a recovery code to continue.',

0 commit comments

Comments
 (0)