Skip to content

Commit

Permalink
Merge pull request #8 from vlados/main
Browse files Browse the repository at this point in the history
Support for excluding paths
  • Loading branch information
3x1io authored Jun 6, 2022
2 parents 0fc7255 + 0700db5 commit f4d44e5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions config/filament-translations.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@
resource_path('views'),
base_path('vendor')
],

/*
|--------------------------------------------------------------------------
| Excluded paths
|--------------------------------------------------------------------------
|
| Put here any folder that you want to exclude that is inside of paths
|
*/

"excludedPaths" => [
],


/*
|--------------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions src/Services/Scan.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,17 @@ public function getAllViewFilesWithTranslations(): array

$trans = collect();
$__ = collect();
$excludedPaths = config('filament-translations.excludedPaths');

// FIXME maybe we can count how many times one translation is used and eventually display it to the user

/** @var SplFileInfo $file */
foreach ($this->disk->allFiles($this->scannedPaths->toArray()) as $file) {
$dir = dirname($file);
if(\Str::startsWith($dir,$excludedPaths)) {
continue;
}

if (preg_match_all("/$patternA/siU", $file->getContents(), $matches)) {
$trans->push($matches[2]);
}
Expand Down

0 comments on commit f4d44e5

Please sign in to comment.