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
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.
How is it different from this https://filamentphp.com/plugins/bezhansalleh-language-switch?
Filament
Language Switch by Bezhan Salleh - Filament
Zero config Language Switcher plugin for Filament Panels.
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.
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.
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.
So what should I do to complete the tasks? Which case should I use?
Depends on your app needs. You can certainly use them both at the same time.
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
Yea. So use both.
Will the language packs be common between the two plugins? Is it best practice to use these two plugins or are there better solutions?
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.