Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Laravel
  3. Laravel Translatable

Laravel Translatable

MITPHP6.14.1

A Laravel Eloquent trait to store model translations as JSON without extra database tables.

Visit WebsiteGitHubGitHub
2.5k stars296 forks0 contributors

What is Laravel Translatable?

Spatie Laravel Translatable is a PHP package that provides a trait to make Eloquent models translatable. It allows developers to store and manage multilingual content directly in JSON columns within the model's database table, eliminating the need for separate translation tables. This simplifies the database schema while providing full locale-aware retrieval and querying capabilities.

Target Audience

Laravel developers building multilingual applications who need to store and manage translated content for Eloquent models efficiently. It's particularly useful for projects requiring content localization without complex database structures.

Value Proposition

Developers choose this package because it offers a minimal, elegant solution that leverages Laravel's built-in JSON column support, reducing database complexity while providing powerful translation features. Its simple trait-based approach and comprehensive query scopes make it easier to implement than maintaining separate translation tables.

Overview

Making Eloquent models translatable

Use Cases

Best For

  • Adding multilingual support to Laravel Eloquent models
  • Storing translations in JSON columns without extra database tables
  • Building Laravel applications with localized content management
  • Querying translated records based on specific locales
  • Managing nested JSON field translations in Eloquent models
  • Simplifying database schema for multilingual Laravel projects

Not Ideal For

  • Applications requiring normalized translation tables for complex joins or data integrity constraints
  • Projects needing a full-featured translation management system with UI, versioning, or collaborative workflows
  • Systems using databases without efficient JSON column support (e.g., MySQL 5.6 or older)
  • High-scale applications where JSON query performance on large datasets could become a bottleneck

Pros & Cons

Pros

Minimal Database Overhead

Stores translations directly in JSON columns within the model's table, eliminating the need for separate translation tables and simplifying the database schema, as emphasized in the README's 'no extra table' approach.

Easy Trait Integration

Simply use the HasTranslations trait and define translatable attributes to enable multilingual support, making it quick to implement without extensive configuration or boilerplate code.

Advanced Query Scopes

Provides built-in methods like whereLocale and whereJsonContainsLocale for locale-specific queries, allowing efficient filtering of translated records without writing custom SQL.

Nested JSON Support

Supports translating nested keys within JSON columns using dot notation (e.g., meta->description), enabling localization of complex data structures as demonstrated in the README examples.

Cons

JSON Column Dependencies

Relies on database JSON column support, which may not be available in all environments (e.g., older database versions) and can lead to vendor lock-in or migration challenges.

Limited Management Tools

Focuses solely on backend storage and retrieval without built-in features for translation editing, validation, or admin interfaces, requiring additional development effort for full CMS integration.

Performance Trade-offs

Complex queries on JSON data, especially with multiple locales or nested structures, might suffer from slower performance compared to normalized table approaches, as JSON indexing can be less efficient.

Frequently Asked Questions

Quick Stats

Stars2,457
Forks296
Contributors0
Open Issues0
Last commit28 days ago
CreatedSince 2016

Tags

#eloquent#database#laravel#multilingual#model-translations#i18n#translation-management#localization#php

Built With

P
PHP
L
Laravel
E
Eloquent

Links & Resources

Website

Included in

Laravel13.0k
Auto-fetched 17 hours ago

Related Projects

LiveWireLiveWire

A full-stack framework for Laravel that takes the pain out of building dynamic UIs.

Stars23,556
Forks1,742
Last commit2 days ago
Debug BarDebug Bar

Debugbar for Laravel (Integrates PHP Debug Bar)

Stars19,270
Forks1,617
Last commit14 days ago
IDE HelperIDE Helper

IDE Helper for Laravel

Stars14,953
Forks1,191
Last commit14 days ago
Intervention ImageIntervention Image

PHP Image Processing

Stars14,356
Forks1,495
Last commit5 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub