optimistdigital/nova-translations-loader

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


Keywords
translations, nova, laravel, optimistdigital
License
MIT

Documentation

Nova Translations Loader

Latest Version on Packagist Total Downloads

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

Installation

Install the package in a Laravel Nova project via Composer:

composer require optimistdigital/nova-translations-loader

Usage

Inside a Laravel's ServiceProvider, run the NovaTranslationsLoader::loadTranslations() function:

use OptimistDigital\NovaTranslationsLoader\NovaTranslationsLoader;

class SomePackagesServiceProvider extends ServiceProvider
{
    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
         **/

        NovaTranslationsLoader::loadTranslations(__DIR__ . '/../resources/lang', 'nova-some-package', true);

        // ...
    }
}

Credits

License

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