Translation Manager
Manage your translation with DB and cache
Documentation
- Filament translations
- Screenshots
- Installation
- Use Language Switcher
- Usage
- Other Filament Packages
- Support
- Docs
- Changelog
- Security
- Credits
- License
Filament translations
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
Screenshots
Installation
composer require tomatophp/filament-translations
Finally reigster the plugin on /app/Providers/Filament/AdminPanelProvider.php
$panel->plugin(\TomatoPHP\FilamentTranslations\FilamentTranslationsPlugin::make())
Allow ChatGPT Auto Translations
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 provider by adding the following:
$panel->plugin(\TomatoPHP\FilamentTranslations\FilamentTranslationsPlugin::make()->allowGPTScan())
Allow Google Translate Auto Translations
If you want to use Google Translate for auto-translating your languages, you need to install the stichoza/google-translate
package by running:
composer require stichoza/google-translate-php
Enable the feature on your admin panel provider file by adding the following:
$panel->plugin(\TomatoPHP\FilamentTranslations\FilamentTranslationsPlugin::make()->allowGoogleTranslateScan())
Allow Create Button to Create New Language
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())
Allow Clear All Translations Button
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())
Publish Resource
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
Publish Assets
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"
Use Language Switcher
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.
Usage
Scan Using Command Line
You can scan your project to get all the languages tags and save them to the database
php artisan filament-translations:import
Change Scan to work on Queue
In your config file just change the use_queue_on_scan
to true
'use_queue_on_scan' => true,
Custom Import Command
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.
Custom Excel Import
You can create your own Excel import to import the translations, add your custom import class to the config file like this:
'path_to_custom_excel_import' => CustomTranslationImport::class,
The import class is based on the Laravel Excel package. You can check the documentation here. This import will automatically run when you click on the "Import" button in the UI.
Custom Excel Export
You can create your own Excel export to export the translations in your own format, add your custom export class to the config file like this:
'path_to_custom_excel_export' => CustomTranslationExport::class,
The export class is based on the Laravel Excel package. You can check the documentation here. This import will automatically run when you click on the "Export" button in the UI.
Show or hide buttons 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 ,
Custom Resource
You can create your own resource to show the translations in the UI, add your custom resource class to the config file like this:
'translation_resource' => CustomResource::class,
This is especially useful when you want to have complete control over the UI but still want to use the translations package. Think about implementing a check on user roles when using shouldRegisterNavigation
in your custom resource.
Other Filament Packages
- 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
Support
you can join our discord server to get support TomatoPHP
Docs
you can check docs of this package on Docs
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security
Please see SECURITY for more information about security.
Credits
License
The MIT License (MIT). Please see License File for more information.