sepremex/filament-translation-editor 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sepremex/filament-translation-editor

Composer 安装命令:

composer require sepremex/filament-translation-editor

包简介

Manage language files with ease.

README 文档

README

🔤 A real translation manager for Laravel 12 + Filament 3 — zero migrations, zero excuses.

🔧 Auto-Translation Setup

🆓 LibreTranslate (Recommended for Development)

Local Docker (Free):

docker run -d -p 5000:5000 --name libretranslate libretranslate/libretranslate:latest

Configuration:

FILAMENT_TRANSLATION_AUTO_TRANSLATE=true
FILAMENT_TRANSLATION_PROVIDER=libretranslate
LIBRETRANSLATE_URL=http://localhost:5000
# API key optional for most instances
LIBRETRANSLATE_API_KEY=

💰 Microsoft Translator (2M chars/month free)

  1. Create Azure account
  2. Create Translator resource
  3. Get API key and region
FILAMENT_TRANSLATION_PROVIDER=microsoft
MICROSOFT_TRANSLATOR_KEY=your_key_here
MICROSOFT_TRANSLATOR_REGION=eastus

💸 Google Translate (Paid, no free tier)

  1. Create Google Cloud account
  2. Enable Translation API
  3. Get API key
FILAMENT_TRANSLATION_PROVIDER=google
GOOGLE_TRANSLATE_KEY=your_api_key_here

⚠️ Translation Provider Warnings:

  • LibreTranslate: May be slower, quality varies by language pair
  • Microsoft: Free tier has monthly limits, then charges apply
  • Google: No free tier, charges from first character
  • All providers: May fail due to network issues, quotas, or API changes

---# Filament Translation Editor

🔤 A real translation manager for Laravel 12 + Filament 3 — zero migrations, zero excuses.

⚠️ EARLY RELEASE WARNING: This is an early version under active development. While extensively tested in development environments, use with caution in production. Always backup your translation files before use. See Production Usage below.

🚨 Production Usage Warning

⚠️ IMPORTANT DISCLAIMER

This plugin is in early development and, while functional, may contain bugs or edge cases not yet discovered. I am not responsible for any data loss, corruption, or issues that may arise from using this plugin.

🛡️ Before Using in Production:

  1. BACKUP EVERYTHING — Your entire /lang/ directory and any vendor translation files
  2. Test thoroughly in a development environment first
  3. Start small — Test with non-critical translation files
  4. Monitor logs — Check storage/logs/laravel.log for translation service errors
  5. Have a rollback plan — Know how to restore from backups quickly

🔥 Known Potential Issues:

  • API quotas — Translation providers have limits that may be exceeded
  • Network failures — External APIs may be unreachable
  • File permissions — Ensure Laravel can write to language directories
  • Large files — Very large translation files may timeout
  • Concurrent edits — Multiple users editing same files simultaneously

💡 Recommended Production Setup:

// Enable backups (strongly recommended)
'create_backup' => true,

// Disable auto-save for more control
'auto_save_changes' => false,

// Consider disabling auto-translate initially
'auto_translate' => ['enabled' => false],

You have been warned. Use at your own risk. 🫡

🧩 Core Features

  • ✅ Manage core translation files (/lang/{locale}, /lang/{locale}.json)
  • ✅ Supports package translations in /lang/vendor/{package}/{locale}
  • ✅ JSON support (core only — packages use PHP only)
  • ✅ Nested arrays using custom <~> notation (e.g., validation<~>between<~>string)
  • ✅ Real-time search & pagination
  • ✅ Auto-save mode (optional)
  • Auto-translate with multiple providers — LibreTranslate, Microsoft, Google
  • Auto-sync keys across languages — add once, sync everywhere
  • Smart array cleanup — removes empty parent arrays automatically
  • Graceful fallback — if translation fails, returns original text
  • ✅ 80+ languages with native names
  • ✅ No database, no models, no crying

🙅 What it doesn't do (yet)

Just to set expectations:

  • ❌ Does not create backup language files
  • ❌ Does not create new language files
  • ❌ Does not delete files
  • ❌ Does not sync missing keys (you forgot them, not me), I have another package for that.
  • ❌ Does not generate Excel reports, pay taxes, or make you coffee
  • ❌ Does not guarantee your translation provider won't hit quotas/limits
  • ❌ Does not fix bad life choices (like not searching before adding keys)

🚀 Installation

composer require sepremex/filament-translation-editor

Add it to your Filament panel:

->plugin(\Sepremex\FilamentTranslationEditor\FilamentTranslationEditorPlugin::make())

🛠 Publishing Resources

Everything

php artisan vendor:publish --provider="Sepremex\FilamentTranslationEditor\FilamentTranslationEditorServiceProvider"

Config only

php artisan vendor:publish --tag=filament-translation-editor-config

Views

php artisan vendor:publish --tag=filament-translation-editor-views

Translations

php artisan vendor:publish --tag=filament-translation-editor-translations

⚙️ Config Overview

Available at: config/filament-translation-editor.php

'path' => 'lang',
'auto_save' => false,
'key_separator' => '<~>', // not in use from config yet...
'per_page' => 20, // secret for next stage...
'search_enabled' => true,
'include_vendor_languages' => true,
'vendor_namespace' => 'vendor',
'default_locale' => 'en',

🎯 Best Practices (Or: How Not to Break Things)

🔍 Search Before You Add

Golden Rule: Always search for a key before adding it.

❌ Don't: Add `user.name` when `user` already exists as a string
✅ Do: Search "user" first, then decide wisely

The plugin will auto-sync your new keys across all languages, but it won't fix your poor life choices.

🧠 Nested Arrays 101

Use <~> for nested structures:

✅ Good: validation<~>email<~>required → 'validation' => ['email' => ['required' => 'value']]
❌ Bad: validation.email.required → 'validation.email.required' => 'value'

Dots (.) are literal — they're part of the key, not separators. Don't be that person.

⚡ Auto-Sync Magic

When you add/remove keys, they automatically sync to other languages:

  • Adding: Creates the key in all languages (if it doesn't exist)
  • Removing: Removes from all languages + cleans empty parent arrays
  • Existing keys: Won't overwrite — we're smart like that

🚨 Common Gotchas

  1. Mixed Types: Don't mix strings and arrays for the same key across languages
  2. Empty Search: Use the search box — it's there for a reason
  3. Backup First: Do it manually
  4. Case Sensitivity: Useruser — Laravel cares, so should you
  5. API Limits: Translation providers have quotas — monitor your usage
  6. Network Dependencies: Auto-translate requires internet — have a backup plan

🔧 Pro Workflow

  1. 🔍 Search for existing keys first
  2. 📝 Add only what doesn't exist
  3. 👀 Review auto-translations (they're not perfect)
  4. 💾 Save (or enable auto-save for YOLO mode)
  5. 📊 Monitor logs for translation service issues
  6. 🎉 Enjoy your magically synced translations

Remember: The plugin is smarter than your average developer, but it can't fix stupidity or API outages.

❤️ Disclaimer

I wanted it clean and elegant...
But Filament had other plans.
So here we are — custom pages, magical readers, zero database migrations, auto-sync wizardry, and translation APIs that may or may not work when you need them most.
You're welcome... and you're warned.

Use it. Abuse it. Translate responsibly. Backup religiously.
Built with sarcasm, auto-sync magic, questionable life choices, and ❤️ by [Sepremex].

⚖️ Legal Stuff

This software is provided "as is" without warranty of any kind. The author is not responsible for:

  • Lost translations
  • Corrupted files
  • Exceeded API quotas
  • Existential crises caused by bad translations
  • Your production going down at 3 AM
  • Angry users complaining about "Hello world" being translated to "Goodbye universe"

Use at your own risk. Backup your stuff. Test before deploying.

Thanks for being a brave early adopter

📄 License

MIT — porque lo bueno se comparte, excepto la responsabilidad legal.

sepremex/filament-translation-editor 适用场景与选型建议

sepremex/filament-translation-editor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 64 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 06 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「localization」 「multilingual」 「filament」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 sepremex/filament-translation-editor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 sepremex/filament-translation-editor 我们能提供哪些服务?
定制开发 / 二次开发

基于 sepremex/filament-translation-editor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 64
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-09