Skip to content

Commit ba101bd

Browse files
committed
Update README.md
1 parent 8226b57 commit ba101bd

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,25 @@ app('geocoder')->geocode('8.8.8.8')->get();
290290
app('geocoder')->reverse(43.882587,-103.454067)->get();
291291
```
292292

293+
#### Localizing Results
294+
Use the `locale()` method to request localized formatting from providers that
295+
support it (GoogleMaps, Nominatim, etc.). Results are cached separately per
296+
locale, so switching locales doesn't pollute each other's cache entries:
297+
```php
298+
app('geocoder')->locale('it')->geocode('Bologna')->get();
299+
app('geocoder')->locale('fr')->reverse(45.5, -73.5)->get();
300+
```
301+
302+
If you need to build a query with additional options, you can also set the
303+
locale directly on a query and pass it through `geocodeQuery()` or
304+
`reverseQuery()`:
305+
```php
306+
use Geocoder\Query\GeocodeQuery;
307+
308+
$query = GeocodeQuery::create('Bologna')->withLocale('it');
309+
app('geocoder')->geocodeQuery($query)->get();
310+
```
311+
293312
#### Dumping Results
294313
```php
295314
app('geocoder')->geocode('Los Angeles, CA')->dump('kml');

0 commit comments

Comments
 (0)