File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 99
1010class NovaLangPublish extends Command
1111{
12+ /**
13+ * Possible locale separators.
14+ * @var string
15+ */
16+ const SEPARATORS = '-‑_ ' ;
17+
1218 /**
1319 * The name and signature of the console command.
1420 *
@@ -117,7 +123,8 @@ protected function getRequestedLocales(): Collection
117123 $ locales = $ this ->getAvailableLocales ();
118124 }
119125 else {
120- $ locales = collect (explode (', ' , $ this ->argument ('locales ' )))->filter ();
126+ $ locales = $ this ->fixSeparators ($ this ->argument ('locales ' ));
127+ $ locales = collect (explode (', ' , $ locales ))->filter ();
121128 }
122129
123130 $ aliases = $ this ->getLocaleAliases ($ locales ->count () == 1 ? $ locales ->first () : false );
@@ -194,13 +201,21 @@ protected function getLocaleAliases($single = false): Collection
194201 $ this ->warn (sprintf ('Alias for [%s] locale was declared more than once and will be overwritten by the last value. ' , $ locale ));
195202 }
196203
204+
205+ $ locale = $ this ->fixSeparators ($ locale );
206+
197207 $ aliases ->put ($ locale , $ alias );
198208 }
199209 }
200210
201211 return $ aliases ;
202212 }
203213
214+ protected function fixSeparators (string $ locale )
215+ {
216+ return preg_replace ('/[ ' .static ::SEPARATORS .']+/ ' , '- ' , $ locale );
217+ }
218+
204219 protected function isForce (): bool
205220 {
206221 return $ this ->option ('force ' );
You can’t perform that action at this time.
0 commit comments