6
6
use GuzzleHttp \Client ;
7
7
use Illuminate \Support \Arr ;
8
8
use Illuminate \Support \Facades \Cache ;
9
- use Illuminate \Translation \LoaderInterface ;
9
+ use Illuminate \Translation \FileLoader ;
10
10
use Illuminate \Translation \Translator as LaravelTranslator ;
11
11
12
12
class Translator extends LaravelTranslator
@@ -17,12 +17,12 @@ class Translator extends LaravelTranslator
17
17
/**
18
18
* Create a new translator instance.
19
19
*
20
- * @param \Illuminate\Translation\LoaderInterface $loader
21
- * @param string $locale
20
+ * @param \Illuminate\Translation\FileLoader $loader
21
+ * @param string $locale
22
22
*
23
23
* @return void
24
24
*/
25
- public function __construct (LoaderInterface $ loader , $ locale )
25
+ public function __construct (FileLoader $ loader , $ locale )
26
26
{
27
27
$ this ->loader = $ loader ;
28
28
$ this ->locale = $ locale ;
@@ -84,16 +84,13 @@ public function get($data, array $replace = [], $locale = null, $fallback = true
84
84
// was not passed, we will use the default locales which was given to us when
85
85
// the translator was instantiated. Then, we can load the lines and return.
86
86
87
- $ locales = $ fallback ? $ this ->parseLocale ($ locale ) : [$ locale ?: $ this ->locale ];
87
+ $ locales = $ fallback ? $ this ->localeArray ($ locale )
88
+ : [$ locale ?: $ this ->locale ];
88
89
89
90
foreach ($ locales as $ locale ) {
90
- $ this ->load ($ namespace , $ group , $ locale );
91
-
92
- $ line = $ this ->getLine (
93
- $ namespace , $ group , $ locale , $ item , $ replace , $ platform
94
- );
95
-
96
- if (!is_null ($ line )) {
91
+ if (! is_null ($ line = $ this ->getLine (
92
+ $ namespace , $ group , $ locale , $ item , $ replace
93
+ ))) {
97
94
break ;
98
95
}
99
96
}
@@ -314,6 +311,8 @@ public function getLanguages()
314
311
*/
315
312
protected function getLine ($ namespace , $ group , $ locale , $ item , array $ replace , $ platform = null )
316
313
{
314
+ $ this ->load ($ namespace , $ group , $ locale );
315
+
317
316
if ($ platform == null ) {
318
317
$ platform = $ this ->getDefaultPlatform ();
319
318
}
0 commit comments