marciojc/language-switch
Composer 安装命令:
composer require marciojc/language-switch
包简介
A Laravel Package to switch language
README 文档
README
Website & Documentation: https://github.com/marciojc/language-switch
After creating your new Laravel application you can include the LanguageSwitch package with the following command:
composer require marciojc/language-switch
Add the LanguageSwitch service provider to the config/app.php file in the providers array:
'providers' => [ // Laravel Framework Service Providers... //... // Package Service Providers marciojc\LanguageSwitch\LanguageSwitchServiceProvider::class, // ... // Application Service Providers // ... ],
Now, you can use LanguageSwitch, like this
<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
Route::get(trans('routes.news') . '/{slug}' , [ 'as' => 'newsdetails', 'uses' => 'NewsController@details', 'model' => 'App\News' ]);
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-04-29