← Back to Plugins
  • Language Switch

Language Switch

Plugin information

by Bezhan Salleh • 11 stars

Admin panel

Zero config Language Switch(Changer/Localizer) plugin for Filamentphp Admin

Support

#language-switch on Discord

Views

878

License

MIT

Documentation

Installation

Install the package via composer:

composer require bezhansalleh/filament-language-switch

Publish the config file with:

php artisan vendor:publish --tag="filament-language-switch-config"

Set your preferred options:

<?php
 
return [
 
/*
|--------------------------------------------------------------------------
| Carbon Locale(Language)
|--------------------------------------------------------------------------
|
| Option to whether change the language for carbon library or not.
|
*/
'carbon' => true,
 
/*
|--------------------------------------------------------------------------
| Language display name
|--------------------------------------------------------------------------
|
| Option to whether dispaly the language in English or Native.
|
*/
'native' => true,
 
/*
|--------------------------------------------------------------------------
| All Locales (Languages)
|--------------------------------------------------------------------------
|
| Uncomment the languages that your site supports - or add new ones.
| These are sorted by the native name, which is the order you might show them in a language selector.
|
*/
 
'locales' => [
'ar' => ['name' => 'Arabic', 'script' => 'Arab', 'native' => 'العربية', 'flag_code' => 'sa'],
'en' => ['name' => 'English', 'script' => 'Latn', 'native' => 'English', 'flag_code' => 'us'],
// 'fr' => ['name' => 'French', 'script' => 'Latn', 'native' => 'français', 'flag_code' => 'fr'],
 
// 'ace' => ['name' => 'Achinese', 'script' => 'Latn', 'native' => 'Aceh', 'flag_code' => '' ],
//'af' => ['name' => 'Afrikaans', 'script' => 'Latn', 'native' => 'Afrikaans', 'flag_code' => '' ],
//'agq' => ['name' => 'Aghem', 'script' => 'Latn', 'native' => 'Aghem', 'flag_code' => '' ],
//'ak' => ['name' => 'Akan', 'script' => 'Latn', 'native' => 'Akan', 'flag_code' => '' ],
//'an' => ['name' => 'Aragonese', 'script' => 'Latn', 'native' => 'aragonés', 'flag_code' => '' ],
//'cch' => ['name' => 'Atsam', 'script' => 'Latn', 'native' => 'Atsam', 'flag_code' => '' ],
//'gn' => ['name' => 'Guaraní', 'script' => 'Latn', 'native' => 'Avañe’ẽ', 'flag_code' => '' ],
//'ae' => ['name' => 'Avestan', 'script' => 'Latn', 'native' => 'avesta', 'flag_code' => '' ],
//'ay' => ['name' => 'Aymara', 'script' => 'Latn', 'native' => 'aymar aru', 'flag_code' => '' ],
//'az' => ['name' => 'Azerbaijani (Latin)', 'script' => 'Latn', 'native' => 'azərbaycanca', 'flag_code' => '' ],
...
]
];

That's it, everything is now ready to be deployed.

Note You can find the supported country flag codes here flag codes

Optionally, you can publish the views using

php artisan vendor:publish --tag="filament-language-switch-views"

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

If you want to contribute to this packages, you may want to test it in a real Filament project:

Install the packages in your app's composer.json:

"require": {
"bezhansalleh/filament-language-switch": "dev-fix/error-message as main-dev",
},
"repositories": [
{
"type": "path",
"url": "filament-language-switch"
}
]

Now, run composer update.

Please see CONTRIBUTING for details.