outl1ne/nova-translations-loader

This Laravel Nova package helps developers load translations into their packages.

Maintainers

👁 Tarpsvo

Package info

github.com/outl1ne/nova-translations-loader

pkg:composer/outl1ne/nova-translations-loader

Statistics

Installs: 5 944 274

Dependents: 45

Suggesters: 1

Stars: 39

Open Issues: 1

5.0.3 2024-10-22 08:19 UTC

Requires

  • php: >=8.0
  • laravel/nova: ^4.0|^5.0

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 87be6da40633e0cd0b9276cf494f0ca8954eccc0

translationsnovalaraveloptimistdigitaloutl1ne


README

👁 Latest Version on Packagist
👁 Total Downloads

This Laravel Nova package helps developers load translations into their packages.

Requirements

  • php: >=8.0
  • laravel/framework: ^9.0|^10.0
  • laravel/nova: ^4.0

Installation

Install the package in a Laravel Nova project via Composer:

composer require outl1ne/nova-translations-loader

Usage

Inside a Laravel's ServiceProvider, use the LoadsNovaTranslations trait and call $this->loadTranslations():

use Outl1ne\NovaTranslationsLoader\LoadsNovaTranslations;

class SomePackagesServiceProvider extends ServiceProvider
{
 use LoadsNovaTranslations;

 public function boot()
 {
 // ...

 /**
 * Loads translations into the Nova system.
 *
 * @param string $packageTranslationsDir The directory for the packages' translation files.
 * @param string $packageName The name of the current package (ie 'nova-menu-builder').
 * @param boolean $publishTranslations Whether to also automatically make translations publishable.
 * @return null
 **/

 $this->loadTranslations(__DIR__ . '/../resources/lang', 'nova-package', true);

 // ...
 }
}

Credits

License

Nova Translations Loader is open-sourced software licensed under the MIT license.