Download the PHP package dyahunter35/filament-translation-toolkit without Composer

On this page you can find all versions of the php package dyahunter35/filament-translation-toolkit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filament-translation-toolkit

Filament Translation Toolkit

A comprehensive, production-ready translation toolkit for Filament v5 — automatic UI translation, AI-powered translation generation, language file scaffolding, and a full dashboard to monitor translation health across your entire application.


Table of Contents


Features

Feature Description
Translatable Models Add Translatable trait to Eloquent models to opt-in for translation
Automatic UI Translation Auto-translate Filament forms, tables, infolists, navigation, and breadcrumbs at runtime
Translation Dashboard A full Filament page to monitor API status, missing files, completeness, and relationships
AI-Powered Generation Generate smart translation files using OpenRouter API (GPT-4o-mini by default)
Column-Based Generation Generate translation scaffolding directly from database table columns
Relationship Detection Auto-discovers Eloquent relationships and checks for _relation translation files
Completeness Monitoring Visual progress bars showing translation completeness per file with missing key tooltips
Per-Class Disable Set $translationEnabled = false on any class to skip translation
Global Toggle enabled config or FILAMENT_TRANSLATION_ENABLED env to disable everything
Multi-Page Support Dedicated traits for Resources, Resource Pages, Single Pages, Relation Managers, and Pages
Multi-Language Configurable locale list — add any number of languages
Extensible Templates Strategy pattern for translation templates — create your own template types

Requirements


Installation

Step 1: Add the Package

Step 2: Add Views Path to Your Theme (Required for Dashboard Styling)

To ensure Tailwind CSS v4 compiles the classes used in the Translation Dashboard, add a @source directive in your main CSS file:

Then rebuild your assets:

Step 3: Publish the Config

This creates config/filament-translation-toolkit.php in your project.

Step 4: Configure Your Locales

Open config/filament-translation-toolkit.php:

Step 5: (Optional) Configure AI Translation

If you want AI-powered translation generation:

  1. Create a free account at openrouter.ai
  2. Generate an API key from Keys page
  3. Add to your .env:

Step 6: Register the Dashboard (Optional)

To add the Translation Dashboard to your Filament panel:

Customizing Dashboard Navigation

You can customize the dashboard's navigation label, group, title, icon, and sort order from the config file or via environment variables:

Or via .env:

When set to null (default), the label, group, and title are automatically translated based on the active locale (English: "Translation Dashboard", Arabic: "لوحة التحكم بالترجمة").

Step 7: Use Traits in Your Filament Classes

Start using the translation traits in your existing classes (see Traits below).


Configuration

The full config file with all options:

Environment Variables

Variable Default Description
FILAMENT_TRANSLATION_ENABLED true Master switch to enable/disable translation
OPENROUTER_API_KEY '' OpenRouter API key for AI translations
OPENROUTER_MODEL openai/gpt-4o-mini AI model to use for translations
TRANSLATION_DASHBOARD_LABEL null Custom label for dashboard nav (null = translated)
TRANSLATION_DASHBOARD_GROUP null Custom group name for dashboard nav (null = translated)
TRANSLATION_DASHBOARD_TITLE null Custom page title for dashboard (null = translated)
TRANSLATION_DASHBOARD_ICON heroicon-o-language Custom icon for dashboard nav
TRANSLATION_DASHBOARD_SORT 999 Sort order for dashboard in sidebar
TRANSLATION_USE_RESOURCE_DEFAULTS true Use Resource defaults for navigation values

Quick Start

1. Add the Translatable Trait to Your Models

First, mark your Eloquent models as translatable by adding the Translatable trait:

Available properties:

Property Type Default Description
$translationEnabled bool true Set to false to exclude this model from translation
$translationFileName ?string null Custom file name (null = auto from model name)

Available methods:

2. Generate Translation Files for a Table

3. Add the Filament Traits to Your Resources

That's it — just add the trait. Translation is auto-activated:

4. Add the Trait to Your Relation Manager

That's it — your UI is now automatically translated!

5. Disable Translation for a Specific Class

If a page doesn't need translation, disable it per-class:

Or disable globally in .env:

Or in config:

6. Explicit Boot (Optional)

If the global auto-translation doesn't work for your setup, you can still call bootTranslation() explicitly:


Dashboard

The TranslationDashboard is a comprehensive monitoring page with 5 sections:

1. AI Service Status

2. Missing Translation Files

3. Translation Completeness

4. Model Relationships

5. All Translation Files (Collapsed)


Artisan Commands

make:translation

Generate translation files for a database table. Supports both basic scaffolding and AI-powered generation.

Parameter Description
{table} The database table name
--ai Use AI to generate smart translations (requires OpenRouter API key)
--type Template type: resource or relation
--lang Specific locale (defaults to all configured locales)
--use-resource-defaults Use navigation defaults from Filament Resource class

Examples:

Requirements for AI mode:

What AI mode does:

  1. Reads all columns from the database table
  2. Detects Eloquent relationships from the model
  3. Sends everything to AI with a structured prompt
  4. AI returns professional English and Arabic translations
  5. Writes lang/en/{model}.php and lang/ar/{model}.php

Traits (Concerns)

Translatable — Model Trait

Mark your Eloquent models as translatable. The Translation Dashboard only shows models that use this trait.

Properties:

Property Type Default Description
$translationEnabled bool true Set to false to exclude from dashboard
$translationFileName ?string null Custom file name (null = auto snake_case)

Methods:


HasTranslateConfigure — The Core Engine

The central trait that powers all auto-translation. Provides:

How it works (two modes):

Mode How When to use
Global Auto (recommended) Service provider registers configureUsing globally. Resolver auto-detects current context. Default — just use HasResource;
Explicit Boot Call static::bootTranslation() in your class's boot() method. If global mode doesn't work for your setup

What it translates:

Component Translated Properties
Field label, description, placeholder, helper_text, prefix, suffix, options
Section heading, description, icon
Repeater label, description
Wizard\Step label, description
Tab label, description, icon
Entry (infolist) label, icon, helper_text, prefix, suffix, options
Column (table) label, description, prefix
Select/Radio/Checkbox options array

Additional utilities:


HasResource

For Filament Resource classes. Provides:

Locale path is derived from the model name: App\Models\Company → company

You can override it:


HasSinglePage

For standalone Filament pages (not part of a Resource):

Locale path is derived from the class name: ExpenseSettings → expense_settings


HasResourcePage

For Resource sub-pages (View, Edit, Create):


HasRelationManager

For Relation Manager classes:


HasPage

For generic Page classes that belong to a Resource:


Translation File Structure

Resource Translation File

Relation Translation File

Key Naming Convention

Context Key Path Example
Form field label fields.{field_name}.label fields.name.label
Form field placeholder fields.{field_name}.placeholder fields.name.placeholder
Section heading sections.{section_name}.label sections.details.label
Tab label tabs.{tab_name}.label tabs.info.label
Navigation group navigation.group navigation.group
Breadcrumb breadcrumbs.{page} breadcrumbs.index
Relation label label.plural / label.single label.plural

AI Translation Service

The AiTranslationService sends database schema data to OpenRouter API and receives professionally translated UI labels.

How It Works

  1. Reads table columns via Schema::getColumnListing()
  2. Detects Eloquent relationships via reflection
  3. Constructs a prompt with the template structure
  4. Sends to OpenRouter API (configurable model)
  5. Parses JSON response
  6. Writes PHP translation files for each locale

Supported AI Models

Any model available on OpenRouter:

Customizing the Endpoint

If you want to use a different API provider:


Templating System

The package uses a Strategy pattern for translation templates. Two templates are included:

ResourceTemplate

Generates files with navigation, breadcrumbs, and fields keys.

RelationTemplate

Generates files with label, fields, filters, and actions keys.

Creating a Custom Template

Use it:


How It Works

Auto-Translation Flow (Global Mode — Recommended)

Auto-Translation Flow (Explicit Mode)

Locale Path Resolution

Class Type Path Derivation Example
Resource Model class basename → snake CompanyResource → company
Single Page Class basename → snake ExpensePage → expense_page
Relation Manager $relationship → snake + _relation documents → document_relation
Resource Page Delegates to parent Resource EditCompany → company
Page Delegates to $resource model CompanyReport → company

Publishing Assets

Published views will be at resources/views/vendor/filament-translation-toolkit/.


Testing


Package Structure


Changelog

Please see CHANGELOG for more information on recent changes.


Contributing

Please see CONTRIBUTING for details.


Security Vulnerabilities

If you discover a security vulnerability within the package, please send an email to Dyahunter35 via [email protected]. All security vulnerabilities will be promptly addressed.


License

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


All versions of filament-translation-toolkit with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
filament/filament Version ^5.0
illuminate/support Version ^13.0
spatie/laravel-package-tools Version ^1.15.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dyahunter35/filament-translation-toolkit contains the following files

Loading the files please wait ...