Download the PHP package backpack/language-switcher without Composer
On this page you can find all versions of the php package backpack/language-switcher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download backpack/language-switcher
More information about backpack/language-switcher
Files in backpack/language-switcher
Package language-switcher
Short Description Language Switcher for Backpack
License MIT
Homepage https://github.com/backpack/language-switcher
Informations about the package language-switcher
Language Switcher
This package adds a Language Switcher dropdown for projects using Backpack for Laravel.
Preview
Demo
Try it right now, in our online demo.
Installation
1) In your Laravel project, install this package:
2) Add the middleware to backpack config config/backpack/base.php
:
Optionally, you may add the middleware to the web
, api
or other middleware groups where you may want to use the language switcher, in app/Http/Kernel.php
.
3) Add the dropdown view to topbar_right_content.blade.php
or wherever you need it:
4) In order to add the available languages of your app, you'll need to enable them in the backpack crud config file config/backpack/crud.php
There you can set the array of locales
your app uses. Keep in mind the default locale of your app should remain in config.app.locale
and config.app.fallback_locale
.
Usage
Can I show/hide the main label or flags?
Yes!
You can do it by sending special arguments to the component:
Can I use this package outside of the backpack/admin scope?
Yes!
If you wish to use the language switcher on other parts of your app, you can do it by adding the middleware in app/Http/Kernel.php
.
You can, for instance, enable this for the whole web
middleware group, or the api
.
Can I customize the endpoint routes ?
Yes!
You can do it by publishing the config file php artisan vendor:publish --provider="Backpack\LanguageSwitcher\LanguageSwitcherServiceProvider" --tag="config"
.
There you can totally disable the package route and register your own, or change some behavior related with display urls.
Please take caution to protect the endpoint with throttling or any other security measure if you overwrite the routes. The default package route uses: 'throttle:60,1'
Notes
This package uses outhebox/blade-flags
to get the flags representing languages/locales.
If you find any issue with any with it, like a missing or wrong flag, you can report directly to the maintainer.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Antonio Almeida
- Cristian Tabacitu
- All Contributors
License
This project was released under MIT License, so you can install it on top of any Backpack & Laravel project. Please see the license file for more information.