-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add a way to exclude some translations via the exclude config o…
…ption. Fixes #29
- Loading branch information
Showing
9 changed files
with
107 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
use Nikaia\TranslationSheet\Pusher; | ||
use Nikaia\TranslationSheet\Test\FeatureTestCase; | ||
|
||
class ExcludeFilterTest extends FeatureTestCase | ||
{ | ||
protected function getEnvironmentSetUp($app) | ||
{ | ||
parent::getEnvironmentSetUp($app); | ||
|
||
$this->setBasePathFromFixtureFolder($app, '00-exclude'); | ||
} | ||
|
||
/** @test */ | ||
public function it_exludes_correctly_the_specified_patterns() | ||
{ | ||
/** @var Pusher $pusher */ | ||
$pusher = resolve(Pusher::class); | ||
|
||
config()->set('translation_sheet.exclude', [ | ||
'foo::*', | ||
'validation*' | ||
]); | ||
$this->assertCount(0, $pusher->getScannedAndTransformedTranslations()); | ||
|
||
|
||
config()->set('translation_sheet.exclude', [ | ||
'foo::*', | ||
]); | ||
$this->assertCount(4, $pusher->getScannedAndTransformedTranslations()); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/fixtures/basepaths/00-exclude/resources/lang/en/validation.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
return [ | ||
"accepted" => "The :attribute must be accepted.", | ||
"active_url" => "The :attribute is not a valid URL.", | ||
"between" => [ | ||
"file" => "The :attribute must be between :min and :max kilobytes.", | ||
"numeric" => "The :attribute must be between :min and :max." | ||
] | ||
]; |
10 changes: 10 additions & 0 deletions
10
tests/fixtures/basepaths/00-exclude/resources/lang/fr/validation.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
return [ | ||
"accepted" => "The :attribute must be accepted.", | ||
"active_url" => "The :attribute is not a valid URL.", | ||
"between" => [ | ||
"file" => "The :attribute must be between :min and :max kilobytes.", | ||
"numeric" => "The :attribute must be between :min and :max." | ||
] | ||
]; |
2 changes: 1 addition & 1 deletion
2
...resources/lang/vendor/foo/en/messages.php → ...resources/lang/vendor/foo/en/messages.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
|
||
return [ | ||
"next" => "Next", | ||
"next" => "Next (edited)", | ||
"previous" => "Previous" | ||
]; |
6 changes: 6 additions & 0 deletions
6
tests/fixtures/basepaths/00-exclude/resources/lang/vendor/foo/fr/messages.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
|
||
return [ | ||
"next" => "Suivant »", | ||
"previous" => "« Précédent" | ||
]; |