Skip to content

Commit eae413c

Browse files
committed
Update rows for translations
Add ability to change empty message
1 parent 6146713 commit eae413c

15 files changed

+104
-30
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
66

77
### Added
88

9-
- Added option for single column sorting only
9+
- Added option for single column sorting only.
10+
- Ability to change empty message per table.
11+
- Added en.json lang file.
12+
13+
### Changed
14+
15+
- Modified views to support localization better where necessary (republish views).
1016

1117
## [1.3.1] - 2021-04-26
1218

resources/lang/en.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"You have selected": "You have selected",
3+
"rows, do you want to select all": "rows, do you want to select all",
4+
"Select All": "Select All",
5+
"You are currently selecting all": "You are currently selecting all",
6+
"rows": "rows",
7+
"Unselect All": "Unselect All",
8+
"Applied Sorting": "Applied Sorting",
9+
"Remove sort option": "Remove sort option",
10+
"Clear": "Clear",
11+
"Bulk Actions": "Bulk Actions",
12+
"Filters": "Filters",
13+
"Applied Filters": "Applied Filters",
14+
"Remove filter option": "Remove filter option",
15+
"Search": "Search",
16+
"Showing": "Showing",
17+
"results": "results",
18+
"You are not connected to the internet.": "You are not connected to the internet.",
19+
"to": "to",
20+
"of": "of"
21+
}

resources/views/bootstrap-4/includes/bulk-actions.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@if (count($bulkActions))
22
<div class="dropdown mb-3 mb-md-0 d-block d-md-inline">
33
<button class="btn dropdown-toggle d-block w-100 d-md-inline" type="button" id="bulkActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
4-
{{ __('Bulk Actions') }}
4+
@lang('Bulk Actions')
55
</button>
66

77
<div class="dropdown-menu dropdown-menu-right w-100" aria-labelledby="bulkActions">

resources/views/bootstrap-4/includes/filters.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@if ($filtersView || count($customFilters))
22
<div class="btn-group d-block d-md-inline">
33
<button type="button" class="btn dropdown-toggle d-block w-100 d-md-inline" data-toggle="dropdown">
4-
{{ __('Filters') }}
4+
@lang('Filters')
55

66
@if (count(array_filter($filters)) && !(count(array_filter($filters)) === 1 && isset($filters['search'])))
77
<span class="badge badge-info">

resources/views/bootstrap-4/includes/pagination.blade.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,21 @@
55
</div>
66

77
<div class="col-12 col-md-6 text-center text-md-right text-muted">
8-
@lang('Showing :first to :last out of :total results', [
9-
'first' => $rows->count() ? $rows->firstItem() : 0,
10-
'last' => $rows->count() ? $rows->lastItem() : 0,
11-
'total' => $rows->total()
12-
])
8+
@lang('Showing')
9+
<strong>{{ $rows->count() ? $rows->firstItem() : 0 }}</strong>
10+
@lang('to')
11+
<strong>{{ $rows->count() ? $rows->lastItem() : 0 }}</strong>
12+
@lang('of')
13+
<strong>{{ $rows->total() }}</strong>
14+
@lang('results')
1315
</div>
1416
</div>
1517
@else
1618
<div class="row">
1719
<div class="col-12 text-muted">
18-
{!! __('Showing <strong>:count</strong> results', ['count' => $rows->count()]) !!}
20+
@lang('Showing')
21+
<strong>{{ $rows->count() }}</strong>
22+
@lang('results')
1923
</div>
2024
</div>
2125
@endif

resources/views/bootstrap-4/includes/table.blade.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@
3030
<x-livewire-tables::bs4.table.cell colspan="{{ count($bulkActions) ? count($columns) + 1 : count($columns) }}">
3131
@unless ($selectAll)
3232
<div>
33-
<span>{!! __('You have selected <strong>:count</strong> rows, do you want to select all <strong>:total</strong>?', ['count' => $rows->count(), 'total' => number_format($rows->total())]) !!}</span>
33+
<span>
34+
@lang('You have selected')
35+
<strong>{{ $rows->count() }}</strong>
36+
@lang('rows, do you want to select all')
37+
<strong>{{ number_format($rows->total()) }}</strong>?
38+
</span>
3439

3540
<button
3641
wire:click="selectAll"
@@ -42,7 +47,11 @@ class="btn btn-primary btn-sm"
4247
</div>
4348
@else
4449
<div>
45-
<span>{!! __('You are currently selecting all <strong>:total</strong> rows.', ['total' => number_format($rows->total())]) !!}</span>
50+
<span>
51+
@lang('You are currently selecting all')
52+
<strong>{{ number_format($rows->total()) }}</strong>
53+
@lang('rows').
54+
</span>
4655

4756
<button
4857
wire:click="resetBulk"
@@ -79,7 +88,7 @@ class="btn btn-primary btn-sm"
7988
@empty
8089
<x-livewire-tables::bs4.table.row>
8190
<x-livewire-tables::bs4.table.cell colspan="{{ count($bulkActions) ? count($columns) + 1 : count($columns) }}">
82-
@lang('No items found. Try narrowing your search.')
91+
@lang($emptyMessage)
8392
</x-livewire-tables::bs4.table.cell>
8493
</x-livewire-tables::bs4.table.row>
8594
@endforelse

resources/views/bootstrap-5/includes/bulk-actions.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@if (count($bulkActions))
22
<div class="dropdown mb-3 mb-md-0 d-block d-md-inline">
33
<button class="btn dropdown-toggle d-block w-100 d-md-inline" type="button" id="bulkActions" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
4-
{{ __('Bulk Actions') }}
4+
@lang('Bulk Actions')
55
</button>
66

77
<div class="dropdown-menu dropdown-menu-end w-100" aria-labelledby="bulkActions">

resources/views/bootstrap-5/includes/filters.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@if ($filtersView || count($customFilters))
22
<div class="btn-group d-block d-md-inline">
33
<button type="button" class="btn dropdown-toggle d-block w-100 d-md-inline" data-bs-toggle="dropdown">
4-
{{ __('Filters') }}
4+
@lang('Filters')
55

66
@if (count(array_filter($filters)) && !(count(array_filter($filters)) === 1 && isset($filters['search'])))
77
<span class="badge bg-info">

resources/views/bootstrap-5/includes/pagination.blade.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,21 @@
55
</div>
66

77
<div class="col-12 col-md-6 text-center text-md-end text-muted">
8-
@lang('Showing :first to :last out of :total results', [
9-
'first' => $rows->count() ? $rows->firstItem() : 0,
10-
'last' => $rows->count() ? $rows->lastItem() : 0,
11-
'total' => $rows->total()
12-
])
8+
@lang('Showing')
9+
<strong>{{ $rows->count() ? $rows->firstItem() : 0 }}</strong>
10+
@lang('to')
11+
<strong>{{ $rows->count() ? $rows->lastItem() : 0 }}</strong>
12+
@lang('of')
13+
<strong>{{ $rows->total() }}</strong>
14+
@lang('results')
1315
</div>
1416
</div>
1517
@else
1618
<div class="row">
1719
<div class="col-12 text-muted">
18-
{!! __('Showing <strong>:count</strong> results', ['count' => $rows->count()]) !!}
20+
@lang('Showing')
21+
<strong>{{ $rows->count() }}</strong>
22+
@lang('results')
1923
</div>
2024
</div>
2125
@endif

resources/views/bootstrap-5/includes/table.blade.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ class="form-check-input"
3131
<x-livewire-tables::bs5.table.cell colspan="{{ count($bulkActions) ? count($columns) + 1 : count($columns) }}">
3232
@unless ($selectAll)
3333
<div>
34-
<span>{!! __('You have selected <strong>:count</strong> rows, do you want to select all <strong>:total</strong>?', ['count' => $rows->count(), 'total' => number_format($rows->total())]) !!}</span>
34+
<span>
35+
@lang('You have selected')
36+
<strong>{{ $rows->count() }}</strong>
37+
@lang('rows, do you want to select all')
38+
<strong>{{ number_format($rows->total()) }}</strong>?
39+
</span>
3540

3641
<button
3742
wire:click="selectAll"
@@ -43,7 +48,11 @@ class="btn btn-primary btn-sm"
4348
</div>
4449
@else
4550
<div>
46-
<span>{!! __('You are currently selecting all <strong>:total</strong> rows.', ['total' => number_format($rows->total())]) !!}</span>
51+
<span>
52+
@lang('You are currently selecting all')
53+
<strong>{{ number_format($rows->total()) }}</strong>
54+
@lang('rows').
55+
</span>
4756

4857
<button
4958
wire:click="resetBulk"
@@ -81,7 +90,7 @@ class="form-check-input"
8190
@empty
8291
<x-livewire-tables::bs5.table.row>
8392
<x-livewire-tables::bs5.table.cell colspan="{{ count($bulkActions) ? count($columns) + 1 : count($columns) }}">
84-
@lang('No items found. Try narrowing your search.')
93+
@lang($emptyMessage)
8594
</x-livewire-tables::bs5.table.cell>
8695
</x-livewire-tables::bs5.table.row>
8796
@endforelse

0 commit comments

Comments
 (0)