Skip to content

Commit e5bfc49

Browse files
authored
Separate locales config foreach command (#11)
1 parent 8b832f4 commit e5bfc49

File tree

4 files changed

+31
-20
lines changed

4 files changed

+31
-20
lines changed

config/translation-linter.php

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,6 @@
5757
'Lang::has',
5858
],
5959

60-
/*
61-
|--------------------------------------------------------------------------
62-
| Language Locales
63-
|--------------------------------------------------------------------------
64-
|
65-
| The following array contains the "locales" to use when finding all of
66-
| your registered language files.
67-
|
68-
*/
69-
'locales' => [env('LOCALE_DEFAULT', 'en')],
70-
7160
/*
7261
|--------------------------------------------------------------------------
7362
| Language File Readers
@@ -130,6 +119,17 @@
130119
|
131120
*/
132121
'filters' => [],
122+
123+
/*
124+
|--------------------------------------------------------------------------
125+
| Language Locales
126+
|--------------------------------------------------------------------------
127+
|
128+
| The following array contains the "locales" to use when finding all of
129+
| your registered language files.
130+
|
131+
*/
132+
'locales' => [env('LOCALE_DEFAULT', 'en')],
133133
],
134134

135135
'unused' => [
@@ -181,5 +181,16 @@
181181
\Fidum\LaravelTranslationLinter\Filters\IgnoreNamespacedKeysFilter::class,
182182
\Fidum\LaravelTranslationLinter\Filters\IgnoreVendorKeysFilter::class,
183183
],
184+
185+
/*
186+
|--------------------------------------------------------------------------
187+
| Language Locales
188+
|--------------------------------------------------------------------------
189+
|
190+
| The following array contains the "locales" to use when finding all of
191+
| your registered language files.
192+
|
193+
*/
194+
'locales' => [env('LOCALE_DEFAULT', 'en')],
184195
],
185196
];

src/LaravelTranslationLinterServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function registeringPackage()
126126

127127
$this->app->when(MissingTranslationLinter::class)
128128
->needs('$locales')
129-
->giveConfig('translation-linter.lang.locales');
129+
->giveConfig('translation-linter.missing.locales');
130130

131131
$this->app->bind(ResultObjectCollectionContract::class, ResultObjectCollection::class);
132132

@@ -154,7 +154,7 @@ public function registeringPackage()
154154

155155
$this->app->when(UnusedTranslationLinter::class)
156156
->needs('$locales')
157-
->giveConfig('translation-linter.lang.locales');
157+
->giveConfig('translation-linter.unused.locales');
158158
}
159159

160160
public function provides()

tests/Commands/MissingCommandTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
});
5454

5555
it('errors with multiple locales', function () {
56-
config()->set('translation-linter.lang.locales', ['en', 'de']);
56+
config()->set('translation-linter.missing.locales', ['en', 'de']);
5757
$firstFile = workbench_path('app/ExampleJson.php');
5858

5959
withoutMockingConsoleOutput();
@@ -64,7 +64,7 @@
6464
});
6565

6666
it('generates baseline file then successfully ignores baseline keys', function () {
67-
config()->set('translation-linter.lang.locales', ['en', 'de']);
67+
config()->set('translation-linter.missing.locales', ['en', 'de']);
6868

6969
withoutMockingConsoleOutput();
7070
expect(artisan('translation:missing --generate-baseline'))
@@ -84,7 +84,7 @@
8484
});
8585

8686
it('outputs success message when no missing translations found', function () {
87-
config()->set('translation-linter.lang.locales', []);
87+
config()->set('translation-linter.missing.locales', []);
8888
withoutMockingConsoleOutput();
8989
expect(artisan('translation:missing'))
9090
->toBe(0)

tests/Commands/UnusedCommandTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
});
5252

5353
it('errors with multiple locales', function () {
54-
config()->set('translation-linter.lang.locales', ['en', 'de']);
54+
config()->set('translation-linter.unused.locales', ['en', 'de']);
5555
withoutMockingConsoleOutput();
5656
expect(artisan('translation:unused'))
5757
->toBe(1)
@@ -60,7 +60,7 @@
6060
});
6161

6262
it('errors with multiple locales and no filters', function () {
63-
config()->set('translation-linter.lang.locales', ['en', 'de']);
63+
config()->set('translation-linter.unused.locales', ['en', 'de']);
6464
config()->set('translation-linter.unused.filters', []);
6565

6666
withoutMockingConsoleOutput();
@@ -71,7 +71,7 @@
7171
});
7272

7373
it('generates baseline file then successfully ignores baseline keys', function () {
74-
config()->set('translation-linter.lang.locales', ['en', 'de']);
74+
config()->set('translation-linter.unused.locales', ['en', 'de']);
7575
config()->set('translation-linter.unused.filters', [IgnoreKeysFromUnusedBaselineFileFilter::class]);
7676

7777
withoutMockingConsoleOutput();
@@ -92,7 +92,7 @@
9292
});
9393

9494
it('outputs success message when no unused translations found', function () {
95-
config()->set('translation-linter.lang.locales', []);
95+
config()->set('translation-linter.unused.locales', []);
9696
withoutMockingConsoleOutput();
9797
expect(artisan('translation:unused'))
9898
->toBe(0)

0 commit comments

Comments
 (0)