From 3a88810f3453927c541c55a6fbab995b2d34a8a5 Mon Sep 17 00:00:00 2001 From: Stefan Ninic Date: Sat, 12 Feb 2022 13:23:08 +0100 Subject: [PATCH 1/3] Added support for Laravel 9 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 059bb3e..5e54129 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "kg-bot/laravel-localization-to-vue", "description": "Laravel package used to collect all localization files from resources/lang (and custom) directories and sub-directories and make them available as JSON file", "require": { - "laravel/framework": "5.*|^6|^7|^8", + "laravel/framework": "5.*|^6|^7|^8|^9", "ext-json": "*" }, "keywords": [ From 9c56cca4f875d0e7a6c61d735eb96613bc7b6693 Mon Sep 17 00:00:00 2001 From: Stefan Ninic Date: Sat, 12 Feb 2022 14:43:46 +0100 Subject: [PATCH 2/3] Laravel 9 uses Filesystem V3 so for backward compatibility version 2 of package is required, all changes for Laravel <9 should be done on V1 of this package, all changes for Laravel >9 should be done on V2 of this package Laravel 9 places language files in root path and not in resources/lang anymore, using lang_path() in this package configuration Minimum PHP version for Laravel 9 is 8.0.2, added php requirement in composer.json --- README.md | 22 ++++++++++++++----- composer.json | 1 + src/Console/Commands/ExportMessages.php | 2 +- src/Console/Commands/ExportMessagesToFlat.php | 2 +- src/config/laravel-localization.php | 2 +- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f6444d7..1dc20fd 100644 --- a/README.md +++ b/README.md @@ -15,14 +15,24 @@ which can later be converted to JSON object and used with libraries like Vue, An ## Installing -Just require this package with composer. +#### Laravel before version 9 ``` -composer require kg-bot/laravel-localization-to-vue +composer require kg-bot/laravel-localization-to-vue:^1 ``` -### Laravel 8.0+ -Laravel 8.0 require minimum of PHP 7.3. make sure you have at least PHP 7.3 before running composer. +#### Laravel 9 + +``` +composer require kg-bot/laravel-localization-to-vue:^2 +``` + + +### Laravel 8+ +Laravel 8 requires minimum of PHP 7.3. make sure you have at least PHP 7.3 before running composer. + +### Laravel 9+ +Laravel 9 requires minimum of PHP 8.0.2 make sure you have at least PHP 8.0.2 before running composer. ### Laravel 5.5+ @@ -46,12 +56,12 @@ You can export config by running php artisan vendor:publish --provider="KgBot\LaravelLocalization\LaravelLocalizationServiceProvider" --tag=config ``` -if you want to parse multiple language directories or some other directory except `resources/lang` you can add multiple +if you want to parse multiple language directories or some other directory except `lang_path()` you can add multiple paths in config `paths.lang_dirs` inside array. It can be just one path or multiple paths, for example ```php -paths => [resource_path('lang'), app_path('lang'), app_path('Modules/Blog/lang')] +paths => [lang_path(), app_path('lang'), app_path('Modules/Blog/lang')] ``` You can run your own callback function after export, to do that you must register globally accessible function, for example diff --git a/composer.json b/composer.json index 5e54129..6bcd9e9 100644 --- a/composer.json +++ b/composer.json @@ -2,6 +2,7 @@ "name": "kg-bot/laravel-localization-to-vue", "description": "Laravel package used to collect all localization files from resources/lang (and custom) directories and sub-directories and make them available as JSON file", "require": { + "php": "^8.0", "laravel/framework": "5.*|^6|^7|^8|^9", "ext-json": "*" }, diff --git a/src/Console/Commands/ExportMessages.php b/src/Console/Commands/ExportMessages.php index 28a4178..7c4d5c6 100644 --- a/src/Console/Commands/ExportMessages.php +++ b/src/Console/Commands/ExportMessages.php @@ -4,7 +4,7 @@ use Illuminate\Console\Command; use KgBot\LaravelLocalization\Facades\ExportLocalizations; -use League\Flysystem\Adapter\Local; +use League\Flysystem\Local\LocalFilesystemAdapter as Local; use League\Flysystem\Filesystem; class ExportMessages extends Command diff --git a/src/Console/Commands/ExportMessagesToFlat.php b/src/Console/Commands/ExportMessagesToFlat.php index 3384669..008dbd6 100644 --- a/src/Console/Commands/ExportMessagesToFlat.php +++ b/src/Console/Commands/ExportMessagesToFlat.php @@ -4,7 +4,7 @@ use Illuminate\Console\Command; use KgBot\LaravelLocalization\Facades\ExportLocalizations; -use League\Flysystem\Adapter\Local; +use League\Flysystem\Local\LocalFilesystemAdapter as Local; use League\Flysystem\Filesystem; class ExportMessagesToFlat extends Command diff --git a/src/config/laravel-localization.php b/src/config/laravel-localization.php index 5f461ab..d950ee1 100644 --- a/src/config/laravel-localization.php +++ b/src/config/laravel-localization.php @@ -86,7 +86,7 @@ * In you .env file just add: * LARAVEL_LOCALIZATION_LANG_DIRS=resources/lang,Modules/Blog/Resources/lang */ - 'lang_dirs' => [resource_path('lang')], + 'lang_dirs' => [lang_path()], ], /** * You can customize the regexp for lang files to be able to exclude certain files. From 55d536df2d8ab4974fa0184c0cd851ceee7233da Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sat, 12 Feb 2022 13:43:56 +0000 Subject: [PATCH 3/3] Apply fixes from StyleCI --- src/Console/Commands/ExportMessages.php | 2 +- src/Console/Commands/ExportMessagesToFlat.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Console/Commands/ExportMessages.php b/src/Console/Commands/ExportMessages.php index 7c4d5c6..d362487 100644 --- a/src/Console/Commands/ExportMessages.php +++ b/src/Console/Commands/ExportMessages.php @@ -4,8 +4,8 @@ use Illuminate\Console\Command; use KgBot\LaravelLocalization\Facades\ExportLocalizations; -use League\Flysystem\Local\LocalFilesystemAdapter as Local; use League\Flysystem\Filesystem; +use League\Flysystem\Local\LocalFilesystemAdapter as Local; class ExportMessages extends Command { diff --git a/src/Console/Commands/ExportMessagesToFlat.php b/src/Console/Commands/ExportMessagesToFlat.php index 008dbd6..28acd0e 100644 --- a/src/Console/Commands/ExportMessagesToFlat.php +++ b/src/Console/Commands/ExportMessagesToFlat.php @@ -4,8 +4,8 @@ use Illuminate\Console\Command; use KgBot\LaravelLocalization\Facades\ExportLocalizations; -use League\Flysystem\Local\LocalFilesystemAdapter as Local; use League\Flysystem\Filesystem; +use League\Flysystem\Local\LocalFilesystemAdapter as Local; class ExportMessagesToFlat extends Command {