@@ -165,4 +165,50 @@ public function testLocalizeCommandWhereKeysAreEscapedWithSlashes(): void
165165 // Cleanup.
166166 self ::flushDirectories ('lang ' , 'views ' );
167167 }
168+
169+ public function testLocalizeCommandWithMultilineMessages (): void
170+ {
171+ $ this ->createTestView ("__( \n'stand with ukraine' \n) " );
172+
173+ // Run localize command.
174+ $ this ->artisan ('localize ' )
175+ ->assertExitCode (0 );
176+
177+ // Do created locale files exist?
178+ self ::assertJsonLangFilesExist ('en ' );
179+
180+ // Do their contents match the expected results?
181+ $ enJsonContents = $ this ->getJsonLangContents ('en ' );
182+
183+ // Did it sort the translation keys like we expected?
184+ self ::assertSame ([
185+ 'stand with ukraine ' => 'stand with ukraine ' ,
186+ ], $ enJsonContents );
187+
188+ // Cleanup.
189+ self ::flushDirectories ('lang ' , 'views ' );
190+ }
191+
192+ public function testLocalizeCommandWithMultilineMessagesAndSpaces (): void
193+ {
194+ $ this ->createTestView ("{{ __( \n 'stand with ukraine' \n) }} " );
195+
196+ // Run localize command.
197+ $ this ->artisan ('localize ' )
198+ ->assertExitCode (0 );
199+
200+ // Do created locale files exist?
201+ self ::assertJsonLangFilesExist ('en ' );
202+
203+ // Do their contents match the expected results?
204+ $ enJsonContents = $ this ->getJsonLangContents ('en ' );
205+
206+ // Did it sort the translation keys like we expected?
207+ self ::assertSame ([
208+ 'stand with ukraine ' => 'stand with ukraine ' ,
209+ ], $ enJsonContents );
210+
211+ // Cleanup.
212+ self ::flushDirectories ('lang ' , 'views ' );
213+ }
168214}
0 commit comments