DEV.co
Open-Source Databases · Astrotomic

laravel-translatable

laravel-translatable is a Laravel package that simplifies storing and retrieving multilingual content for Eloquent models. It allows developers to manage translations directly on models without complex queries or manual relation handling.

Source: GitHub — github.com/Astrotomic/laravel-translatable
1.4k
GitHub stars
176
Forks
PHP
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
RepositoryAstrotomic/laravel-translatable
OwnerAstrotomic
Primary languagePHP
LicenseMIT — OSI-approved
Stars1.4k
Forks176
Open issues35
Latest releasev11.17.0 (2026-03-27)
Last updated2026-06-19
Sourcehttps://github.com/Astrotomic/laravel-translatable

What laravel-translatable is

A Laravel Eloquent trait-based package that implements a polymorphic translation pattern, storing translations in a separate database table and providing accessor/mutator syntax for fluent retrieval and persistence across locales. Integrates with Laravel's service container and app locale system.

Quickstart

Get the laravel-translatable source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/Astrotomic/laravel-translatable.gitcd laravel-translatable# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Multilingual Product Catalogs

E-commerce platforms needing product titles, descriptions, and metadata in multiple languages with locale-aware queries and efficient database lookups.

Blog & Content Management Systems

CMS applications storing posts, pages, and comments in multiple languages with automatic locale switching and simplified translation workflows.

SaaS Platforms with Global Users

Multi-tenant or single-tenant applications requiring user-facing content (help text, labels, documentation) in different languages per region or user preference.

Implementation considerations

  • Requires a separate translation table per translatable model; ensure your database schema includes `translatable` relation configuration and locale-keyed translation records.
  • Trait-based implementation means translatable models must explicitly use the `Translatable` trait; check all models needing i18n are properly configured.
  • Performance varies with number of locales and translation queries; use eager loading (`with('translations')`) to avoid N+1 queries in list views.
  • The package respects Laravel's `app()->getLocale()` for default locale switching; ensure your locale middleware or configuration sets this correctly.
  • Mass assignment and attribute casting interact with the trait; review config for `fillable`, `guarded`, and `casts` to avoid unexpected behavior.

When to avoid it — and what to weigh

  • High-volume real-time translation needs — If you need machine translation or dynamic language inference, this package only manages stored translations; it does not translate content.
  • Polyglot database schemas — If your data model already has denormalized translation columns per language or uses a document-oriented store, retrofitting this package may add unnecessary joins.
  • Minimal or single-language requirements — For projects with no multilingual scope, the package overhead (extra tables, trait logic) is not justified.
  • Non-Laravel ecosystems — This is a Laravel-specific package; it cannot be used outside Laravel or with other frameworks without significant rewriting.

License & commercial use

MIT License (Expat variant). Permissive OSI-approved license: unrestricted use, modification, and distribution permitted in proprietary and open-source projects with attribution and no liability.

MIT permits commercial use without restriction. Attribution is encouraged but not legally required. No license fees or usage restrictions apply. Review the full LICENSE file for exact terms, but no special commercial licensing needed.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitStrong
Assessment confidenceHigh
Security considerations

No explicit security vulnerabilities noted in the data provided. Standard Laravel input validation and ORM safety apply. If storing user-generated translation content, sanitize input before saving to prevent injection. The package does not encrypt translations at rest; use Laravel encryption features if sensitive translations are stored.

Alternatives to consider

spatie/laravel-translatable

Industry-standard alternative with similar trait-based API; arguably more widely adopted in Laravel ecosystem. Compare documentation, release cadence, and issue resolution speed for your use case.

mcamara/laravel-localization

Broader localization package handling routes, views, and middleware alongside models. Use if you need URL-level locale routing or view-level translation in addition to model translations.

Custom polymorphic translation table with Eloquent relations

Build your own if you need non-standard translation logic (e.g., versioning, approval workflows, or language-specific validation rules) not covered by off-the-shelf packages.

Software development agency

Build on laravel-translatable with DEV.co software developers

Evaluate laravel-translatable against your project's localization needs. If you need production support, integration guidance, or custom multilingual architecture, our Laravel specialists can help.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

laravel-translatable FAQ

Does this package translate content automatically?
No. It stores pre-translated content in the database. You must provide or fetch translations from elsewhere (e.g., a translation service, manual entry, or seed data) before saving.
Can I use this with other Laravel packages like spatie/laravel-permission?
Yes. The trait-based design is non-invasive; it can coexist with other packages. Ensure traits are applied in the correct order and test attribute conflicts.
What happens if a translation is missing for the current locale?
The package behavior depends on configuration (fallback locale handling). Review the GitBook docs for fallback strategy; default behavior is typically to return null or fall back to a default locale.
Is this suitable for high-traffic production applications?
Yes, with caching. Use Laravel's Cache/Redis to memoize translations and avoid repeated queries. Monitor N+1 query patterns with eager loading.

Software developers & web developers for hire

Adopting laravel-translatable is usually one piece of a larger software development effort. As a software development agency, DEV.co provides software development services and web development expertise — pairing senior software developers and web developers with your team to design, build, and operate open-source databases software in production.

Ready to add multilingual support to your Laravel app?

Evaluate laravel-translatable against your project's localization needs. If you need production support, integration guidance, or custom multilingual architecture, our Laravel specialists can help.