在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):akaunting/laravel-language开源软件地址(OpenSource Url):https://github.com/akaunting/laravel-language开源编程语言(OpenSource Language):PHP 97.7%开源软件介绍(OpenSource Introduction):Language switcher package for LaravelThis package allows switching locale easily on Laravel projects. It's so simple to use, once it's installed, your App locale will change only by passing routes into SetLanguage middleware. Top features:
Getting Started1. InstallRun the following command:
2. Register (for Laravel < 5.5)Register the service provider in Akaunting\Language\Provider::class, Add alias if you want to use the facade. 'Language' => Akaunting\Language\Facade::class, 3. PublishPublish config, migration and blade files.
4. MigrateAdd locale column to users table:
5. ConfigureDefault values can be modified also on Keys
UsageMiddlewareAll routes in which you want to set language should be under the Route::group(['middleware' => 'language'], function () {
// Here your routes
}); URL
Tip: /languages prefix can be changed from Methodslanguage()->allowed()Returns an array with @foreach (language()->allowed() as $code => $name)
<a href="{{ language()->back($code) }}">{{ $name }}</a>
@endforeach language()->flags()Returns an output with flags for all allowed languages of config.
Output can be changed from language()->flag()Returns the flag of the current locale.
Output can be changed from language()->names($codes = null)Get an array like language()->codes($langs = null)Get an array like language()->back($code)Returns the URL to set up language and return back: Also if you prefer to use directly route() function you can use it as following code: {{ route('language::back', ['locale' => $code]) }} language()->home($code)Returns the URL to set language and return to home: Also if you prefer to use directly route() function you can use it as following code: {{ route('language::home', ['locale' => $code]) }} language()->getName($code = 'default')Returns the language name of Tip: Use app()->getLocale() to get the current locale language()->getCode($name = 'default')Returns the language code of ChangelogPlease see Releases for more information what has changed recently. ContributingPull requests are more than welcome. You must follow the PSR coding standards. SecurityIf you discover any security related issues, please email [email protected] instead of using the issue tracker. CreditsLicenseThe MIT License (MIT). Please see LICENSE for more information. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论