Looking to hire Laravel developers? Try LaraJobs

laravel-json-translation-loader maintained by jamesh

Description
A Laravel package to improve the loading of the JSON translation.
Author
Last update
2020/01/21 12:27 (dev-master)
License
Downloads
21

Comments
comments powered by Disqus

laravel-json-translation-loader

Travis Total Downloads MIT licensed

This package will allow you to load JSON translation files for groups and namespaces. By default Laravel only allows you to load php files for groups and namespaces translations.

Installation

You can install the package via composer:

composer require jamesh/laravel-json-translation-loader

After install package, you should replace Laravel's translation service provider in config/app.php

lluminate\Translation\TranslationServiceProvider::class,

By the service provider of this package:

Jamesh\JsonTranslationLoader\TranslationServiceProvider::class,

Usage

Register a namespace

In your service provider:

public function boot()
{
    $this->app['translator']->addNamespace('my-namespace', __DIR__ . '/my-custom-lang-directory');
}

Unit tests

To run the tests, just run composer install and composer test.