Skip to content

Commit

Permalink
fix: Add translation files
Browse files Browse the repository at this point in the history
  • Loading branch information
dmandrade committed Apr 8, 2022
1 parent 073f52e commit d10636d
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 33 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Install the package via composer (requires filament >= 2.10.40)
composer require webbingbrasil/filament-advancedfilter
```

Optionally you can publish the translation files

```php
php artisan vendor:publish --tag="filament-advancedfilter-translations"
```

## Available Filters

### BooleanFilter
Expand Down
21 changes: 21 additions & 0 deletions resources/lang/en/clauses.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

return [
'true' => 'Is true',
'false' => 'Is false',
'set' => 'Is set',
'not_set' => 'Is not set',
'equal' => 'Is equal to',
'not_equal' => 'Is not equal to',
'greater_equal' => 'Is on or after',
'less_equal' => 'Is on or before',
'greater_than' => 'Is more than',
'less_than' => 'Is less than',
'between' => 'Is between',
'start_with' => 'Starts with',
'not_start_with' => 'Does not start with',
'end_with' => 'Ends with',
'not_end_with' => 'Does not end with',
'contain' => 'Contains',
'not_contain' => 'Does not contain',
];
21 changes: 21 additions & 0 deletions resources/lang/pt-BR/clauses.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

return [
'true' => 'É verdadeiro',
'false' => 'É falso',
'set' => 'Está definido',
'not_set' => 'Não está definido',
'equal' => 'É igual a',
'not_equal' => 'Não é igual a',
'greater_equal' => 'É igual ou depois',
'less_equal' => 'É igual ou antes',
'greater_than' => 'É mais que',
'less_than' => 'É menos do que',
'between' => 'Está entre',
'start_with' => 'Começa com',
'not_start_with' => 'Não começa com',
'end_with' => 'Termina com',
'not_end_with' => 'Não termina com',
'contain' => 'Contém',
'not_contain' => 'Não contém',
];
8 changes: 4 additions & 4 deletions src/Filters/BooleanFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ class BooleanFilter extends Filter
protected function clauses(): array
{
return [
static::CLAUSE_IS_TRUE => 'Is true',
static::CLAUSE_IS_FALSE => 'Is false',
static::CLAUSE_IS_TRUE => __('filament-advancedfilter::clauses.true'),
static::CLAUSE_IS_FALSE => __('filament-advancedfilter::clauses.false'),
] + ($this->showUnknowns && $this->nullsAre === null ? [
self::CLAUSE_SET => 'Is set',
self::CLAUSE_NOT_SET => 'Is not set',
self::CLAUSE_SET => __('filament-advancedfilter::clauses.set'),
self::CLAUSE_NOT_SET => __('filament-advancedfilter::clauses.not_set'),
] : []);
}

Expand Down
18 changes: 9 additions & 9 deletions src/Filters/DateFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ class DateFilter extends Filter
protected function clauses(): array
{
return [
static::CLAUSE_EQUAL => 'Is equal to',
static::CLAUSE_NOT_EQUAL => 'Is not equal to',
static::CLAUSE_GREATER_OR_EQUAL => 'Is on or after',
static::CLAUSE_LESS_OR_EQUAL => 'Is on or before',
static::CLAUSE_GREATER_THAN => 'Is more than',
static::CLAUSE_LESS_THAN => 'Is less than',
static::CLAUSE_BETWEEN => 'Is between',
static::CLAUSE_SET => 'Is set',
static::CLAUSE_NOT_SET => 'Is not set',
static::CLAUSE_EQUAL => __('filament-advancedfilter::clauses.equal'),
static::CLAUSE_NOT_EQUAL => __('filament-advancedfilter::clauses.not_equal'),
static::CLAUSE_GREATER_OR_EQUAL => __('filament-advancedfilter::clauses.greater_equal'),
static::CLAUSE_LESS_OR_EQUAL => __('filament-advancedfilter::clauses.less_equal'),
static::CLAUSE_GREATER_THAN => __('filament-advancedfilter::clauses.greater_than'),
static::CLAUSE_LESS_THAN => __('filament-advancedfilter::clauses.less_than'),
static::CLAUSE_BETWEEN => __('filament-advancedfilter::clauses.between'),
static::CLAUSE_SET => __('filament-advancedfilter::clauses.set'),
static::CLAUSE_NOT_SET => __('filament-advancedfilter::clauses.not_set'),
];
}

Expand Down
18 changes: 9 additions & 9 deletions src/Filters/NumberFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ class NumberFilter extends Filter
protected function clauses(): array
{
return [
static::CLAUSE_EQUAL => 'Is equal to',
static::CLAUSE_NOT_EQUAL => 'Is not equal to',
static::CLAUSE_GREATER_OR_EQUAL => 'Is greater than or equal to',
static::CLAUSE_LESS_OR_EQUAL => 'Is less than or equal to',
static::CLAUSE_GREATER_THAN => 'Is greater than',
static::CLAUSE_LESS_THAN => 'Is less than',
static::CLAUSE_BETWEEN => 'Is between',
static::CLAUSE_SET => 'Is set',
static::CLAUSE_NOT_SET => 'Is not set',
static::CLAUSE_EQUAL => __('filament-advancedfilter::clauses.equal'),
static::CLAUSE_NOT_EQUAL => __('filament-advancedfilter::clauses.not_equal'),
static::CLAUSE_GREATER_OR_EQUAL => __('filament-advancedfilter::clauses.greater_equal'),
static::CLAUSE_LESS_OR_EQUAL => __('filament-advancedfilter::clauses.less_equal'),
static::CLAUSE_GREATER_THAN => __('filament-advancedfilter::clauses.greater_than'),
static::CLAUSE_LESS_THAN => __('filament-advancedfilter::clauses.less_than'),
static::CLAUSE_BETWEEN => __('filament-advancedfilter::clauses.between'),
static::CLAUSE_SET => __('filament-advancedfilter::clauses.set'),
static::CLAUSE_NOT_SET => __('filament-advancedfilter::clauses.not_set'),
];
}

Expand Down
22 changes: 11 additions & 11 deletions src/Filters/TextFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ class TextFilter extends Filter
protected function clauses(): array
{
return [
static::CLAUSE_EQUAL => 'Is equal to',
static::CLAUSE_NOT_EQUAL => 'Is not equal to',
static::CLAUSE_START_WITH => 'Start with',
static::CLAUSE_NOT_START_WITH => 'Not start with',
static::CLAUSE_END_WITH => 'End with',
static::CLAUSE_NOT_END_WITH => 'Not end with',
static::CLAUSE_CONTAIN => 'Contain',
static::CLAUSE_NOT_CONTAIN => 'Not contain',
static::CLAUSE_SET => 'Is set',
static::CLAUSE_NOT_SET => 'Is not set',
static::CLAUSE_EQUAL => __('filament-advancedfilter::clauses.equal'),
static::CLAUSE_NOT_EQUAL => __('filament-advancedfilter::clauses.not_equal'),
static::CLAUSE_START_WITH => __('filament-advancedfilter::clauses.start_with'),
static::CLAUSE_NOT_START_WITH => __('filament-advancedfilter::clauses.not_start_with'),
static::CLAUSE_END_WITH => __('filament-advancedfilter::clauses.end_with'),
static::CLAUSE_NOT_END_WITH => __('filament-advancedfilter::clauses.not_end_with'),
static::CLAUSE_CONTAIN => __('filament-advancedfilter::clauses.contain'),
static::CLAUSE_NOT_CONTAIN => __('filament-advancedfilter::clauses.not_contain'),
static::CLAUSE_SET => __('filament-advancedfilter::clauses.set'),
static::CLAUSE_NOT_SET => __('filament-advancedfilter::clauses.not_set'),
];
}

Expand Down Expand Up @@ -65,7 +65,7 @@ protected function fields(): array
->hidden(fn($get) => in_array(
$get('clause'),
[self::CLAUSE_NOT_SET, self::CLAUSE_SET]
) || !empty($get('clause')))
) || empty($get('clause')))
->disableLabel(),
];
}
Expand Down

0 comments on commit d10636d

Please sign in to comment.