outl1ne / nova-translations-loader by Tarpsvo

This Laravel Nova package helps developers load translations into their packages.
3,182,963
39
4
Package Data
Maintainer Username: Tarpsvo
Package Create Date: 2020-09-15
Package Last Update: 2024-03-13
Language: PHP
License: MIT
Last Refreshed: 2024-04-19 15:16:08
Package Statistics
Total Downloads: 3,182,963
Monthly Downloads: 30,906
Daily Downloads: 1,433
Total Stars: 39
Total Watchers: 4
Total Forks: 37
Total Open Issues: 1

Nova Translations Loader

Latest Version on Packagist Total Downloads

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

Requirements

  • php: >=7.2
  • laravel/framework: ^7.0 || ^8.0
  • laravel/nova: ^3.0

Installation

Install the package in a Laravel Nova project via Composer:

composer require optimistdigital/nova-translations-loader

Usage

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

use OptimistDigital\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.