1. Go to this page and download the library: Download jegex/filament-translatable library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jegex / filament-translatable example snippets
use Jegex\FilamentTranslatable\Enums\TranslationMode;
FilamentTranslatablePlugin::make()
->translationMode(TranslationMode::Astrotomic)
use Jegex\FilamentTranslatable\FilamentTranslatablePlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugin(FilamentTranslatablePlugin::make());
}
use Jegex\FilamentTranslatable\Forms\Component\Translations;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Textarea;
Translations::make('translations')
->schema([
TextInput::make('title'),
Textarea::make('content'),
])
use Jegex\FilamentTranslatable\Forms\Component\Translations;
Translations::make('translations')
->vertical()
->schema([
TextInput::make('title'),
Textarea::make('content'),
])
use Jegex\FilamentTranslatable\Forms\Component\Translations;
Translations::make('translations')
->schema([
TextInput::make('title'),
])
use Jegex\FilamentTranslatable\Forms\Component\Translations;
Translations::make('translations')
->displayFlagsInLocaleLabels(true)
->flagWidth('24px')
->schema([...])
use Jegex\FilamentTranslatable\Enums\TranslationMode;
use Jegex\FilamentTranslatable\Forms\Component\Translations;
Translations::make('translations')
->translationMode(TranslationMode::Astrotomic)
->schema([
TextInput::make('name'),
])
use Jegex\FilamentTranslatable\Forms\Component\Translations;
Translations::make()
->displayNamesInLocaleLabels(false)
->displayFlagsInLocaleLabels(true)
->flagWidth('32px')
use Jegex\FilamentTranslatable\FilamentTranslatablePlugin;
use Jegex\FilamentTranslatable\Forms\Component\Translations;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\RichEditor;
public function panel(Panel $panel): Panel
{
return $panel
->plugin(
FilamentTranslatablePlugin::make()
->locales(['en', 'id', 'fr', 'de'])
->defaultLocale('en')
->displayFlagsInLocaleLabels(true)
->displayNamesInLocaleLabels(true)
->flagWidth('24px')
);
}
public static function form(Form $form): Form
{
return $form->schema([
TextInput::make('slug'),
Translations::make('translations')
->vertical()
->displayFlagsInLocaleLabels()
->schema([
TextInput::make('title'),
RichEditor::make('content'),
])
->columns(1),
]);
}
bash
php artisan filament:assets
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.