https://github.com/jameshemery/laravel-json-translation-loader
:speech_balloon: A Laravel package to improve the loading of the JSON translation.
https://github.com/jameshemery/laravel-json-translation-loader
i18n json laravel laravel-package php
Last synced: about 1 year ago
JSON representation
:speech_balloon: A Laravel package to improve the loading of the JSON translation.
- Host: GitHub
- URL: https://github.com/jameshemery/laravel-json-translation-loader
- Owner: JamesHemery
- License: mit
- Created: 2019-05-02T20:42:52.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-01-21T11:27:08.000Z (over 6 years ago)
- Last Synced: 2025-03-26T16:38:37.812Z (over 1 year ago)
- Topics: i18n, json, laravel, laravel-package, php
- Language: PHP
- Homepage:
- Size: 12.7 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# laravel-json-translation-loader
[](https://travis-ci.org/JamesHemery/laravel-json-translation-loader)
[](https://packagist.org/packages/jamesh/laravel-json-translation-loader)
[](https://raw.githubusercontent.com/JamesHemery/laravel-json-translation-loader/master/LICENSE)
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`
```php
lluminate\Translation\TranslationServiceProvider::class,
```
By the service provider of this package:
```php
Jamesh\JsonTranslationLoader\TranslationServiceProvider::class,
```
## Usage
#### Register a namespace
In your service provider:
```php
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`.