Weave Code
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 Translatable Laravel Package

spatie/nova-translatable

Make any Laravel Nova field translatable with a simple Translatable wrapper. Works with spatie/laravel-translatable to store per-locale values in a JSON column, rendering locale tabs for editing. Requires Nova 4/5 and MySQL 5.7.8+.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Nova-Centric Design: The package is tightly coupled with Laravel Nova, making it ideal for projects already using Nova for admin panel needs. It extends Nova’s field system without requiring changes to core Laravel or Eloquent models.
  • Field-Level Translatability: Enables granular translation support for individual fields (e.g., title, description) rather than full-model translation, reducing complexity for multi-language apps where only specific fields need localization.
  • Composability: The Translatable::make() wrapper allows grouping fields logically, aligning with Nova’s declarative field definition pattern.

Integration Feasibility

  • Low Friction: Requires minimal changes—only wrapping fields in Translatable::make() in Nova resources. No model or database schema modifications unless using Spatie’s Translatable trait (optional).
  • Dependency Alignment: Compatible with Laravel Nova (v4+) and Spatie’s laravel-translatable package (if needed for model-level translation). Assumes existing Nova setup.
  • Database Agnostic: Works with any database supporting JSON columns (default) or relational tables (if paired with laravel-translatable).

Technical Risk

  • Nova Version Lock: Risk of breaking changes if Nova undergoes major API shifts. Package is actively maintained (last release: 2026), but alignment with Nova’s roadmap is critical.
  • Performance Overhead: JSON-based storage (default) may impact query performance for large datasets. Relational storage (via laravel-translatable) mitigates this but adds complexity.
  • Localization Strategy: Requires upfront decisions on:
    • Fallback locales (e.g., default language for missing translations).
    • Storage backend (JSON vs. relational).
    • Handling of translated fields in API/non-Nova contexts.

Key Questions

  1. Nova Ecosystem: Is Nova the primary admin interface, or is this a supplement to other tools (e.g., Filament, Backpack)?
  2. Translation Scope: Are all translatable fields in Nova, or will some require model-level translation (e.g., via laravel-translatable)?
  3. Locale Management: How are locales defined (hardcoded, dynamic, or via a separate table)? Does the app need locale-specific UI (e.g., dropdowns)?
  4. Testing Coverage: Are there existing tests for Nova resources? How will translatable fields be tested (e.g., locale-specific assertions)?
  5. Migration Path: Can the package be incrementally adopted (e.g., start with one resource) or is a big-bang approach needed?

Integration Approach

Stack Fit

  • Primary Use Case: Laravel Nova-based admin panels requiring multi-language support for specific fields (e.g., e-commerce products, CMS content).
  • Complementary Tools:
    • Spatie’s laravel-translatable: For model-level translation if needed (e.g., full resource localization).
    • Nova Packages: Works alongside other Spatie Nova packages (e.g., nova-media-library) or third-party field types.
  • Non-Nova Contexts: Limited utility outside Nova; translated fields won’t persist or display in non-Nova interfaces without additional logic.

Migration Path

  1. Assessment Phase:
    • Audit existing Nova resources to identify fields needing translation.
    • Decide on storage backend (JSON vs. relational) and locale management strategy.
  2. Incremental Rollout:
    • Start with a single resource (e.g., Post) to test the Translatable wrapper.
    • Gradually extend to other resources, prioritizing high-impact fields (e.g., titles, descriptions).
  3. Database Schema:
    • Option A (JSON): No schema changes; uses Nova’s default JSON storage for translatable fields.
    • Option B (Relational): Requires laravel-translatable setup (migrations, model traits) for better performance/scalability.
  4. Locale Integration:
    • Add locale selection UI (e.g., Nova toolbars, dropdowns) if not already present.
    • Configure fallback locales in Translatable::make() or globally.

Compatibility

  • Nova Version: Tested with Nova v4+. Verify compatibility with your Nova version (e.g., v3 may require adjustments).
  • PHP/Laravel: Compatible with Laravel 9+ (Nova’s minimum version). PHP 8.0+ recommended.
  • Field Types: Supports all Nova field types (e.g., Text, Trix, BelongsTo). Custom fields may need adaptation.
  • Caching: Translatable fields may impact Nova’s caching layer (e.g., resource indexing). Monitor performance.

Sequencing

  1. Setup:
    • Install package: composer require spatie/nova-translatable.
    • Publish config (if needed) for locale defaults.
  2. Resource Updates:
    • Modify fields() methods to wrap translatable fields in Translatable::make().
    • Example:
      Translatable::make([
          Text::make('title')->rules('required'),
          Trix::make('content'),
      ], locale: 'en', fallbackLocale: 'en_US'),
      
  3. Testing:
    • Validate translations persist correctly in Nova.
    • Test edge cases (e.g., missing locales, field validation).
  4. Deployment:
    • Roll out to staging, then production, monitoring for issues (e.g., JSON size limits).

Operational Impact

Maintenance

  • Package Updates: Monitor Spatie’s releases for Nova compatibility. MIT license allows easy forks if needed.
  • Locale Management:
    • Dynamic locales (e.g., user-selected) require additional logic (e.g., middleware, Nova toolbars).
    • Static locales simplify maintenance but limit flexibility.
  • Field-Specific Logic: Custom validation or logic for translatable fields must be duplicated per locale (e.g., rules() in Translatable::make()).

Support

  • Troubleshooting:
    • Common issues: Missing translations, JSON storage limits, or Nova caching conflicts.
    • Debugging tools: Nova’s nova:serve for local testing; package logs for errors.
  • Documentation: Spatie’s README and changelog are comprehensive, but custom use cases (e.g., dynamic locales) may need internal docs.
  • Community: Active GitHub repo (223 stars, recent releases) with responsive maintainers.

Scaling

  • Performance:
    • JSON Storage: Risk of bloated JSON columns for resources with many translatable fields. Monitor database size.
    • Relational Storage: Scales better for high-volume data but adds complexity.
    • Nova Indexing: Translatable fields may slow Nova’s search/indexing. Test with production-like datasets.
  • Concurrency: No inherent concurrency issues, but locale-specific writes (e.g., bulk updates) should be tested.
  • Cost: Minimal additional database overhead unless using relational storage.

Failure Modes

  • Data Corruption:
    • Risk if JSON storage hits column limits (e.g., MySQL’s 64KB limit). Mitigate with relational storage or field pruning.
    • Fallback locales may expose untranslated content if misconfigured.
  • UI/UX Issues:
    • Missing locale dropdowns or unclear translation workflows can confuse users.
    • Field validation errors may not localize properly (e.g., error messages).
  • Integration Failures:
    • Non-Nova interfaces (e.g., APIs) won’t automatically handle translated fields. Requires explicit logic.
    • Third-party Nova packages may not support translatable fields out-of-the-box.

Ramp-Up

  • Developer Onboarding:
    • Time Estimate: 1–2 days for initial setup; longer for complex locale management.
    • Key Concepts: Translatable::make() syntax, storage backends, fallback locales.
  • Testing Strategy:
    • Unit tests for Nova resources with translatable fields.
    • E2E tests for locale switching and data persistence.
  • Training:
    • Document field-wrapping patterns and locale best practices.
    • Train teams on debugging translatable field issues (e.g., JSON parsing errors).
  • Adoption Barriers:
    • Resistance to JSON storage if relational is preferred.
    • Initial complexity for dynamic locale scenarios.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport