PHPackages                             qsque/filament-translation-helper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. qsque/filament-translation-helper

ActiveLibrary[Localization &amp; i18n](/categories/localization)

qsque/filament-translation-helper
=================================

A Filament plugin that provides automatic translations with fallback support for resources, forms and tables

1.0.6(6mo ago)235MITPHPPHP ^8.2

Since Oct 25Pushed 6mo agoCompare

[ Source](https://github.com/qsque/filament-translation-helper)[ Packagist](https://packagist.org/packages/qsque/filament-translation-helper)[ RSS](/packages/qsque-filament-translation-helper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (6)Used By (0)

🌐 Filament Translation Helper
=============================

[](#-filament-translation-helper)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b74cc430482c36ed89df5fb0fb2f8ae197cb1ab8493085d8d21fc339bd35b087/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f71737175652f66696c616d656e742d7472616e736c6174696f6e2d68656c7065722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/qsque/filament-translation-helper)[![Total Downloads](https://camo.githubusercontent.com/081caf86c4fb82b64fb429573e2ee09bc6c8f745daf89fb577e2432664ab293d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f71737175652f66696c616d656e742d7472616e736c6174696f6e2d68656c7065722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/qsque/filament-translation-helper)[![License](https://camo.githubusercontent.com/edea162e05a64de5911d9fc345a7847809d78ce03f01325760ededd16f3fc7d6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f71737175652f66696c616d656e742d7472616e736c6174696f6e2d68656c7065722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/qsque/filament-translation-helper)

**A powerful Filament plugin that provides automatic translations with intelligent fallback support for forms, tables, and resources.**

[Installation](#-installation) • [Quick Start](#-quick-start) • [Features](#-features)

---

✨ Features
----------

[](#-features)

- **🔄 Automatic Translation Discovery**: Fields, columns, and sections are automatically translated
- **🎯 Smart Fallback System**: Local translations → Package translations → Auto-generated labels
- **🌐 Multi-language Support**: Built-in language switching with session persistence
- **📝 Zero Configuration**: Works out of the box without any setup
- **🎨 Language Switcher**: Ready-to-use user menu item for your admin panel
- **⚡ Laravel 11 &amp; 12 Support**: Compatible with the latest Laravel versions
- **🎯 Filament 4 Ready**: Built for the latest Filament architecture
- **🔧 Highly Configurable**: Customize locales, fallbacks, and translation paths

🚀 Installation
--------------

[](#-installation)

Install the package via Composer:

```
composer require qsque/filament-translation-helper
```

That's it! The package works out of the box with zero configuration. 🎉

⚡ Quick Start
-------------

[](#-quick-start)

### 1. Basic Usage (Zero Config)

[](#1-basic-usage-zero-config)

Just use your forms and tables as usual - translations happen automatically:

**Resource:**

```
use Qsque\FilamentTranslationHelper\Resources\BaseResource;

class UserResource extends BaseResource
{
    protected static ?string $model = User::class;

    // Resource labels are automatically translated from:
    // resources.user.label and resources.user.plural_label
}
```

**Form:**

```
use Filament\Forms\Form;
use Filament\Forms\Components\TextInput;

public function form(Form $form): Form
{
    return $form->schema([
        TextInput::make('name'),        // → "Name" or translated
        TextInput::make('email'),       // → "Email" or translated
        TextInput::make('first_name'),  // → "First Name" or translated
    ]);
}
```

**Table:**

```
use Filament\Tables\Table;
use Filament\Tables\Columns\TextColumn;

public function table(Table $table): Table
{
    return $table->columns([
        TextColumn::make('name'),       // → "Name" or translated
        TextColumn::make('created_at'), // → "Created At" or translated
    ]);
}
```

### 2. Add Translation Files (Optional)

[](#2-add-translation-files-optional)

Create translation files for custom labels:

```
// lang/en/common.php
return [
    'fields' => [
        'name' => 'Full Name',
        'email' => 'Email Address',
        'created_at' => 'Registration Date',
    ],
];

// lang/ru/common.php
return [
    'fields' => [
        'name' => 'Полное имя',
        'email' => 'Email адрес',
        'created_at' => 'Дата регистрации',
    ],
];
```

### 3. Add Language Switcher (Optional)

[](#3-add-language-switcher-optional)

```
use Qsque\FilamentTranslationHelper\Components\LanguageSwitcher;

public function panel(Panel $panel): Panel
{
    return $panel
        ->userMenuItems([
            LanguageSwitcher::getUserMenuItem(),
        ]);
}
```

🎯 How It Works
--------------

[](#-how-it-works)

### Translation Lookup Strategy

[](#translation-lookup-strategy)

The plugin automatically translates fields using this intelligent fallback system:

 ```
graph TD
    A[Field: 'first_name'] --> B{Resource-specific translation?}
    B -->|Yes| C[resources.user.fields.first_name]
    B -->|No| D{Common field translation?}
    D -->|Yes| E[common.fields.first_name]
    D -->|No| F{Package translation?}
    F -->|Yes| G[filament-translation-helper::common.fields.first_name]
    F -->|No| H{Base name translation?}
    H -->|Yes| I[common.fields.first &#40;for 'first_name'&#41;]
    H -->|No| J[Auto-generate: 'First Name']
```

      Loading ### Translation Hierarchy Examples

[](#translation-hierarchy-examples)

Field NameTranslation Lookup Order`name``resources.user.fields.name` → `common.fields.name` → `"Name"``email``resources.user.fields.email` → `common.fields.email` → `"Email"``config.api_key``resources.user.fields.config.api_key` → `common.fields.config` → `"Config"`📁 Translation File Structure
----------------------------

[](#-translation-file-structure)

### Resource-Specific Translations

[](#resource-specific-translations)

```
// lang/en/resources.php
return [
    'user' => [
        'label' => 'User',
        'plural_label' => 'Users',
        'fields' => [
            'name' => 'User Name',
            'email' => 'Email Address',
        ],
        'sections' => [
            'general' => 'General Information',
            'security' => 'Security Settings',
        ],
        'columns' => [
            'created_at' => 'Registration Date',
        ],
    ],
];
```

### Common Field Translations

[](#common-field-translations)

```
// lang/en/common.php
return [
    'fields' => [
        'name' => 'Name',
        'email' => 'Email',
        'password' => 'Password',
        'created_at' => 'Created At',
        'updated_at' => 'Updated At',
        // ... hundreds of pre-built translations
    ],
];
```

🔧 Advanced Configuration
------------------------

[](#-advanced-configuration)

### Custom Configuration

[](#custom-configuration)

Publish the config file to customize behavior:

```
php artisan vendor:publish --tag="filament-translation-helper-config"
```

```
// config/filament-translation-helper.php
return [
    'available_locales' => [
        'en' => 'English',
        'ru' => 'Русский',
        'es' => 'Español',
        'fr' => 'Français',
        'de' => 'Deutsch',
    ],

    'default_locale' => env('APP_LOCALE', 'en'),

    'fallback_locale' => 'en',

    'session_key' => 'filament_locale',
];
```

### Custom Resource Keys

[](#custom-resource-keys)

Override the resource translation key:

```
class UserProfileResource extends Resource
{
    protected static function getResourceKey(): string
    {
        return 'user-profile'; // Uses resources.user-profile.*
    }
}
```

### Middleware Setup (Optional)

[](#middleware-setup-optional)

Add locale persistence across requests:

```
use Qsque\FilamentTranslationHelper\Http\Middleware\SetLocale;

public function panel(Panel $panel): Panel
{
    return $panel
        ->middleware([
            SetLocale::class,
        ]);
}
```

🛠️ Advanced Usage
-----------------

[](#️-advanced-usage)

### Manual Translation Helper

[](#manual-translation-helper)

```
use Qsque\FilamentTranslationHelper\Support\TranslationHelper;

// Get translation with automatic fallback
$label = TranslationHelper::getWithFallback('sections.user_details');
// Returns: "User Details" (auto-generated) or actual translation

// Check if translation exists
if (TranslationHelper::hasTranslation('common.fields.custom_field')) {
    // Use translation
}
```

### BaseResource Class

[](#baseresource-class)

Extend BaseResource for automatic resource label translation:

```
use Qsque\FilamentTranslationHelper\Resources\BaseResource;

class UserResource extends BaseResource
{
    protected static ?string $model = User::class;

    // Automatically translates:
    // - getLabel() from resources.user.label
    // - getPluralLabel() from resources.user.plural_label
}
```

### Custom Translation Logic

[](#custom-translation-logic)

```
use Qsque\FilamentTranslationHelper\Contracts\TranslationStrategy;

class CustomTranslationStrategy implements TranslationStrategy
{
    public function getTranslation(string $key, string $fallback = null): string
    {
        // Your custom translation logic
    }
}
```

📦 Package Translations
----------------------

[](#-package-translations)

The package includes pre-built translations for common fields in multiple languages:

- **English** (en)
- **Russian** (ru)

### Publishing Package Translations

[](#publishing-package-translations)

```
# Publish to customize package translations
php artisan vendor:publish --tag="filament-translation-helper-lang"
```

🎨 Language Switcher Customization
---------------------------------

[](#-language-switcher-customization)

### Basic Usage

[](#basic-usage)

```
// In your PanelProvider
public function panel(Panel $panel): Panel
{
    return $panel
        ->userMenuItems([
            LanguageSwitcher::getUserMenuItem(),
        ]);
}
```

### Custom Implementation

[](#custom-implementation)

```
// You can also implement your own user menu item
use Filament\Support\Facades\FilamentView;
use Filament\Navigation\MenuItem;
use Filament\Forms\Components\Radio;

MenuItem::make()
    ->label(config('filament-translation-helper.available_locales')[app()->getLocale()])
    ->icon('heroicon-o-language')
    ->form([
        Radio::make('locale')
            ->options(config('filament-translation-helper.available_locales'))
            ->default(app()->getLocale())
            ->inline(false)
            ->hiddenLabel(),
    ])
    ->action(function (array $data) {
        return redirect()->to(route('locale.switch', $data['locale']));
    })
```

🔍 Examples in Action
--------------------

[](#-examples-in-action)

### Form Example

[](#form-example)

```
use Filament\Forms\Form;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Forms\Components\Section;

public function form(Form $form): Form
{
    return $form->schema([
        Section::make('general') // → "General" or translated
            ->schema([
                TextInput::make('name')      // → "Name" or translated
                    ->required(),
                TextInput::make('email')     // → "Email" or translated
                    ->email(),
            ]),

        Section::make('settings')    // → "Settings" or translated
            ->schema([
                Toggle::make('is_active') // → "Is Active" or translated
                    ->default(true),
            ]),
    ]);
}
```

### Table Example

[](#table-example)

```
use Filament\Tables\Table;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\BooleanColumn;

public function table(Table $table): Table
{
    return $table
        ->columns([
            TextColumn::make('id')         // → "ID"
                ->sortable(),
            TextColumn::make('name')       // → "Name" or translated
                ->searchable(),
            TextColumn::make('email')      // → "Email" or translated
                ->searchable(),
            BooleanColumn::make('is_active') // → "Is Active" or translated,
            TextColumn::make('created_at') // → "Created At" or translated
                ->dateTime(),
        ]);
}
```

📄 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

💝 Credits
---------

[](#-credits)

- [Qsque](https://github.com/qsque)
- [All Contributors](../../contributors)

---

**Made with ❤️ for the Filament community**

[⭐ Star on GitHub](https://github.com/qsque/filament-translation-helper) • [🐛 Report Issues](https://github.com/qsque/filament-translation-helper/issues) • [💬 Discussions](https://github.com/qsque/filament-translation-helper/discussions)

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance66

Regular maintenance activity

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

198d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4ad6b5af9768f53845706a469e0f538cdc667c650965ac02e5b20af4dad7b8f7?d=identicon)[qsque](/maintainers/qsque)

---

Top Contributors

[![Quarasique](https://avatars.githubusercontent.com/u/26576363?v=4)](https://github.com/Quarasique "Quarasique (6 commits)")[![qsque](https://avatars.githubusercontent.com/u/240026056?v=4)](https://github.com/qsque "qsque (4 commits)")

---

Tags

pluginlaravellocalizationi18ntranslationsfilament

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/qsque-filament-translation-helper/health.svg)

```
[![Health](https://phpackages.com/badges/qsque-filament-translation-helper/health.svg)](https://phpackages.com/packages/qsque-filament-translation-helper)
```

###  Alternatives

[outhebox/laravel-translations

Manage your Laravel translations with a beautiful UI. Add, edit, delete, import, and export translations with ease.

80687.6k](/packages/outhebox-laravel-translations)[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

3812.2k](/packages/erag-laravel-lang-sync-inertia)[craft-forge/filament-language-switcher

Zero-config language switcher for Filament admin panels. Automatically scans available translations, renders dropdown with country flags, persists selection via sessions.

1016.4k](/packages/craft-forge-filament-language-switcher)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
