Skip to content

Commit a9f0a6d

Browse files
committed
Laravel 9 compatibility
1 parent c19366c commit a9f0a6d

File tree

5 files changed

+18
-15
lines changed

5 files changed

+18
-15
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to `laravel-artisan-translations` will be documented in this file
44

5+
## 2.0.0 - 2022-04-20
6+
7+
- Laravel 9 compatibility
8+
59
## 1.0.0 - 2017-06-01
610

711
- initial release

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,33 @@ Now add the service provider in `config/app.php` file:
2626
### Add translations from a single file
2727

2828
```php
29-
php artisan translations:add vendor/typicms/pages/src/resources/lang/fr.json
29+
php artisan translations:add vendor/typicms/pages/src/lang/fr.json
3030
```
3131

32-
Every translations present in this file will be added to ```/resources/lang/fr.json```.
32+
Every translations present in this file will be added to `/lang/fr.json`.
3333

3434
### Add translations from a directory
3535

3636
```php
37-
php artisan translations:add vendor/typicms/pages/src/resources/lang
37+
php artisan translations:add vendor/typicms/pages/src/lang
3838
```
3939

40-
Every translations found in this directory will be added to ```/resources/lang```
40+
Every translations found in this directory will be added to `/lang`
4141

4242
### Overwrite translations
4343

44-
By default, translation keys will not be overwritten. You can use the ```--force``` option to overwrite existing keys:
44+
By default, translation keys will not be overwritten. You can use the `--force` option to overwrite existing keys:
4545

4646
### Remove translations
4747

4848
```php
49-
php artisan translations:remove vendor/typicms/pages/src/resources/lang[/lg.json]
49+
php artisan translations:remove vendor/typicms/pages/src/lang[/lg.json]
5050
```
5151

52-
Every translations found in this file/directory will be removed from ```/resources/lang```
53-
52+
Every translations found in this file/directory will be removed from `/lang`
5453

5554
```php
56-
php artisan translations:add vendor/typicms/pages/src/resources/lang --force
55+
php artisan translations:add vendor/typicms/pages/src/lang --force
5756
```
5857

5958
## Changelog

composer.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
}
1717
],
1818
"require": {
19-
"php": "^7.0|^8.0"
20-
},
21-
"require-dev": {
22-
"phpunit/phpunit": "^6.0"
19+
"php": "^8.0.2",
20+
"illuminate/console": "^9.0",
21+
"illuminate/filesystem": "^9.0"
2322
},
2423
"autoload": {
2524
"psr-4": {

src/Console/Commands/AddTranslations.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ class AddTranslations extends AbstractTranslations
2222
public function handle()
2323
{
2424
foreach ($this->getFiles() as $file) {
25-
$targetDirectory = resource_path('lang');
25+
$targetDirectory = lang_path();
2626
$targetPath = $targetDirectory.'/'.$file->getBasename();
2727
if ($this->files->missing($targetDirectory)) {
2828
$this->files->makeDirectory($targetDirectory);
2929
}
3030
if ($this->files->missing($targetPath)) {
3131
$this->files->copy($file->getPathname(), $targetPath);
3232
$this->info($targetPath.' created.');
33+
3334
continue;
3435
}
3536

src/Console/Commands/RemoveTranslations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class RemoveTranslations extends AbstractTranslations
2121
public function handle()
2222
{
2323
foreach ($this->getFiles() as $file) {
24-
$mainFile = resource_path('lang/'.basename($file));
24+
$mainFile = lang_path(basename($file));
2525

2626
$existingTranslations = $this->getTranslations($mainFile);
2727
$newTranslations = $this->getTranslations($file);

0 commit comments

Comments
 (0)