parfaitementweb/filament-plugin-translatable-inline
Composer 安装命令:
composer require parfaitementweb/filament-plugin-translatable-inline
包简介
An inline translation plugin for Filament 4 and 5.
README 文档
README
This is an addon to Filament Larazeus Translatable that allows you to edit your translation directly below the field.
This approach offers several advantages:
- Faster editing of your translations
- Detecting fields that can be translated is much easier to see
- You can quickly see which translations are missing
Screenshots
Requirements
You need the latest version of:
- Filament v4 or v5.
- Filament Translatable Plugin
Installation
Install the package via composer:
composer require parfaitementweb/filament-plugin-translatable-inline:"^4.0"
Also install the Filament Translatable Plugin, if not already:
composer require lara-zeus/spatie-translatable
Configuration
It is important that you don't add the Filament traits and the header action to your form resource pages, or it won't work! Only the trait "Translatable" in your resource is required!
Instead of having the locale switcher, wrap your fields in add a TranslatableContainer.
<?php ... use Parfaitementweb\FilamentPluginTranslatableInline\Forms\Components\TranslatableContainer; ... public static function form(Form $form): Form { return $form ->schema([ TranslatableContainer::make( Forms\Components\TextInput::make('title') ->maxLength(255) ->required() ) ->onlyMainLocaleRequired() // optional ->requiredLocales(['en', 'es']) // optional , ...
For each field that can be translated, simply repeat this process, and you'll be done.
TIP: You don't have to globally choose between inline or dropdown. Instead, you can choose an option on each page. For instance, it makes sense to have the dropdown in the list view and then use the inline version when editing.
Options
onlyMainLocaleRequired
Sometimes you might want the field to be required, but only for the primary language. For example, if you set the TextInput to 'required,' it applies to all language variants. This is where this option comes into play. It removes the 'required' validation for all other languages except the primary one.
requireLocales
If you have more than one required locales you can pass an array to this method.
Tips & Hints
Validation
If all of your locales are required and if your values do not pass the JS validation, then the variants will remain automatically expanded.
afterStateUpdated
If you want to use "afterStateUpdated", you have to consider that the state path shifts by one level. n addition, one must specify the locale which is located in the component's meta under the key "locale".
Before
->afterStateUpdated(fn (Set $set, ?string $state) => $set('slug', Str::slug($state))),
After
->afterStateUpdated(fn (Set $set, Component $component, ?string $state) => $set('../slug.' . $component->getMeta('locale'), Str::slug($state))),
parfaitementweb/filament-plugin-translatable-inline 适用场景与选型建议
parfaitementweb/filament-plugin-translatable-inline 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2025 年 09 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「translatable」 「inline」 「laravel」 「spatie」 「filament」 「lara-zeus」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 parfaitementweb/filament-plugin-translatable-inline 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 parfaitementweb/filament-plugin-translatable-inline 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 parfaitementweb/filament-plugin-translatable-inline 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Symfony bundle for using the CssToInlineStyles translator by tijsverkoyen
A Twig extension to insert css as inline styles with a tag
A Laravel Nova field for displaying morphTo relationship inline.
A Laravel Eloquent model trait for translatable resource
An Astrotomic Translatable extension for Laravel Nova.
Utility functions to inline SVGs in PHP Projects
统计信息
- 总下载量: 10k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-22
