Laravel Translatable

Store and retrieve database translations of Eloquent models with almost no extra code

Library
Composer
vv11.17.1
1,422stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
80/100Excellent
Development Activity76
Maintenance68
Community76
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
78/100Good
Architecture82
Code Quality84
Innovation62
Learning Curve85

Laravel Translatable is a Laravel package for building multilingual Eloquent models. It stores each model’s translated attributes in a separate translations table and transparently fetches or saves the right locale’s values when you read or write your model.

By adding a trait and a small amount of configuration, you get locale-aware attribute access ($post->title resolves to the active locale, $post->translate('de')->title targets a specific one) without scattering translation logic throughout your application.

What You Get

  • A Translatable trait to make any Eloquent model multilingual
  • Automatic locale-aware attribute reads and writes
  • Explicit translate($locale) access to any locale’s values
  • Bulk filling of multiple translations at once
  • Fallback-locale support and query scopes for translated data

Common Use Cases

  • Storing multilingual content (posts, products, pages) in the database
  • Serving locale-specific attribute values based on the app locale
  • Managing admin interfaces that edit several translations per record
  • Adding fallback locales so missing translations degrade gracefully

Under The Hood

Architecture - The core is the Translatable trait (src/Translatable/) applied to an Eloquent model, backed by a related translation model keyed by locale. The trait overrides attribute access so reads and writes resolve to the translation row for the current (or requested) locale, and adds query scopes and fallback-locale resolution. Configuration and language resources live under src/config and src/lang.

Tech Stack - PHP 8.0+ package depending on illuminate/contracts, illuminate/database, and illuminate/support, compatible across Laravel 9 through 13. Quality tooling includes PHPStan, Pint, and PHPUnit.

Code Quality - The project is statically analyzed with PHPStan (phpstan.neon), formatted with Pint, and covered by a PHPUnit test suite (18 test files). Broad Laravel version support and a maintained docs site indicate a well-kept, mature package.

API Design - The public API leans on Laravel idioms: add a trait, define $translatedAttributes, and use normal attribute access. translate($locale), bulk fill, and query scopes are discoverable and consistent with Eloquent conventions, so the learning curve for Laravel developers is low.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search