Skip to content

Commit

Permalink
Add support for newlines (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Constantin Druc authored Jun 14, 2022
1 parent 7e37aaa commit f61d624
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/RequiredTranslations.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ private function pattern(): string
"(?<!->)" . // Must not start with ->
'(' . implode('|', $this->translationMethods) . ')' .// Must start with one of the functions
"\(" .// Match opening parentheses
"[\s\S]?" .// Ignore new lines
"[\'\"]" .// Match " or '
"(" .// Start a new group to match:
".*" .// Must start with group
")" .// Close group
"[\'\"]" .// Closing quote
"[\s\S]?" .// Ignore new lines
"[\),]" . // Close parentheses or new parameter
"/siuU";
}
Expand Down
1 change: 1 addition & 0 deletions tests/RequiredTranslationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function it_finds_all_required_translations(): void
);

$this->assertEquals([
'Well this is ackward' => '__.txt',
'This will go in the JSON array' => '__.txt',
'lang.first_match' => 'alt_lang.txt',
'lang_get.first' => 'lang_get.txt',
Expand Down
4 changes: 4 additions & 0 deletions tests/fixtures/test-files/__.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@

__('This will go in the JSON array')

__(
'Well this is ackward'
)

0 comments on commit f61d624

Please sign in to comment.