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

Nova Spatie Translatable Laravel Package

mrmonat/nova-spatie-translatable

Nova Spatie Translatable adds a Laravel Nova field for models using spatie/laravel-translatable. Manage multilingual attributes directly in Nova forms with locale-aware tabs, so you can edit translations for each language without custom fields or extra tooling.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Confirm your app runs PHP 8+ and a Laravel version compatible with this release; then install/update via Composer.
  • Start with the package README and any publishable config (php artisan vendor:publish). Check the changelog for the spatie/laravel-translatable >= 5.0 constraint.
  • First use case: add the package’s translatable trait/interface to an Eloquent model, declare the translated attributes, and store/retrieve a translation for the current locale.

Implementation Patterns

  • Define translatable attributes on the model (commonly a $translatable array) and use the package’s setTranslation / getTranslation / translate helpers rather than manually reading JSON columns.
  • Switch locales through Laravel’s app()->setLocale() or the package’s locale resolver; keep fallback locale configuration explicit so missing translations behave predictably.
  • Validate translated input per locale in Form Requests (e.g. title.en, title.fr) and map validated arrays into the model’s translation API.
  • Eager-load translations where the package supports it, and avoid calling translation accessors inside loops without preloading to prevent N+1 queries.
  • In Blade/API resources, prefer a single translation helper with an explicit locale argument over repeated app()->getLocale() calls, so output is testable and consistent.
  • When integrating with spatie/laravel-translatable >= 5.0, verify both packages use compatible trait/interface contracts and avoid mixing their translation APIs in the same model.

Gotchas and Tips

  • PHP 8 support is new in 2.2.0: re-run your test suite and check for deprecations, typed property conflicts, and nullsafe/union-type edge cases in custom accessors.
  • The spatie/laravel-translatable >= 5.0 requirement may pull in breaking upstream changes; test fallback behavior and any custom translation loaders after upgrading.
  • Fallback locales can hide missing translations. Use a non-fallback lookup when you need to detect untranslated content, and assert this in tests.
  • Translation storage typically relies on JSON columns; confirm your database supports them and that model casts/config are correct after upgrading.
  • Clear config and application caches after changing locale/fallback settings, and include a translation smoke test in CI for each supported locale.
  • Debug with getTranslations()/toArray() to inspect raw translation payloads, and use package extension points (custom locale resolver or translation loader) rather than overriding model internals.
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.
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus