Skip to content

Commit d10636d

Browse files
committed
fix: Add translation files
1 parent 073f52e commit d10636d

File tree

7 files changed

+81
-33
lines changed

7 files changed

+81
-33
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ Install the package via composer (requires filament >= 2.10.40)
1010
composer require webbingbrasil/filament-advancedfilter
1111
```
1212

13+
Optionally you can publish the translation files
14+
15+
```php
16+
php artisan vendor:publish --tag="filament-advancedfilter-translations"
17+
```
18+
1319
## Available Filters
1420

1521
### BooleanFilter

resources/lang/en/clauses.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
return [
4+
'true' => 'Is true',
5+
'false' => 'Is false',
6+
'set' => 'Is set',
7+
'not_set' => 'Is not set',
8+
'equal' => 'Is equal to',
9+
'not_equal' => 'Is not equal to',
10+
'greater_equal' => 'Is on or after',
11+
'less_equal' => 'Is on or before',
12+
'greater_than' => 'Is more than',
13+
'less_than' => 'Is less than',
14+
'between' => 'Is between',
15+
'start_with' => 'Starts with',
16+
'not_start_with' => 'Does not start with',
17+
'end_with' => 'Ends with',
18+
'not_end_with' => 'Does not end with',
19+
'contain' => 'Contains',
20+
'not_contain' => 'Does not contain',
21+
];

resources/lang/pt-BR/clauses.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
return [
4+
'true' => 'É verdadeiro',
5+
'false' => 'É falso',
6+
'set' => 'Está definido',
7+
'not_set' => 'Não está definido',
8+
'equal' => 'É igual a',
9+
'not_equal' => 'Não é igual a',
10+
'greater_equal' => 'É igual ou depois',
11+
'less_equal' => 'É igual ou antes',
12+
'greater_than' => 'É mais que',
13+
'less_than' => 'É menos do que',
14+
'between' => 'Está entre',
15+
'start_with' => 'Começa com',
16+
'not_start_with' => 'Não começa com',
17+
'end_with' => 'Termina com',
18+
'not_end_with' => 'Não termina com',
19+
'contain' => 'Contém',
20+
'not_contain' => 'Não contém',
21+
];

src/Filters/BooleanFilter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ class BooleanFilter extends Filter
2121
protected function clauses(): array
2222
{
2323
return [
24-
static::CLAUSE_IS_TRUE => 'Is true',
25-
static::CLAUSE_IS_FALSE => 'Is false',
24+
static::CLAUSE_IS_TRUE => __('filament-advancedfilter::clauses.true'),
25+
static::CLAUSE_IS_FALSE => __('filament-advancedfilter::clauses.false'),
2626
] + ($this->showUnknowns && $this->nullsAre === null ? [
27-
self::CLAUSE_SET => 'Is set',
28-
self::CLAUSE_NOT_SET => 'Is not set',
27+
self::CLAUSE_SET => __('filament-advancedfilter::clauses.set'),
28+
self::CLAUSE_NOT_SET => __('filament-advancedfilter::clauses.not_set'),
2929
] : []);
3030
}
3131

src/Filters/DateFilter.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ class DateFilter extends Filter
2727
protected function clauses(): array
2828
{
2929
return [
30-
static::CLAUSE_EQUAL => 'Is equal to',
31-
static::CLAUSE_NOT_EQUAL => 'Is not equal to',
32-
static::CLAUSE_GREATER_OR_EQUAL => 'Is on or after',
33-
static::CLAUSE_LESS_OR_EQUAL => 'Is on or before',
34-
static::CLAUSE_GREATER_THAN => 'Is more than',
35-
static::CLAUSE_LESS_THAN => 'Is less than',
36-
static::CLAUSE_BETWEEN => 'Is between',
37-
static::CLAUSE_SET => 'Is set',
38-
static::CLAUSE_NOT_SET => 'Is not set',
30+
static::CLAUSE_EQUAL => __('filament-advancedfilter::clauses.equal'),
31+
static::CLAUSE_NOT_EQUAL => __('filament-advancedfilter::clauses.not_equal'),
32+
static::CLAUSE_GREATER_OR_EQUAL => __('filament-advancedfilter::clauses.greater_equal'),
33+
static::CLAUSE_LESS_OR_EQUAL => __('filament-advancedfilter::clauses.less_equal'),
34+
static::CLAUSE_GREATER_THAN => __('filament-advancedfilter::clauses.greater_than'),
35+
static::CLAUSE_LESS_THAN => __('filament-advancedfilter::clauses.less_than'),
36+
static::CLAUSE_BETWEEN => __('filament-advancedfilter::clauses.between'),
37+
static::CLAUSE_SET => __('filament-advancedfilter::clauses.set'),
38+
static::CLAUSE_NOT_SET => __('filament-advancedfilter::clauses.not_set'),
3939
];
4040
}
4141

src/Filters/NumberFilter.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ class NumberFilter extends Filter
2424
protected function clauses(): array
2525
{
2626
return [
27-
static::CLAUSE_EQUAL => 'Is equal to',
28-
static::CLAUSE_NOT_EQUAL => 'Is not equal to',
29-
static::CLAUSE_GREATER_OR_EQUAL => 'Is greater than or equal to',
30-
static::CLAUSE_LESS_OR_EQUAL => 'Is less than or equal to',
31-
static::CLAUSE_GREATER_THAN => 'Is greater than',
32-
static::CLAUSE_LESS_THAN => 'Is less than',
33-
static::CLAUSE_BETWEEN => 'Is between',
34-
static::CLAUSE_SET => 'Is set',
35-
static::CLAUSE_NOT_SET => 'Is not set',
27+
static::CLAUSE_EQUAL => __('filament-advancedfilter::clauses.equal'),
28+
static::CLAUSE_NOT_EQUAL => __('filament-advancedfilter::clauses.not_equal'),
29+
static::CLAUSE_GREATER_OR_EQUAL => __('filament-advancedfilter::clauses.greater_equal'),
30+
static::CLAUSE_LESS_OR_EQUAL => __('filament-advancedfilter::clauses.less_equal'),
31+
static::CLAUSE_GREATER_THAN => __('filament-advancedfilter::clauses.greater_than'),
32+
static::CLAUSE_LESS_THAN => __('filament-advancedfilter::clauses.less_than'),
33+
static::CLAUSE_BETWEEN => __('filament-advancedfilter::clauses.between'),
34+
static::CLAUSE_SET => __('filament-advancedfilter::clauses.set'),
35+
static::CLAUSE_NOT_SET => __('filament-advancedfilter::clauses.not_set'),
3636
];
3737
}
3838

src/Filters/TextFilter.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ class TextFilter extends Filter
2525
protected function clauses(): array
2626
{
2727
return [
28-
static::CLAUSE_EQUAL => 'Is equal to',
29-
static::CLAUSE_NOT_EQUAL => 'Is not equal to',
30-
static::CLAUSE_START_WITH => 'Start with',
31-
static::CLAUSE_NOT_START_WITH => 'Not start with',
32-
static::CLAUSE_END_WITH => 'End with',
33-
static::CLAUSE_NOT_END_WITH => 'Not end with',
34-
static::CLAUSE_CONTAIN => 'Contain',
35-
static::CLAUSE_NOT_CONTAIN => 'Not contain',
36-
static::CLAUSE_SET => 'Is set',
37-
static::CLAUSE_NOT_SET => 'Is not set',
28+
static::CLAUSE_EQUAL => __('filament-advancedfilter::clauses.equal'),
29+
static::CLAUSE_NOT_EQUAL => __('filament-advancedfilter::clauses.not_equal'),
30+
static::CLAUSE_START_WITH => __('filament-advancedfilter::clauses.start_with'),
31+
static::CLAUSE_NOT_START_WITH => __('filament-advancedfilter::clauses.not_start_with'),
32+
static::CLAUSE_END_WITH => __('filament-advancedfilter::clauses.end_with'),
33+
static::CLAUSE_NOT_END_WITH => __('filament-advancedfilter::clauses.not_end_with'),
34+
static::CLAUSE_CONTAIN => __('filament-advancedfilter::clauses.contain'),
35+
static::CLAUSE_NOT_CONTAIN => __('filament-advancedfilter::clauses.not_contain'),
36+
static::CLAUSE_SET => __('filament-advancedfilter::clauses.set'),
37+
static::CLAUSE_NOT_SET => __('filament-advancedfilter::clauses.not_set'),
3838
];
3939
}
4040

@@ -65,7 +65,7 @@ protected function fields(): array
6565
->hidden(fn($get) => in_array(
6666
$get('clause'),
6767
[self::CLAUSE_NOT_SET, self::CLAUSE_SET]
68-
) || !empty($get('clause')))
68+
) || empty($get('clause')))
6969
->disableLabel(),
7070
];
7171
}

0 commit comments

Comments
 (0)