jamesh/laravel-json-translation-loader

A Laravel package to improve the loading of the JSON translation.

dev-master 2020-01-21 11:27 UTC

This package is auto-updated.

Last update: 2024-10-21 23:07:58 UTC


README

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.