jamesh / laravel-json-translation-loader
A Laravel package to improve the loading of the JSON translation.
Installs: 21
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 1
Open Issues: 0
Type:plugin
Requires
- php: ^7.2
- illuminate/translation: ~5.7.0|~5.8.0|^6.0
Requires (Dev)
- orchestra/testbench: ~3.7.0|~3.8.0
- phpunit/phpunit: ^7.0|^8.0
This package is auto-updated.
Last update: 2024-12-21 23:31:53 UTC
README
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
.