Download the PHP package elaborate-code/laravel-json-tongue without Composer
On this page you can find all versions of the php package elaborate-code/laravel-json-tongue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download elaborate-code/laravel-json-tongue
More information about elaborate-code/laravel-json-tongue
Files in elaborate-code/laravel-json-tongue
Package laravel-json-tongue
Short Description Use multiple JSON files per locale on Laravel
License MIT
Homepage https://github.com/elaborate-code/laravel-json-tongue
Informations about the package laravel-json-tongue
Laravel JSON tongue
This package is built on top of PHP JSON tongue to enable the usage of multiple JSON files per locale on Laravel.
Introduction
Starting with Laravel docs:
Translation strings may be defined within JSON files that are placed within the lang directory. When taking this approach, each language supported by your application would have a corresponding JSON file within this directory. This approach is recommended for applications that have a large number of translatable strings.
Intuitively, many developers wonder why isn't it possible to have each language supported by their application have multiple corresponding JSON files. Multiple JSON files allows grouping strings by topic, and keeping the files small and clear.
Installation
Install the package via composer:
Requirements
- PHP 8.0 or higher.
Usage
File structure example:
The JSON files can co-exist with the PHP files without any conflicts!
The merge command
This command loads all the JSON files from /<locale>
folders within the /lang
folder and merge them per locale in new JSON files.
Options:
Option | Description |
---|---|
-F\|--force |
Removes JSON files that already exist in the root of the lang folder without asking |
JSON files that already exist in the root of the
lang
folder, can be old JSON files previously generated by the command, or files that you have created manually and populated manually.⚠️ In the second case be careful before instructing the command to remove existing JSON files!
Example
Before merging :
After merging:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Help needed to add a watch command that refreshes the output JSON files with new translations added on the locale folders.
Credits
- medilies
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-json-tongue with dependencies
elaborate-code/php-json-tongue Version ^1.2
illuminate/contracts Version ^9.0
spatie/laravel-package-tools Version ^1.13.0