@@ -96,23 +96,18 @@ public function findTranslations($path = null)
96
96
{
97
97
$ path = $ path ?: base_path ();
98
98
$ keys = array ();
99
- $ functions = array ('trans ' , 'trans_choice ' , 'Lang::get ' , 'Lang::choice ' , 'Lang::trans ' , 'Lang::transChoice ' );
100
- $ functionsInline = array ('@lang ' , '@choice ' );
101
- $ pattern = // http://regexr.com/3e38g
102
- "(?: " . // Start a new group to match:
103
- "(?: " .implode ('| ' , $ functionsInline ) .") " . // Must start with one of the functions
104
- "| " . // Or
105
- "[^\w|>] " . // Must not have an alphanum or _ or > before real method
106
- "(?: " .implode ('| ' , $ functions ) .") " . // Must start with one of the functions
107
- ") " . // Close group
108
- "\( " . // Match opening parenthese
109
- "[\' \"] " . // Match " or '
110
- "( " . // Start a new group to match:
111
- "[a-zA-Z0-9_-]+ " . // Must start with group
112
- "(?:[.][^ \1)]+)+ " . // Be followed by one or more items/keys
113
- ") " . // Close group
114
- "[\' \"] " . // Closing quote
115
- "[\),] " ; // Close parentheses or new parameter
99
+ $ functions = array ('trans ' , 'trans_choice ' , 'Lang::get ' , 'Lang::choice ' , 'Lang::trans ' , 'Lang::transChoice ' , '@lang ' , '@choice ' );
100
+ $ pattern = // See http://regexr.com/392hu
101
+ "[^\w|>] " . // Must not have an alphanum or _ or > before real method
102
+ "( " .implode ('| ' , $ functions ) .") " . // Must start with one of the functions
103
+ "\( " . // Match opening parenthese
104
+ "[\' \"] " . // Match " or '
105
+ "( " . // Start a new group to match:
106
+ "[a-zA-Z0-9_-]+ " . // Must start with group
107
+ "([.][^ \1)]+)+ " . // Be followed by one or more items/keys
108
+ ") " . // Close group
109
+ "[\' \"] " . // Closing quote
110
+ "[\),] " ; // Close parentheses or new parameter
116
111
117
112
// Find all PHP + Twig files in the app folder, except for storage
118
113
$ finder = new Finder ();
@@ -123,7 +118,7 @@ public function findTranslations($path = null)
123
118
// Search the current file for the pattern
124
119
if (preg_match_all ("/ $ pattern/siU " , $ file ->getContents (), $ matches )) {
125
120
// Get all matches
126
- foreach ($ matches [1 ] as $ key ) {
121
+ foreach ($ matches [2 ] as $ key ) {
127
122
$ keys [] = $ key ;
128
123
}
129
124
}
0 commit comments