diff --git a/config/translation-loader.php b/config/translation-loader.php index c951fc1..98054e4 100644 --- a/config/translation-loader.php +++ b/config/translation-loader.php @@ -35,4 +35,12 @@ 'remote_directory' => [ // 'my-package-name' => 'vendor/my-package-name/lang' ], + + /** + * Translation files you want to exclude + */ + 'exclude_files' => [ + // 'my-filename.php', + // 'my-directory/my-filename.php', + ], ]; diff --git a/src/Console/SyncTranslations.php b/src/Console/SyncTranslations.php index f3eac8f..1ef365b 100644 --- a/src/Console/SyncTranslations.php +++ b/src/Console/SyncTranslations.php @@ -32,6 +32,7 @@ class SyncTranslations extends Command protected $availableRemoteDirectory = []; protected $filesystem; + protected $excludeFiles = []; public function __construct(Filesystem $filesystem) { @@ -39,6 +40,7 @@ public function __construct(Filesystem $filesystem) $this->availableLocales = config('translation-loader.locales'); $this->availableRemoteDirectory = config('translation-loader.remote_directory'); + $this->excludeFiles = config('translation-loader.exclude_files'); $this->filesystem = $filesystem; $this->translationModel = config('translation-loader.model'); } @@ -51,7 +53,8 @@ public function handle() // Get all translations from base project foreach ($this->filesystem->allFiles(lang_path()) as $file) { - if (! in_array($file->getExtension(), $this->availableFileExtensions)) { + if (! in_array($file->getExtension(), $this->availableFileExtensions) + || in_array($file->getFilename(), $this->excludeFiles)) { continue; } $relativePath = $file->getRelativePath();