Giter VIP home page Giter VIP logo

filament-language-switch's Introduction

Filament Language Switch

FILAMENT 8.x Packagist Tests Passing Code Style Passing Downloads


Filament Language(Locale) Switcher

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

  • For Filamentphp 2.x use version 1.x

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"

Configure your preferred options and then register the plugin to your panel(s).

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"

Plugin Usage

Using the plugin is easy all you need to do is instanciate it to the Panels you want the plugin to be available in.

public function panel(Panel $panel): Panel
{
    return $panel
        ...
        ->plugins([
            FilamentLanguageSwitchPlugin::make()
        ])
        ...
}

Customize Render Hook

By default the switch render in the panels::global-search.after hook but you can render the Language Switch in any of the Render Hooks available in Filamentphp using the renderHookName() method inside your panel's plugins() method.

public function panel(Panel $panel): Panel
{
    return $panel
        ...
        ->plugins([
            FilamentLanguageSwitchPlugin::make()
                ->renderHookName('panels::global-search.before'),
        ])
        ...
}

Custom Theme

By default the plugin uses the default theme of Filamentphp, but you can customize it by adding the plugins view path into the content array of your tailwind.config.js file:

export default {
    content: [
        // ...
        './vendor/bezhansalleh/filament-language-switch/resources/views/language-switch.blade.php',
    ],
    // ...
}

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:

  • Fork this repository to your GitHub account.
  • Create a Filament app locally.
  • Clone your fork in your Filament app's root directory.
  • In the /filament-language-switch directory, create a branch for your fix, e.g. fix/error-message.

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.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

filament-language-switch's People

Contributors

bezhansalleh avatar dependabot[bot] avatar github-actions[bot] avatar medeiroz avatar erjanmx avatar dev3k avatar lukas-frey avatar mustafa-online avatar robin-dongbin avatar ziming avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.