F
Filament4mo ago
WEBMAS

How to make multilingual?

Hello everyone. I want to make a choice of interface language. What are the best plugins for this? Is there a guide? How to create fields in a database for different languages. What's the best practice?
11 Replies
Blackpig
Blackpig4mo ago
There's the Filament package for Spatie Translatable https://filamentphp.com/plugins/filament-spatie-translatable
Filament
Spatie Translatable by Filament - Filament
Filament support for Spatie's Laravel Translatable package.
WEBMAS
WEBMAS4mo ago
Filament
Language Switch by Bezhan Salleh - Filament
Zero config Language Switcher plugin for Filament Panels.
dissto
dissto4mo ago
In your case you want both plugins 😂 Spatie Translatable to translate your content and the switch for your users to change the language (of the UI) with ease. Note that the first plugin is for translating content as opposed to the UI. For that you can just use the regular localization feature.
WEBMAS
WEBMAS4mo ago
I will need this setting https://laravel.com/docs/10.x/localization from Laravel. On the Filament side, what setting or plugin is needed? Tasks: 1. Localization of the admin panel interface (UI) 2. Localization of some post fields, for example Title 3. Switch language What plugins and settings will be needed for this? Can you create a consistent guide? Thank you.
awcodes
awcodes4mo ago
dissto is correct it’s two different plugins controlling two different things. The Filament plugin allows you to change the language for form input / storage. Bezhan’s plugin changes the app locale at the Laravel level.
WEBMAS
WEBMAS4mo ago
So what should I do to complete the tasks? Which case should I use?
awcodes
awcodes4mo ago
Depends on your app needs. You can certainly use them both at the same time.
WEBMAS
WEBMAS4mo ago
Here is the basic need for localization: - Localization of the admin panel interface (UI) - Localization of some post table form fields, for example "Title" (en Title, es Title and etc) - Switch language
awcodes
awcodes4mo ago
Yea. So use both.
WEBMAS
WEBMAS4mo ago
Will the language packs be common between the two plugins? Is it best practice to use these two plugins or are there better solutions?
awcodes
awcodes4mo ago
What language packs? The languages are handled by your app at the Laravel level. There is no best or worst practice. Nor have I seen a plugin that does both. Just try them out. See if they work for you. Create a new branch for your app, install them, see if they work for you. If they don’t just delete the branch and try to find another solution.