PHPackages                             jaysontemporas/translation-overrides - 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. jaysontemporas/translation-overrides

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

jaysontemporas/translation-overrides
====================================

2.0.0(9mo ago)26342MITPHP

Since Jun 1Pushed 9mo agoCompare

[ Source](https://github.com/jayson-temporas/translation-overrides)[ Packagist](https://packagist.org/packages/jaysontemporas/translation-overrides)[ RSS](/packages/jaysontemporas-translation-overrides/feed)WikiDiscussions 4x Synced 2d ago

READMEChangelog (3)Dependencies (4)Versions (6)Used By (0)

Translation Overrides for Filament
==================================

[](#translation-overrides-for-filament)

A Filament plugin that enables Translation Overrides management in Laravel applications with an elegant admin interface. Supports both multi-tenant and single-tenant applications.

[![Translation Overrides Admin Interface](assets/jaysontemporas-translation-overrides.jpg)](assets/jaysontemporas-translation-overrides.jpg)

Features
--------

[](#features)

- Built-in Filament admin panel for managing translations
- Support for both multi-tenant and single-tenant applications
- Per-tenant translation management in multi-tenant setups
- Global translation overrides for single-tenant applications
- Seamless integration with Filament resources and panels
- Support for multiple languages with easy switching
- Support for vendor/package translations (`lang/vendor/*`)
- Performance-optimized with automatic caching
- Override translations without modifying Laravel's original translation files

Requirements
------------

[](#requirements)

- PHP 8.3+
- Filament 3.2+

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require jaysontemporas/translation-overrides
```

Publish the configuration file:

```
php artisan translation-overrides:install
```

This will publish the config file to `config/translation-overrides.php` and the migration file to create the Translation Overrides table.

> **Important**: Before running migrations, you should review and update the configuration file to set your preferred table name, tenancy mode, and other settings.

Run the migrations after configuring:

```
php artisan migrate
```

Configuration
-------------

[](#configuration)

After publishing the configuration file, you can configure the package in `config/translation-overrides.php`:

```
return [
    // Cache duration in seconds
    'cache_duration' => 21600, // 6 hours

    // Filament navigation settings
    'navigation' => [
        'group' => 'Settings',
    ],

    // Access control
    'can_access' => [
        'role' => 'Super Admin',
    ],

    // Tenancy configuration
    'tenancy_enabled' => false, // Set to true for multi-tenant apps

    // Your tenant model (only needed if tenancy_enabled is true)
    'tenant_model' => null, // \App\Models\Team::class

    // Table name for storing Translation Overrides
    'table_name' => 'translation_overrides',
    'tenant_id_column' => null, // Ex. tenant_id, only used if tenancy_enabled is true

    // Supported languages
    'supported_languages' => [
        'en' => 'English',
        'es' => 'Spanish',
        'fr' => 'French',
        // Add more languages as needed
    ],
];
```

Usage
-----

[](#usage)

### For Single-Tenant Applications (Non-Tenancy)

[](#for-single-tenant-applications-non-tenancy)

If you're using this package in a single-tenant application, set `tenancy_enabled` to `false` in your configuration:

```
// config/translation-overrides.php
return [
    'tenancy_enabled' => false,
    // ... other configuration
];
```

In this mode:

- No tenant relationship is created in the database
- All translation overrides are global to your application
- No tenant filtering in the admin interface
- The `HasTenantTranslation` contract is not required in your Model

### For Multi-Tenant Applications

[](#for-multi-tenant-applications)

If you're using this package in a multi-tenant application, ensure `tenancy_enabled` is `true`:

```
// config/translation-overrides.php
return [
    'tenancy_enabled' => true,
    'tenant_model' => \App\Models\Team::class,

    'table_name' => 'translation_overrides',
    'tenant_id_column' => 'tenant_id',
    // ... other configuration
];
```

#### User Model Requirements (Multi-Tenant Only)

[](#user-model-requirements-multi-tenant-only)

Your User model should implement the `HasTenantTranslation` contract:

```
use JaysonTemporas\TranslationOverrides\Contracts\HasTenantTranslation;

class User extends Authenticatable implements HasTenantTranslation
{
    // ...

    public function getTranslationTenantId(): int|null
    {
        if (Filament::getTenant()) {
            return Filament::getTenant()->id;
        }

        return null;

        // OR in simple tenancy structure, users table has tenant_id
        // return $this->tenant_id;
    }
}
```

Filament Integration
--------------------

[](#filament-integration)

### Registering the Plugin

[](#registering-the-plugin)

Add the TranslationOverrides plugin to your Filament panel:

```
use JaysonTemporas\TranslationOverrides\TranslationOverridesPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugins([
            TranslationOverridesPlugin::make(),
        ])
        // ...
}
```

This will automatically register the TranslationOverride resource in your Filament admin panel under the configured navigation group (default: "Settings").

### Customizing the Resource

[](#customizing-the-resource)

You can override the default TranslationOverrideResource by creating your own resource class and configuring the plugin to use it. This is useful when you need to customize access controls, modify the interface, or add additional functionality.

#### Basic Usage

[](#basic-usage)

```
use JaysonTemporas\TranslationOverrides\TranslationOverridesPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            TranslationOverridesPlugin::make()
                ->usingResource(CustomTranslationOverrideResource::class),
        ]);
}
```

#### Example: Custom Access Control

[](#example-custom-access-control)

Create a custom resource class that extends the default one:

```
use JaysonTemporas\TranslationOverrides\Filament\Resources\TranslationOverrideResource;

class CustomTranslationOverrideResource extends TranslationOverrideResource
{
    public static function canAccess(): bool
    {
        // Only allow super admins to access translation overrides
        return auth()->user()?->hasRole('super-admin');
    }
}
```

### Admin Interface

[](#admin-interface)

Once installed, you'll have access to a dedicated translations management interface in your Filament admin panel where you can:

**For Single-Tenant Applications:**

- Create, edit, and delete global translations
- Filter translations by language
- Search by translation key or value

**For Multi-Tenant Applications:**

- Create, edit, and delete tenant-specific translations
- Filter translations by language
- Search by translation key or value
- Assign translations to specific tenants

### User Model Requirements (For Multi-Tenant)

[](#user-model-requirements-for-multi-tenant)

Your User model should implement the `HasTenantTranslation` contract:

```
use JaysonTemporas\TranslationOverrides\Contracts\HasTenantTranslation;

class User extends Authenticatable implements HasTenantTranslation
{
    // ...

    public function getTranslationTenantId(): int
    {
        return Filament::getTenant()->id;

        // OR in simple tenancy structure, users table has tenant_id
        // return $this->tenant_id;
    }
}
```

### Using Translations in Your Application

[](#using-translations-in-your-application)

After configuring the Filament interface, you can use translations in your views:

```
// In blade templates
{{ __('message.greeting') }}

// In PHP code
__('message.greeting');
```

#### How It Works

[](#how-it-works)

This plugin provides a way to override translations without actually modifying Laravel's original translation files. When a translation key is requested:

**Single-Tenant Mode:**

1. The system first checks if a global translation override exists in the database
2. If found, it returns the custom translation
3. If not found, it falls back to Laravel's standard translation files

**Multi-Tenant Mode:**

1. The system first checks if a tenant-specific translation exists in the database
2. If found, it returns the tenant's custom translation
3. If not found, it falls back to Laravel's standard translation files

This approach allows you to:

- Customize translations without duplicating translation files
- Update translations through the admin interface without touching code
- Keep the original Laravel translations intact for reference or fallback

Vendor Translations
-------------------

[](#vendor-translations)

This package supports vendor translations published by Laravel packages. When a package provides its own translations, they are typically published to:

```
lang/vendor/package-name/en
lang/vendor/package-name/es

```

The package automatically discovers and includes these vendor translations in your Translation Overrides management interface. Vendor translations will appear with their package name as a prefix (e.g., `package-name.file.key`).

To publish vendor translations from a package, you can use Laravel's standard vendor publish command:

```
php artisan vendor:publish --tag=package-name-translations
```

Once published, these translations will be automatically available in the translation management interface and can be customized per tenant (in multi-tenant mode) or globally (in single-tenant mode).

License
-------

[](#license)

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

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance58

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~40 days

Total

4

Last Release

277d ago

Major Versions

1.0.2 → 2.0.02025-10-01

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29498181?v=4)[jayson-temporas](/maintainers/jayson-temporas)[@jayson-temporas](https://github.com/jayson-temporas)

---

Top Contributors

[![jayson-temporas](https://avatars.githubusercontent.com/u/29498181?v=4)](https://github.com/jayson-temporas "jayson-temporas (3 commits)")

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/jaysontemporas-translation-overrides/health.svg)

```
[![Health](https://phpackages.com/badges/jaysontemporas-translation-overrides/health.svg)](https://phpackages.com/packages/jaysontemporas-translation-overrides)
```

###  Alternatives

[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[stephenjude/filament-feature-flags

Filament implementation of feature flags and segmentation with Laravel Pennant.

122177.8k1](/packages/stephenjude-filament-feature-flags)[stephenjude/filament-jetstream

A Laravel starter kit built with Filament inspired by Jetstream.

17760.2k3](/packages/stephenjude-filament-jetstream)[stephenjude/filament-debugger

About

104162.2k2](/packages/stephenjude-filament-debugger)[stephenjude/filament-two-factor-authentication

Filament Two Factor Authentication: Google 2FA + Passkey Authentication

84215.9k9](/packages/stephenjude-filament-two-factor-authentication)[backstage/mails

View logged mails and events in a beautiful Filament UI.

16120.1k](/packages/backstage-mails)

PHPackages © 2026

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