Skip to content

Commit 1c00975

Browse files
committed
General: Translations Bugfix
General: Fixed issue with Package Publshing name
1 parent 7dddb56 commit 1c00975

File tree

7 files changed

+193
-57
lines changed

7 files changed

+193
-57
lines changed

resources/lang/en/translations.php

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,68 @@
11
<?php
2-
32
return [
3+
'placeholder-select' => 'Select an option',
4+
45
'confirmation' => [
56
'title' => 'Confirm action',
67
'text' => 'Are you sure you want to :name all the :itemsSelected selected item(s) ? Please confirm.',
78
'confirm' => 'Ok, got it',
89
'cancel' => 'Nah, go back',
910
],
1011

12+
'datatables' => [
13+
'title' => 'Items',
14+
'subtitle' => 'Here you can check your latest items',
15+
'resource' => 'Item',
16+
'resources' => 'Items',
17+
18+
'actionsButton' => 'Actions',
19+
'actionsSelectedRows' => 'With :rows selected',
20+
21+
'actionConfirmTitle' => 'Confirm your action',
22+
'actionConfirmText' => 'Are you sure you want to :action on the :itemsSelected item(s) selected? Please confirm',
23+
'actionConfirmButton' => 'Yes, I\'v Confirmed',
24+
'actionCancelButton' => 'Nah, Cancel',
25+
26+
'search' => 'Search',
27+
'searchPlaceholder' => 'Search here for records.',
28+
29+
'selectRows' => 'You currently have :rows item(s) selected',
30+
'selectedUndo' => 'Deselect all',
31+
'selectAllOr' => 'Select current page or',
32+
'selectAllMatching' => 'Select all records matching filter',
33+
'selectAllMatchingUndo' => 'Select only current page',
34+
35+
'filters' => 'Filters',
36+
'filtersBarLabel' => 'Filters',
37+
'filtersWithEmptyData' => 'Oops, seems like there is no records after filtering',
38+
'filtersReset' => 'Reset Filters',
39+
'filtersResetOr' => 'or',
40+
'filtersCopy' => 'Copy Filters Link',
41+
'filtersCopied' => 'Copied to Clipboard',
42+
'filtersSaveAndClose' => 'Save & Close',
43+
'filtersRemove' => 'Remove',
44+
45+
'settings' => 'Settings',
46+
'settingsItemsPerPage' => 'Items p/ Page',
47+
'settingsVisibility' => 'Hidden Columns',
48+
'settingsPersist' => 'Persist Settings',
49+
'settingsPersistSelection' => 'Save Selected',
50+
'settingsReset' => 'Reset to Default Settings',
51+
'settingsSaveAndClose' => 'Save & Close',
52+
53+
'refresh' => 'Refresh',
54+
55+
'recordsEmpty' => 'Seems like there is no records to show you. Please come back later or try inserting some records.',
56+
'recordsEmptyWithFiltersOrSearch' => 'Sorry but there is no records matching your search or filters.',
57+
'recordsEmptyWithFiltersOrSearchAction' => 'Reset Query',
58+
59+
'settingsPerPage' => ':count Items per page',
60+
61+
'showingFrom' => 'Showing :from to :to of :total results',
62+
'nextPage' => 'Next',
63+
'previousPage' => 'Previous',
64+
],
65+
1166
'select' => [
1267
'searchBoxPlaceholder' => 'Write your search query here with 3 minimum characters',
1368
'noResultsText' => 'Sorry but we could not find any results for your search',

resources/lang/pt/translations.php

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?php
2+
3+
return [
4+
5+
'placeholder-select' => 'Selecione uma opção',
6+
7+
'confirmation' => [
8+
'title' => 'Confirmar ação',
9+
'text' => 'Tem a certeza que pretende :name todos os :itemsSelected item(s) selecionados? ? Please confirm.',
10+
'confirm' => 'Ok, entendi',
11+
'cancel' => 'Não, voltar atrás',
12+
],
13+
14+
'datatables' => [
15+
'title' => 'Items',
16+
'subtitle' => 'Aqui pode ver todos os itens disponíveis.',
17+
'resource' => 'Item',
18+
'resources' => 'Items',
19+
20+
'actionsButton' => 'Acções',
21+
'actionsSelectedRows' => 'com os :rows selecionados',
22+
23+
'actionConfirmTitle' => 'Confirmar Acção',
24+
'actionConfirmText' => 'Tem a certeza que pretende :action os :itemsSelected item(s) selecionados? Confirme',
25+
'actionConfirmButton' => 'Sim, Confirmei',
26+
'actionCancelButton' => 'Não, Cancelar',
27+
28+
'search' => 'Procurar',
29+
'searchPlaceholder' => 'Procurar aqui por registos',
30+
31+
'selectRows' => 'Tem neste momento :rows item(s) selecionados',
32+
'selectedUndo' => 'Cancelar seleção',
33+
'selectAllOr' => 'Selecionar página ou',
34+
'selectAllMatching' => 'Selecionar todos os filtrados',
35+
'selectAllMatchingUndo' => 'Selecionar apenas pág. actual',
36+
37+
'filters' => 'Filtros',
38+
'filtersBarLabel' => 'Filtros',
39+
'filtersWithEmptyData' => 'Oops, parece que não existem item(s) aplicáveis para os filtros selecionados.',
40+
'filtersReset' => 'Limpar Filtros',
41+
'filtersResetOr' => 'ou',
42+
'filtersCopy' => 'Copiar Link de Filtros',
43+
'filtersCopied' => 'Copiado para a área de transferência',
44+
'filtersSaveAndClose' => 'Gravar & Fechar',
45+
'filtersRemove' => 'Remover',
46+
47+
'settings' => 'Definições',
48+
'settingsItemsPerPage' => 'Items p/ Página',
49+
'settingsVisibility' => 'Colunas Escondidas',
50+
'settingsPersist' => 'Persistir Definições',
51+
'settingsPersistSelection' => 'Salvar seleção',
52+
'settingsReset' => 'Repor Definições',
53+
'settingsSaveAndClose' => 'Gravar & Fechar',
54+
55+
'refresh' => 'Actualizar',
56+
57+
'recordsEmpty' => 'Parece que não existem registos para mostrar. Volte mais tarde ou tente outra pesquisa.',
58+
'recordsEmptyWithFiltersOrSearch' => 'Não existem registos para mostrar para os seus filtros ou pesquisa.',
59+
'recordsEmptyWithFiltersOrSearchAction' => 'Repor Pesquisa',
60+
61+
'settingsPerPage' => ':count Items p/ Página',
62+
63+
'showingFrom' => 'Mostrar :from até :to de :total registos',
64+
'nextPage' => 'Proxima',
65+
'previousPage' => 'Anterior',
66+
],
67+
68+
'select' => [
69+
'searchBoxPlaceholder' => 'Pesquise aqui com pelo menos 3 caracteres',
70+
'noResultsText' => 'Não foi possível encontrar resultados',
71+
'searchingText' => 'A carregar... aguarde',
72+
'loadingClosedPlaceholder' => 'A carregar... aguarde',
73+
'loadingMoreResultsText' => 'A carregar mais resultados...',
74+
],
75+
];

src/Core/Components/Select.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ class Select extends BaseComponent
1010

1111
public function toArray(): array
1212
{
13+
if(empty($this->getPlaceholder())){
14+
$this->placeholder(trans('vanilla-components::translations.placeholder-select'));
15+
}
16+
1317
return array_merge(parent::toArray(), [
1418
'options' => $this->getOptionsToArray(),
1519
]);

src/Datatables/Concerns/HasPageOptions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function perPageOptions(): array
2020
foreach ($this->perPageDefault as $index => $value) {
2121
$options[] = PerPageOption::make()
2222
->value($value)
23-
->label(trans(':count Item(s) p/ page', ['count' => $value]))
23+
->label(trans('vanilla-components::translations.datatables.settingsPerPage',['count' => $value]))
2424
->default(fn () => $index === 0);
2525
}
2626

@@ -62,6 +62,6 @@ protected function setupPerPageOptions(): void
6262

6363
protected function perPageOptionsToArray(): array
6464
{
65-
return $this->getPerPageOptions()->map(fn ($option) => $option->toArray())->toArray();
65+
return $this->getPerPageOptions()->map(fn ($option) => $option->toArray())->values()->toArray();
6666
}
6767
}

src/Datatables/Concerns/HasTranslations.php

Lines changed: 54 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -10,57 +10,60 @@ trait HasTranslations
1010
protected function getDefaultTranslations(): array
1111
{
1212
return [
13-
'title' => 'Items',
14-
'subtitle' => 'Here you can check your latest items',
15-
'resource' => 'Item',
16-
'resources' => 'Items',
17-
18-
'actionsButton' => 'Actions',
19-
'actionsSelectedRows' => 'With :rows selected',
20-
21-
'actionConfirmTitle' => 'Confirm your action',
22-
'actionConfirmText' => 'Are you sure you want to :action on the :itemsSelected item(s) selected? Please confirm',
23-
'actionConfirmButton' => 'Yes, I\'v Confirmed',
24-
'actionCancelButton' => 'Nah, Cancel',
25-
26-
'search' => 'Search',
27-
'searchPlaceholder' => 'Search your latest Payments',
28-
29-
'selectRows' => 'You currently have :rows payments selected',
30-
'selectedUndo' => 'Deselect all',
31-
'selectAllOr' => 'Select current page or',
32-
'selectAllMatching' => 'Select all records matching filter',
33-
'selectAllMatchingUndo' => 'Select only current page',
34-
35-
'filters' => 'Filters',
36-
'filtersBarLabel' => 'Filters',
37-
'filtersWithEmptyData' => 'Oops, seems like there is no records after filtering',
38-
'filtersReset' => 'Reset Filters',
39-
'filtersResetOr' => 'or',
40-
'filtersCopy' => 'Copy Filters Link',
41-
'filtersCopied' => 'Copied to Clipboard',
42-
'filtersSaveAndClose' => 'Save & Close',
43-
'filtersRemove' => 'Remove',
44-
45-
'settings' => 'Settings',
46-
'settingsItemsPerPage' => 'Items p/ Page',
47-
'settingsVisibility' => 'Hidden Columns',
48-
'settingsPersist' => 'Persist Settings',
49-
'settingsPersistSelection' => 'Save Selected',
50-
'settingsReset' => 'Reset to Default Settings',
51-
'settingsSaveAndClose' => 'Save & Close',
52-
53-
'refresh' => 'Refresh',
54-
55-
'recordsEmpty' => 'Seems like there is no records to show you. Please come back later or try inserting some records.',
56-
'recordsEmptyWithFiltersOrSearch' => 'Sorry but there is no records matching your search or filters.',
57-
'recordsEmptyWithFiltersOrSearchAction' => 'Reset Query',
58-
59-
'settingsPerPage' => ':count Items per page',
60-
61-
'showingFrom' => 'Showing :from to :to of :total results',
62-
'nextPage' => 'Next',
63-
'previousPage' => 'Previous',
13+
'title' => trans('vanilla-components::translations.datatables.title'),
14+
'subtitle' => trans('vanilla-components::translations.datatables.subtitle'),
15+
'resource' => trans('vanilla-components::translations.datatables.resource'),
16+
'resources' => trans('vanilla-components::translations.datatables.resources'),
17+
18+
'actionsButton' => trans('vanilla-components::translations.datatables.actionsButton'),
19+
'actionsSelectedRows' => trans('vanilla-components::translations.datatables.actionsSelectedRows'),
20+
21+
'actionConfirmTitle' => trans('vanilla-components::translations.datatables.actionConfirmTitle'),
22+
'actionConfirmText' => trans('vanilla-components::translations.datatables.actionConfirmText'),
23+
'actionConfirmButton' => trans('vanilla-components::translations.datatables.actionConfirmButton'),
24+
'actionCancelButton' => trans('vanilla-components::translations.datatables.actionCancelButton'),
25+
26+
'search' => trans('vanilla-components::translations.datatables.search'),
27+
'searchPlaceholder' => trans('vanilla-components::translations.datatables.searchPlaceholder'),
28+
29+
'selectRows' => trans('vanilla-components::translations.datatables.selectRows'),
30+
'selectedUndo' => trans('vanilla-components::translations.datatables.selectedUndo'),
31+
'selectAllOr' => trans('vanilla-components::translations.datatables.selectAllOr'),
32+
'selectAllMatching' => trans('vanilla-components::translations.datatables.selectAllMatching'),
33+
'selectAllMatchingUndo' => trans('vanilla-components::translations.datatables.selectAllMatchingUndo'),
34+
35+
'filters' => trans('vanilla-components::translations.datatables.filters'),
36+
'filtersBarLabel' => trans('vanilla-components::translations.datatables.filtersBarLabel'),
37+
'filtersWithEmptyData' => trans('vanilla-components::translations.datatables.filtersWithEmptyData'),
38+
'filtersReset' => trans('vanilla-components::translations.datatables.filtersReset'),
39+
'filtersResetOr' => trans('vanilla-components::translations.datatables.filtersResetOr'),
40+
'filtersCopy' => trans('vanilla-components::translations.datatables.filtersCopy'),
41+
'filtersCopied' => trans('vanilla-components::translations.datatables.filtersCopied'),
42+
'filtersSaveAndClose' => trans('vanilla-components::translations.datatables.filtersSaveAndClose'),
43+
'filtersRemove' => trans('vanilla-components::translations.datatables.filtersRemove'),
44+
45+
'settings' => trans('vanilla-components::translations.datatables.settings'),
46+
'settingsItemsPerPage' => trans('vanilla-components::translations.datatables.settingsItemsPerPage'),
47+
'settingsVisibility' => trans('vanilla-components::translations.datatables.settingsVisibility'),
48+
'settingsPersist' => trans('vanilla-components::translations.datatables.settingsPersist'),
49+
'settingsPersistSelection' => trans('vanilla-components::translations.datatables.settingsPersistSelection'),
50+
'settingsReset' => trans('vanilla-components::translations.datatables.settingsReset'),
51+
'settingsSaveAndClose' => trans('vanilla-components::translations.datatables.settingsSaveAndClose'),
52+
53+
'refresh' => trans('vanilla-components::translations.datatables.refresh'),
54+
55+
'recordsEmpty' => trans('vanilla-components::translations.datatables.recordsEmpty'),
56+
'recordsEmptyWithFiltersOrSearch' => trans('vanilla-components::translations.datatables.recordsEmptyWithFiltersOrSearch'),
57+
'recordsEmptyWithFiltersOrSearchAction' => trans('vanilla-components::translations.datatables.recordsEmptyWithFiltersOrSearchAction'),
58+
59+
'settingsPerPage' => trans('vanilla-components::translations.datatables.settingsPerPage'),
60+
'selectOption' => trans('vanilla-components::translations.placeholder-select'),
61+
62+
'showingFrom' => trans('vanilla-components::translations.datatables.showingFrom'),
63+
'nextPage' => trans('vanilla-components::translations.datatables.nextPage'),
64+
'previousPage' => trans('vanilla-components::translations.datatables.previousPage'),
65+
66+
6467
];
6568
}
6669

src/Datatables/Datatable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function toArray(): array
5656
'actions' => $this->actionsToArray(),
5757
'columns' => $this->columnsToArray(),
5858
'filters' => $this->filtersToArray(),
59-
'pageOptions' => $this->perPageOptionsToArray(),
59+
'perPageOptions' => $this->perPageOptionsToArray(),
6060
'poolingOptions' => $this->pollingToArray(),
6161
'options' => $this->optionsToArray(),
6262
'translations' => $this->translationsToArray(),

src/VanillaComponentsServiceProvider.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ public function configurePackage(Package $package): void
1616
* More info: https://github.com/spatie/laravel-package-tools
1717
*/
1818
$package
19-
->name('laravel-vanilla-components')
19+
->name('vanilla-components')
2020
->hasConfigFile()
2121
->hasTranslations()
22-
//->hasMigration('create_laravel-vanilla-components_table')
2322
->hasCommand(VanillaComponentsCommand::class);
2423
}
2524
}

0 commit comments

Comments
 (0)