Skip to content

Commit 15836e5

Browse files
committed
Add localization to label and placeholder
1 parent fe3d66c commit 15836e5

File tree

6 files changed

+28
-2
lines changed

6 files changed

+28
-2
lines changed

resources/lang/en/filament-google-autocomplete-field.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
return [
44

5+
'autocomplete.label' => 'Address',
6+
'autocomplete.placeholder' => 'Search for an address...',
57
'autocomplete.searching.message' => 'Searching location on Google...',
68
'autocomplete.search.prompt' => 'Type a location to search using Google',
79

resources/lang/he/filament-google-autocomplete-field.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
return [
44

5+
'autocomplete.label' => 'כתובת',
6+
'autocomplete.placeholder' => 'הקלד כתובת לחיפוש...',
57
'autocomplete.searching.message' => 'מחפש מיקום בגוגל...',
68
'autocomplete.search.prompt' => 'הקלד מיקום לחיפוש באמצעות גוגל',
79

resources/lang/it/filament-google-autocomplete-field.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
return [
44

5+
'autocomplete.label' => 'Indirizzo',
6+
'autocomplete.placeholder' => 'Cerca un indirizzo...',
57
'autocomplete.searching.message' => 'Ricerca della posizione su Google in corso...',
68
'autocomplete.search.prompt' => 'Digita un luogo da cercare tramite Google.',
79

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
return [
4+
5+
'autocomplete.label' => 'Adres',
6+
'autocomplete.placeholder' => 'Adres aramak için yazın...',
7+
'autocomplete.searching.message' => 'Aranıyor...',
8+
'autocomplete.search.prompt' => 'Arama yapmak için bir konum yaz',
9+
10+
];

src/Forms/Components/GoogleAutocomplete.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,9 @@ public function autocompleteLabel(string|Closure|null $label): static
280280

281281
protected function getAutocompleteLabel(): string
282282
{
283-
return $this->evaluate($this->autocompleteLabel) ?? $this->getLabel() ?? __('Search');
283+
return $this->evaluate($this->autocompleteLabel)
284+
?: (__('filament-google-autocomplete-field::filament-google-autocomplete-field.autocomplete.label')
285+
?: $this->getLabel());
284286
}
285287

286288
public function autocompleteName(string|Closure|null $name): static
@@ -304,6 +306,7 @@ public function autocompletePlaceholder(string|Closure|null $placeholder): stati
304306

305307
protected function getAutocompletePlaceholder(): string
306308
{
307-
return $this->evaluate($this->autocompletePlaceholder) ?? __('Select an option');
309+
return $this->evaluate($this->autocompletePlaceholder)
310+
?: __('filament-google-autocomplete-field::filament-google-autocomplete-field.autocomplete.placeholder');
308311
}
309312
}

tests/TestCase.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919

2020
class TestCase extends Orchestra
2121
{
22+
/**
23+
* The latest response from the application.
24+
*
25+
* @var \Illuminate\Testing\TestResponse|null
26+
*/
27+
public static $latestResponse;
28+
2229
protected function setUp(): void
2330
{
2431
parent::setUp();

0 commit comments

Comments
 (0)