mlatjac/fren

Setup bilingual (French and English) Laravel projects easily.

0.0.1 2019-11-25 03:05 UTC

This package is auto-updated.

Last update: 2024-04-21 19:55:11 UTC


README

Latest Version on Packagist Total Downloads Build Status StyleCI

Laravel package that supplies language tracking and language switching services and pulls in commonly used multi-language packages to create a sane basis for bilingual (French and English) Laravel apps.

Take a look at contributing.md to see a to do list.

Installation

Via Composer

$ composer require mlatjac/fren

Usage

Language middleware

The Language middleware sets the app's current locale to the currently selected language.

The package inserts this middleware in the middleware stack for all web routes.

To specifically invoke this middleware on a route, you can use its 'lang' alias, as in:

Route::get('/', function () {
    return view('welcome');
})->middleware('lang');

Language switching routes

This package registers language switching routes. These routes update the currently selected language and redirect back to the calling url.

The url '/lang/en' will switch the current language to English, the '/lang/fr' will switch the current language to French.

Use its route name 'lang.switch' along with its languageCode parameter with url builders, as in:

url(route('lang.switch',['languageCode' => 'en']))

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits

License

license. Please see the license file for more information.