diff --git a/CHANGELOG.md b/CHANGELOG.md index b84a0f2..2c35ae6 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to `laravel-artisan-translations` will be documented in this file +## 2.0.0 - 2022-04-20 + +- Laravel 9 compatibility + ## 1.0.0 - 2017-06-01 - initial release diff --git a/README.md b/README.md index 173c368..3fa897c 100755 --- a/README.md +++ b/README.md @@ -26,34 +26,33 @@ Now add the service provider in `config/app.php` file: ### Add translations from a single file ```php -php artisan translations:add vendor/typicms/pages/src/resources/lang/fr.json +php artisan translations:add vendor/typicms/pages/src/lang/fr.json ``` -Every translations present in this file will be added to ```/resources/lang/fr.json```. +Every translations present in this file will be added to `/lang/fr.json`. ### Add translations from a directory ```php -php artisan translations:add vendor/typicms/pages/src/resources/lang +php artisan translations:add vendor/typicms/pages/src/lang ``` -Every translations found in this directory will be added to ```/resources/lang``` +Every translations found in this directory will be added to `/lang` ### Overwrite translations -By default, translation keys will not be overwritten. You can use the ```--force``` option to overwrite existing keys: +By default, translation keys will not be overwritten. You can use the `--force` option to overwrite existing keys: ### Remove translations ```php -php artisan translations:remove vendor/typicms/pages/src/resources/lang[/lg.json] +php artisan translations:remove vendor/typicms/pages/src/lang[/lg.json] ``` -Every translations found in this file/directory will be removed from ```/resources/lang``` - +Every translations found in this file/directory will be removed from `/lang` ```php -php artisan translations:add vendor/typicms/pages/src/resources/lang --force +php artisan translations:add vendor/typicms/pages/src/lang --force ``` ## Changelog diff --git a/composer.json b/composer.json index 32fdd5b..297f506 100755 --- a/composer.json +++ b/composer.json @@ -16,10 +16,9 @@ } ], "require": { - "php": "^7.0|^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" + "php": "^8.0.2", + "illuminate/console": "^9.0", + "illuminate/filesystem": "^9.0" }, "autoload": { "psr-4": { diff --git a/src/Console/Commands/AddTranslations.php b/src/Console/Commands/AddTranslations.php index 0920b8e..1652479 100644 --- a/src/Console/Commands/AddTranslations.php +++ b/src/Console/Commands/AddTranslations.php @@ -22,7 +22,7 @@ class AddTranslations extends AbstractTranslations public function handle() { foreach ($this->getFiles() as $file) { - $targetDirectory = resource_path('lang'); + $targetDirectory = lang_path(); $targetPath = $targetDirectory.'/'.$file->getBasename(); if ($this->files->missing($targetDirectory)) { $this->files->makeDirectory($targetDirectory); @@ -30,6 +30,7 @@ public function handle() if ($this->files->missing($targetPath)) { $this->files->copy($file->getPathname(), $targetPath); $this->info($targetPath.' created.'); + continue; } diff --git a/src/Console/Commands/RemoveTranslations.php b/src/Console/Commands/RemoveTranslations.php index 84399c0..e441f11 100644 --- a/src/Console/Commands/RemoveTranslations.php +++ b/src/Console/Commands/RemoveTranslations.php @@ -21,7 +21,7 @@ class RemoveTranslations extends AbstractTranslations public function handle() { foreach ($this->getFiles() as $file) { - $mainFile = resource_path('lang/'.basename($file)); + $mainFile = lang_path(basename($file)); $existingTranslations = $this->getTranslations($mainFile); $newTranslations = $this->getTranslations($file);