diff --git a/src/Scanner.php b/src/Scanner.php index 846056c3..31c794ff 100644 --- a/src/Scanner.php +++ b/src/Scanner.php @@ -36,11 +36,13 @@ public function findTranslations() '(?)'. // Must not start with -> '('.implode('|', $this->translationMethods).')'. // Must start with one of the functions "\(". // Match opening parentheses + "\s*". // Whitespace before param "[\'\"]". // Match " or ' '('. // Start a new group to match: '.+'. // Must start with group ')'. // Close group "[\'\"]". // Closing quote + "\s*". // Whitespace after param "[\),]"; // Close parentheses or new parameter foreach ($this->disk->allFiles($this->scanPaths) as $file) { diff --git a/tests/ScannerTest.php b/tests/ScannerTest.php index 3bf4c080..bceee00e 100644 --- a/tests/ScannerTest.php +++ b/tests/ScannerTest.php @@ -31,7 +31,7 @@ public function it_finds_all_translations() $this->scanner = app()->make(Scanner::class); $matches = $this->scanner->findTranslations(); - $this->assertEquals($matches, ['single' => ['single' => ['This will go in the JSON array' => '', 'trans' => '']], 'group' => ['lang' => ['first_match' => ''], 'lang_get' => ['first' => '', 'second' => ''], 'trans' => ['first_match' => '', 'third_match' => ''], 'trans_choice' => ['with_params' => '']]]); + $this->assertEquals($matches, ['single' => ['single' => ['This will go in the JSON array' => '', 'This will also go in the JSON array' => '', 'trans' => '']], 'group' => ['lang' => ['first_match' => ''], 'lang_get' => ['first' => '', 'second' => ''], 'trans' => ['first_match' => '', 'third_match' => ''], 'trans_choice' => ['with_params' => '']]]); $this->assertCount(2, $matches); } } diff --git a/tests/fixtures/scan-tests/__.txt b/tests/fixtures/scan-tests/__.txt index 4192eef2..8b04d350 100644 --- a/tests/fixtures/scan-tests/__.txt +++ b/tests/fixtures/scan-tests/__.txt @@ -1,2 +1,6 @@ -__('This will go in the JSON array') \ No newline at end of file +__('This will go in the JSON array') + +__( + 'This will also go in the JSON array' +) \ No newline at end of file