diff --git a/CHANGELOG.md b/CHANGELOG.md index cdeda7d..dd8e18c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,20 @@ All notable changes to the "Filament Value Range Filter" will be documented in this file. +## v1.0.1 - 2024-07-31 + +### What's Changed + +* Bump aglipanci/laravel-pint-action from 2.3.1 to 2.4 by @dependabot in https://github.com/TappNetwork/filament-value-range-filter/pull/3 +* Bump dependabot/fetch-metadata from 2.1.0 to 2.2.0 by @dependabot in https://github.com/TappNetwork/filament-value-range-filter/pull/4 +* make select placeholder translatable by @buddhaCode in https://github.com/TappNetwork/filament-value-range-filter/pull/5 + +### New Contributors + +* @buddhaCode made their first contribution in https://github.com/TappNetwork/filament-value-range-filter/pull/5 + +**Full Changelog**: https://github.com/TappNetwork/filament-value-range-filter/compare/v1.0.0...v1.0.1 + ## v1.0.0 - 2024-06-20 ### What's Changed diff --git a/resources/lang/en/filament-value-range-filter.php b/resources/lang/en/filament-value-range-filter.php index 3c16fae..01a3c5b 100644 --- a/resources/lang/en/filament-value-range-filter.php +++ b/resources/lang/en/filament-value-range-filter.php @@ -2,18 +2,19 @@ return [ + 'range.placeholder' => 'Select condition', 'range.options.equal' => 'is equal to', 'range.options.not_equal' => 'is not equal to', 'range.options.between' => 'is between', 'range.options.greater_than' => 'is greater than', - 'range.options.greater_than_eqal' => 'is greater than or equal to', + 'range.options.greater_than_equal' => 'is greater than or equal to', 'range.options.less_than' => 'is less than', 'range.options.less_than_equal' => 'is less than or equal to', 'range.indicator.equal' => ':label is equal to :value', 'range.indicator.not_equal' => ':label is not equal to :value', 'range.indicator.between' => ':label is between :fromValue and :toValue', 'range.indicator.greater_than' => ':label is greater than :value', - 'range.indicator.greater_than_eqal' => ':label is greater than or equal to :value', + 'range.indicator.greater_than_equal' => ':label is greater than or equal to :value', 'range.indicator.less_than' => ':label is less than :value', 'range.indicator.less_than_equal' => ':label is less than or equal to :value', diff --git a/src/Filters/ValueRangeFilter.php b/src/Filters/ValueRangeFilter.php index cd2c5f3..4cf145c 100644 --- a/src/Filters/ValueRangeFilter.php +++ b/src/Filters/ValueRangeFilter.php @@ -42,7 +42,7 @@ protected function setUp(): void ->schema([ Forms\Components\Select::make('range_condition') ->hiddenLabel() - ->placeholder('Select condition') + ->placeholder(__('filament-value-range-filter::filament-value-range-filter.range.placeholder')) ->live() ->options([ 'equal' => __('filament-value-range-filter::filament-value-range-filter.range.options.equal'), @@ -148,13 +148,20 @@ function (Builder $query, $value) use ($data) { $indicators = []; if ($data['range_between_from'] || $data['range_between_to']) { - $indicators[] = Indicator::make($this->getIndicatorBetweenLabel() ?? $this->getLabel().' is between '.$this->getFormattedValue($data['range_between_from']).' and '.$this->getFormattedValue($data['range_between_to'])) + $indicators[] = Indicator::make(__('filament-value-range-filter::filament-value-range-filter.range.indicator.between', [ + 'label' => $this->getIndicatorBetweenLabel() ?? $this->getLabel(), + 'fromValue' => $this->getFormattedValue($data['range_between_from']), + 'toValue' => $this->getFormattedValue($data['range_between_to']), + ])) ->removeField('range_between_from') ->removeField('range_between_to'); } if ($data['range_equal']) { - $indicators[] = Indicator::make($this->getIndicatorEqualLabel() ?? $this->getLabel().' is equal to '.$this->getFormattedValue($data['range_equal'])) + $indicators[] = Indicator::make(__('filament-value-range-filter::filament-value-range-filter.range.indicator.equal', [ + 'label' => $this->getIndicatorEqualLabel() ?? $this->getLabel(), + 'value' => $this->getFormattedValue($data['range_equal']), + ])) ->removeField('range_equal'); } @@ -167,7 +174,10 @@ function (Builder $query, $value) use ($data) { } if ($data['range_greater_than']) { - $indicators[] = Indicator::make($this->getIndicatorGreaterThanLabel() ?? $this->getLabel().' is greater than '.$this->getFormattedValue($data['range_greater_than'])) + $indicators[] = Indicator::make(__('filament-value-range-filter::filament-value-range-filter.range.indicator.greater_than', [ + 'label' => $this->getIndicatorGreaterThanLabel() ?? $this->getLabel(), + 'value' => $this->getFormattedValue($data['range_greater_than']), + ])) ->removeField('range_greater_than'); } @@ -180,7 +190,10 @@ function (Builder $query, $value) use ($data) { } if ($data['range_less_than']) { - $indicators[] = Indicator::make($this->getIndicatorLessThanLabel() ?? $this->getLabel().' is less than '.$this->getFormattedValue($data['range_less_than'])) + $indicators[] = Indicator::make(__('filament-value-range-filter::filament-value-range-filter.range.indicator.less_than', [ + 'label' => $this->getIndicatorLessThanLabel() ?? $this->getLabel(), + 'value' => $this->getFormattedValue($data['range_less_than']), + ])) ->removeField('range_less_than'); }