Skip to content

A Laravel Nova package that simplifies the loading of translations inside other packages.

License

Notifications You must be signed in to change notification settings

philippgrimm/nova-translations-loader-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nova Translations Loader

Latest Version on Packagist Total Downloads

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

Requirements

  • php: >=8.0
  • laravel/framework: ^8.0
  • laravel/nova: ^3.30.0

Installation

Install the package in a Laravel Nova project via Composer:

composer require optimistdigital/nova-translations-loader-php

Usage

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

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

About

A Laravel Nova package that simplifies the loading of translations inside other packages.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%