Translatable Field plugin screenshot
Dark mode ready
Multilingual support
Supports v5.x

Translatable Field

Community

A plugin designed to manage translations and display selected fields in different languages.

Tags: Forms Form Field Form Editor Field
Supported versions:
3.x 2.x
34ML avatar Author: 34ML

Package health

Beta

Automated checks of this plugin's Composer package

69 / 100
Security 52
Maintenance 90
Ecosystem 88
15 checks
  • Failed: GitHub Actions pinned to SHA View details on Plumb
  • Skipped: GitLab CI includes pinned to SHA
  • Passed: Open security advisories
  • Passed: Dependabot PR responsiveness — No open Dependabot PRs.
  • Skipped: Renovate MR responsiveness
  • Failed: Dependabot or Renovate configured No dependency updater configuration found. View details on Plumb
  • Skipped: Dependency update cooldown configured
  • Failed: Provides a security policy View details on Plumb
  • Passed: Abandoned or archived — No consulted source marks the package abandoned (packagist, github).
  • Passed: Commit and release recency — Active: last commit 5 days ago; last release 117 days ago.
  • Passed: composer.lock not committed by library composer.lock is absent from the released dist archive.
  • Warning: Dist archive is lean
  • Warning: Current Laravel version supported — Package does not co-install with current Laravel 13.0; the newest co-installable line is 12.0, which still receives active support but is not the current stable.
  • Passed: Current PHP version supported — Constraint ^8.3 supports current PHP 8.5.
  • Skipped: Current Symfony version supported
Third-party plugin. This is built by the community, not the Filament team. Filament does not review, endorse, or vet the security of plugins outside the filament/ namespace. Review the source and install at your own risk. Found malware or an unresolved security issue the author won't address? Report it .
Powered by Plumb Last scanned 2 weeks ago

Documentation

translatableFieldHeader

This package enables you to implement the following:

  1. Render a language selector to change the localized field
  2. You can save your localized fields data in one click
  3. You can use it in your relationship manager to show the localized fields

translatableField

This package depends on spatie/laravel-translatable, Please check it first to set up your translation logic in your project.

#Installation

You can install the package via composer:

composer require 34ml/filament-translatable-field

You can publish the config file with:

php artisan vendor:publish --tag="filament-translatable-field-config"

This is the content of the published config file where fields are created for each language listed here

return [
    'locales' => [
        'en' => 'English',
        'ar' => 'Arabic',
    ],
    'select_translation_field_name' => 'select_language',
];

#Translatable Field Usage

#Basic Usage

  • Just add the field in your resource, view, create,or edit pages inside the form function
 ..._34ML\FilamentTranslatableField::make(
     'your_translatable_field_name',
     \Filament\Forms\Components\TextInput::class, // The field type class 
)
  • If you want to customize the label of the field
 ..._34ML\FilamentTranslatableField::make(
     'your_translatable_field_name',
     \Filament\Forms\Components\TextInput::class, // The field type class
     'your_field_displayed_name', // Optional
)
  • If you want to add filament field functions
  ..._34ML\FilamentTranslatableField::make(
     'your_translatable_field_name',
     \Filament\Forms\Components\TextInput::class, // The field type class 
    // add your filament field functions as a callback, you can add it as one function
    callbacks: function (){
        $this->required();
        $this->numeric();
        return $this; // You have to return the field or the callbacks won't work
    }
)

#Language Selector

If you want to add a language selector that shows only the selected language's fields instead of showing all fields you can simply add this field in your resource, view, create,or edit pages inside the form function

use _34ML\FilamentTranslatableField\Forms\Components\LanguageSelector;

return $form
           ->schema([
               LanguageSelector::make(),
                ]);

#Relationship Manager

you need to add this code to your relationship manager

    public static function getRecordTitle(?Model $record): ?string
    {
        return $record->getTranslation('your_title_column', config('filament-translatable-field.locales')[0]);
    }

#Credits

#License

The MIT License (MIT). Please see License File for more information.

The author

34ML avatar Author: 34ML

34ML (https://34ml.com) a software company based in Egypt, We connect businesses and users through innovative mobile apps, built with user experience, performance, and security in mind. Our expertise in AI, machine learning, VR, and AR allows us to create truly transformative experiences.

Plugins
2
Stars
31

From the same author