Skip to content

Commit 1b3b148

Browse files
committed
Fix for 5.5 (other versions might be depricated, so use the version that works for that)
1 parent 7a494f8 commit 1b3b148

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/Translator.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use GuzzleHttp\Client;
77
use Illuminate\Support\Arr;
88
use Illuminate\Support\Facades\Cache;
9-
use Illuminate\Translation\LoaderInterface;
9+
use Illuminate\Translation\FileLoader;
1010
use Illuminate\Translation\Translator as LaravelTranslator;
1111

1212
class Translator extends LaravelTranslator
@@ -17,12 +17,12 @@ class Translator extends LaravelTranslator
1717
/**
1818
* Create a new translator instance.
1919
*
20-
* @param \Illuminate\Translation\LoaderInterface $loader
21-
* @param string $locale
20+
* @param \Illuminate\Translation\FileLoader $loader
21+
* @param string $locale
2222
*
2323
* @return void
2424
*/
25-
public function __construct(LoaderInterface $loader, $locale)
25+
public function __construct(FileLoader $loader, $locale)
2626
{
2727
$this->loader = $loader;
2828
$this->locale = $locale;
@@ -84,16 +84,13 @@ public function get($data, array $replace = [], $locale = null, $fallback = true
8484
// was not passed, we will use the default locales which was given to us when
8585
// the translator was instantiated. Then, we can load the lines and return.
8686

87-
$locales = $fallback ? $this->parseLocale($locale) : [$locale ?: $this->locale];
87+
$locales = $fallback ? $this->localeArray($locale)
88+
: [$locale ?: $this->locale];
8889

8990
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+
))) {
9794
break;
9895
}
9996
}
@@ -314,6 +311,8 @@ public function getLanguages()
314311
*/
315312
protected function getLine($namespace, $group, $locale, $item, array $replace, $platform = null)
316313
{
314+
$this->load($namespace, $group, $locale);
315+
317316
if ($platform == null) {
318317
$platform = $this->getDefaultPlatform();
319318
}

0 commit comments

Comments
 (0)