Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Translatable

Laravel Translatable Laravel Package

novius/laravel-translatable

A Laravel package that makes Eloquent models translatable using just two fields: locale and locale_parent_id. The trait adds translation relations, a translate() helper, getTranslation() lookup, and a withLocale() query scope.

View on GitHub
Deep Wiki
Context7

Laravel Translatable makes Eloquent models translatable using just two fields: locale and locale_parent_id. Each translation is stored as its own model row linked to the original, so localized content can be created, retrieved, and queried without extra tables or complex setup.

  • translations and translationsWithDeleted relations
  • translate(string $locale, array $attributes = []) to create a translation
  • getTranslation(string $locale, bool $withDeleted = false) to fetch one
  • withLocale($locale) query scope for filtering
  • translatable() migration macro and customizable translatableConfig
Frequently asked questions about Laravel Translatable
How do I install novius/laravel-translatable in Laravel?
Install it with composer require novius/laravel-translatable, then add the translatable() macro to your migration and use the Translatable trait on your Eloquent model. Publishing the lang files with the vendor:publish command is optional. No service container bindings or config file are required.
Which Laravel and PHP versions does this translatable package support?
The package supports Laravel 10.x, 11.x, 12.x, and 13.x on PHP 8.2 through 8.5. Check the README and Packagist release badge for the current supported matrix before upgrading. Version support is tied to the single vendor maintaining the package.
How does novius/laravel-translatable store translations in the database?
Translations are stored as sibling rows in the same database table, linked by a self-referencing locale_parent_id column and differentiated by a locale column. The translatable() migration macro provisions both columns automatically. This keeps locale data normalized and SQL-queryable, but it is not a per-field overlay model.
What is the difference between record-level and field-level translation, and which does this package support?
This package implements record-level translation only: a translation is a full copy of the record in another locale. It does not support field-level partial translations such as translating a title but not a slug. If you need per-field translation, you need a different architecture or package.
How do I get all translations or a specific locale translation for a model?
Use the translations relation to get all translations including the original, or translationsWithDeleted to include soft-deleted rows. getTranslation('en') returns the translated model or null, and translate('en', ['title' => 'English']) creates a new translation. You can also filter queries by locale with the withLocale() scope.
Why does Post::all() return duplicate rows for every locale?
Because all locales live in one table, an unscoped Post::all() returns every locale as a separate row. Every listing, count, sitemap, search index, and API response must be locale-filtered, ideally through a base repository or global scope. Missing this discipline ships duplicate content and is an SEO and UX defect that often surfaces only in production.
What license does novius/laravel-translatable use and can I use it in a SaaS product?
The package is licensed under AGPL-3.0, which is network-use copyleft. A hosted or SaaS product can trigger source-disclosure obligations for the combined work, so legal sign-off is a gate rather than a caveat. If that is incompatible with your distribution model, choose a paid fork, an MIT alternative, or an in-house build.
Is novius/laravel-translatable actively maintained and safe for production?
Adoption signals are weak: the repository shows 0 stars and 0 dependents, and Novius (an agency) is the sole steward with a bus factor of roughly one. There is no community-discovered edge-case corpus or third-party tutorial base, so you would be the first production user. Name an internal owner who reviews upstream PRs and handles future Laravel upgrades.
How does this package handle missing translations and fallback locales?
The package provides no fallback logic; getTranslation returns null when a locale is missing and missing-locale behavior is entirely yours to build. Inconsistent fallback across models is a common user-visible bug class. Decide centrally whether a missing es translation should 404, redirect, silently fall back to en, or leave an hreflang gap.
What are alternatives to novius/laravel-translatable for Laravel localization?
Common alternatives include spatie/laravel-translatable (JSON-based field-level translations), astrotomic/laravel-translatable (separate translation table, MIT), or an in-house build. Choose based on whether you need record-level or field-level semantics first, since that eliminates half the candidate packages. Also consider exit cost and licensing before adopting.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core