2017 © Pedro Peláez
 

library language-switch

A Laravel Package to switch language

image

marciojc/language-switch

A Laravel Package to switch language

  • Monday, May 1, 2017
  • by marciojc
  • Repository
  • 1 Watchers
  • 1 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Language Switch

Website & Documentation: https://github.com/marciojc/language-switch, (*1)


After creating your new Laravel application you can include the LanguageSwitch package with the following command:, (*2)

composer require marciojc/language-switch

Add the LanguageSwitch service provider to the config/app.php file in the providers array:, (*3)

'providers' => [
    // Laravel Framework Service Providers...
    //...

    // Package Service Providers
    marciojc\LanguageSwitch\LanguageSwitchServiceProvider::class,
    // ...

    // Application Service Providers
    // ...
],

Now, you can use LanguageSwitch, like this, (*4)

<div class="language">
  @if (App::getLocale() == 'pt')
    <a class="lang-link" href="{{getTranslationUrl('en')}}">{{ trans('common.en') }}</a>
  @else
    <a class="lang-link" href="{{getTranslationUrl('pt')}}">{{ trans('common.pt') }}</a>
  @endif
</div>

When your route use some id or slug, you must say what model to use, (*5)

Route::get(trans('routes.news') . '/{slug}' , [
  'as'           => 'newsdetails',
  'uses'         => 'NewsController@details',
  'model'        => 'App\News'
]);

The Versions

01/05 2017

dev-master

9999999-dev

A Laravel Package to switch language

  Sources   Download

MIT

The Requires

 

The Development Requires

by Márcio Coelho

laravel language locale i18n

30/04 2017

1.0.0

1.0.0.0

A Laravel Package to switch language

  Sources   Download

MIT

The Requires

 

The Development Requires

by Márcio Coelho

30/04 2017

dev-develop

dev-develop

A Laravel Package to switch language

  Sources   Download

MIT

The Requires

 

The Development Requires

by Márcio Coelho