Skip to content

Commit f1dbc41

Browse files
ashatrovMarc Cámara
authored andcommitted
Update README.md (#449)
Updated "Creating a language selector" section to march fix from #439
1 parent 29f9ea2 commit f1dbc41

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,16 +362,17 @@ This function will return the [ISO 15924](http://www.unicode.org/iso15924) code
362362
If you're supporting multiple locales in your project you will probably want to provide the users with a way to change language. Below is a simple example of blade template code you can use to create your own language selector.
363363

364364
```
365-
<ul class="language_bar_chooser">
366-
@foreach(LaravelLocalization::getSupportedLocales() as $localeCode => $properties)
365+
<ul>
366+
@foreach(LaravelLocalization::getSupportedLocales() as $localeCode => $properties)
367367
<li>
368-
<a rel="alternate" hreflang="{{$localeCode}}" href="{{LaravelLocalization::getLocalizedURL($localeCode) }}">
368+
<a rel="alternate" hreflang="{{ $localeCode }}" href="{{ LaravelLocalization::getLocalizedURL($localeCode, null, [], true) }}">
369369
{{ $properties['native'] }}
370370
</a>
371371
</li>
372-
@endforeach
372+
@endforeach
373373
</ul>
374374
```
375+
Here default language will be forced in getLocalizedURL() to be present in the URL even `hideDefaultLocaleInURL = true`.
375376

376377
## Translated Routes
377378

0 commit comments

Comments
 (0)