Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#293] Cant switch to default language if hiding default locale in URL #439

Conversation

ashatrov
Copy link
Contributor

Related to #293

Fo fix the issue e.g. when you need to draw menu to change language but hideDefaultLocaleInURL set to TRUE and you can't switch to this default language.

                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Languahe <span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                @foreach(LaravelLocalization::getSupportedLocales() as $localeCode => $properties)
                                    <li>
                                        <a rel="alternate" hreflang="{{ $localeCode }}" href="{{ LaravelLocalization::getLocalizedURL($localeCode, null, [], true) }}">
                                            {{ $properties['native'] }}
                                        </a>
                                    </li>
                                @endforeach
                            </ul>
                        </li>

Here default language will be forced in the URL with LaravelLocalization::getLocalizedURL($localeCode, null, [], true).

So hideDefaultLocaleInURL will change default behavior of whole module, but this parameter allow to change it if needed.

@ashatrov
Copy link
Contributor Author

  • Tests improvement
  • Translation method fixed after tests added :)

@mcamara
Copy link
Owner

mcamara commented Apr 25, 2017

Really good PR @ashatrov, thanks for your help!

@mcamara mcamara merged commit 29f9ea2 into mcamara:master Apr 25, 2017
ashatrov added a commit to ashatrov/laravel-localization that referenced this pull request May 10, 2017
Updated "Creating a language selector" section to march fix from mcamara#439
@ashatrov ashatrov mentioned this pull request May 10, 2017
mcamara pushed a commit that referenced this pull request May 11, 2017
Updated "Creating a language selector" section to march fix from #439
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants