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 Translations Loader

Nova Translations Loader Laravel Package

outl1ne/nova-translations-loader

Load your package’s translation files into Laravel Nova. Add the LoadsNovaTranslations trait to a service provider and call loadTranslations() to register Nova translations and optionally publish them automatically. Compatible with Nova 4, Laravel 9/10.

View on GitHub
Deep Wiki
Context7

This package helps with loading translations inside a Nova package.

Frequently asked questions about Nova Translations Loader
How do I install Nova Translations Loader in my Laravel Nova project?
Run `composer require outl1ne/nova-translations-loader` in your project directory. The package requires PHP 8.0+, Laravel 9/10, and Nova 4.0+ for full compatibility. After installation, publish the config if needed using the package’s service provider.
Which Laravel Nova versions does this package support?
The package officially supports Nova 4.0+. While it may work with Nova 3.x, test thoroughly as some features (like translation publishing) rely on newer Nova APIs. Check the GitHub repo for version-specific notes if targeting older Nova releases.
Can I use custom translation file paths with this loader?
Yes, you can specify custom paths via the `NovaTranslationsLoader::paths()` method or by configuring the `loadTranslations()` call in your service provider. Defaults to `resources/lang/` if no path is provided, but you can override it for vendor-specific or nested translation directories.
Will this package conflict with other Nova packages using translations?
Conflicts are unlikely if other packages use standard Laravel translation loading. However, if multiple packages override translation logic (e.g., via service providers), prioritize loading order or use unique namespace prefixes for keys to avoid clashes.
How does the loader handle missing translation keys?
The package follows Laravel’s default behavior: missing keys fall back to the parent locale or return the key itself if no fallback exists. You can customize this by extending the loader’s fallback logic or using Laravel’s `trans()` helper with a default value.
Does Nova Translations Loader support RTL languages or pluralization rules?
Yes, the package leverages Laravel’s built-in localization system, which natively supports RTL languages and pluralization rules (e.g., `resources/lang/ar/plurals.php`). Test your specific RTL locales to ensure UI rendering aligns with expectations.
How do I load translations for a specific Nova package?
Use the `LoadsNovaTranslations` trait in your package’s service provider and call `$this->loadTranslations(__DIR__ . '/../resources/lang', 'your-package-name', true)`. The third parameter enables publishable translations, useful for admin-editable strings.
What’s the performance impact of loading translations dynamically?
The overhead is minimal for most use cases. Dynamic loading adds a slight delay during package initialization, but caching (via Laravel’s translation system) mitigates repeated loads. For 100+ packages, benchmark in staging to ensure no bottlenecks in Nova’s admin panel.
Can I use this package in non-Nova Laravel projects?
No, this package is designed exclusively for Laravel Nova. For standard Laravel apps, use Laravel’s built-in `trans()` helper or packages like `spatie/laravel-translation-loader` for similar functionality without Nova dependencies.
How do I test translations before deploying to production?
Publish the translations via Nova’s admin panel (if enabled) and verify strings render correctly across locales. Use Laravel’s `trans()` helper in Blade or PHP to test fallback behavior. For automated testing, mock the translation loader in unit tests with `partialMock()`.
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky