Manage your translation with DB and cache, you can scan your languages tags like trans()
, __()
, and get the string inside and translate them use UI.
this plugin is build in spatie/laravel-translation-loader
composer require tomatophp/filament-translations
Finally reigster the plugin on /app/Providers/Filament/AdminPanelProvider.php
$panel->plugin(\TomatoPHP\FilamentTranslations\FilamentTranslationsPlugin::make())
If you want to use ChatGPT to auto-translate your languages, you need to install OpenAI
package by running:
composer require openai-php/laravel
now you need to add the following to your .env
file:
OPENAI_API_KEY=
OPENAI_ORGANIZATION=
allow the feature on your panel proiver by adding the following:
$panel->plugin(\TomatoPHP\FilamentTranslations\FilamentTranslationsPlugin::make()->allowGPTScan())
If you want to allow the user to create a new language, you need to add the following to your panel provider:
$panel->plugin(\TomatoPHP\FilamentTranslations\FilamentTranslationsPlugin::make()->allowCreate())
If you want to allow the user to clear all translations, you need to add the following to your panel provider:
$panel->plugin(\TomatoPHP\FilamentTranslations\FilamentTranslationsPlugin::make()->allowClearTranslations())
You can publish the resource to your project using:
php artisan vendor:publish --tag="filament-translations-migrations"
If you need to publish config run:
php artisan vendor:publish --tag="filament-translations-config"
Run migration:
php artisan migrate
and now clear cache running:
php artisan optimize:clear
You can publish views file by use this command:
php artisan vendor:publish --tag="filament-translations-views"
You can publish languages file by use this command:
php artisan vendor:publish --tag="filament-translations-lang"
You can publish migrations file by use this command:
php artisan vendor:publish --tag="filament-translations-migrations"
You can use the language switcher in your panel by using the following plugin:
$panel->plugin(\TomatoPHP\FilamentTranslations\FilamentTranslationsSwitcherPlugin::make())
NOTE your auth user table must have lang
filed on the table to make this switch working fine.
You can scan your project to get all the languages tags and save them to the database
php artisan filament-translations:import
In your config file just change the use_queue_on_scan
to true
'use_queue_on_scan' => true,
You can create your own command to import the translations, add your custom import class to the config file like this:
'path_to_custom_import_command' => ImportTranslations::class,
This command will automatically run when you click on the "Scan For New Languages" button in the UI.
You can show or hide the buttons in the UI by changing the config file. By default, all buttons are shown.
'show_import_button' => true,
'show_export_button' => false,
'show_scan_button' => false ,
- Filament Users Resource
- Filament Settings Hub
- Filament Menus Generator
- Filament Alerts Sender
- Filament Accounts Builder
- Filament Wallet Manager
- Filament Artisan Runner
- Filament File Browser
- Filament Developer Gate
- Filament Locations Seeder
- Filament Plugins Manager
- Filament Splade Integration
- Filament Types Manager
- Filament Icons Picker
- Filament Helpers Classes
you can join our discord server to get support TomatoPHP
you can check docs of this package on Docs
Please see CHANGELOG for more information on what has changed recently.
Please see SECURITY for more information about security.
The MIT License (MIT). Please see License File for more information.