Skip to content

Commit ba62668

Browse files
authored
fixing some bugs related to laravel 5.3 (#132)
2 parents 369de46 + 0d253bf commit ba62668

File tree

3 files changed

+14
-19
lines changed

3 files changed

+14
-19
lines changed

src/Controller.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ protected function loadLocales()
6161
{
6262
//Set the default locale as the first one.
6363
$locales = Translation::groupBy('locale')->pluck('locale');
64+
6465
if ($locales instanceof Collection) {
6566
$locales = $locales->all();
6667
}

src/Manager.php

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,18 @@ public function findTranslations($path = null)
9696
{
9797
$path = $path ?: base_path();
9898
$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
116111

117112
// Find all PHP + Twig files in the app folder, except for storage
118113
$finder = new Finder();
@@ -123,7 +118,7 @@ public function findTranslations($path = null)
123118
// Search the current file for the pattern
124119
if(preg_match_all("/$pattern/siU", $file->getContents(), $matches)) {
125120
// Get all matches
126-
foreach ($matches[1] as $key) {
121+
foreach ($matches[2] as $key) {
127122
$keys[] = $key;
128123
}
129124
}

src/ManagerServiceProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
use Illuminate\Support\ServiceProvider;
55

66
class ManagerServiceProvider extends ServiceProvider {
7-
87
/**
98
* Indicates if loading of the provider is deferred.
109
*

0 commit comments

Comments
 (0)