Skip to content

Commit 7c54eb6

Browse files
authoredSep 9, 2020
Revert "fallback to fallback_locale translation when requested translation line is empty (#34136)" (#34228)
This reverts commit 02e983e.
1 parent 36db948 commit 7c54eb6

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed
 

‎src/Illuminate/Translation/Translator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function get($key, array $replace = [], $locale = null, $fallback = true)
122122
$locales = $fallback ? $this->localeArray($locale) : [$locale];
123123

124124
foreach ($locales as $locale) {
125-
if (! empty($line = $this->getLine(
125+
if (! is_null($line = $this->getLine(
126126
$namespace, $group, $locale, $item, $replace
127127
))) {
128128
return $line ?? $key;

‎tests/Translation/TranslationTranslatorTest.php

-11
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,6 @@ public function testGetMethodProperlyLoadsAndRetrievesItemForFallback()
104104
$this->assertSame('foo', $t->get('foo::bar.foo'));
105105
}
106106

107-
public function testGetMethodProperlyLoadsAndRetrievesItemForFallbackWhenLineIsEmpty()
108-
{
109-
$t = new Translator($this->getLoader(), 'en');
110-
$t->setFallback('lv');
111-
$t->getLoader()->shouldReceive('load')->once()->with('en', '*', '*')->andReturn([]);
112-
$t->getLoader()->shouldReceive('load')->once()->with('en', 'bar', 'foo')->andReturn(['baz' => '']);
113-
$t->getLoader()->shouldReceive('load')->once()->with('lv', 'bar', 'foo')->andReturn(['foo' => 'foo', 'baz' => 'breeze :foo']);
114-
$this->assertSame('breeze bar', $t->get('foo::bar.baz', ['foo' => 'bar'], 'en'));
115-
$this->assertSame('foo', $t->get('foo::bar.foo'));
116-
}
117-
118107
public function testGetMethodProperlyLoadsAndRetrievesItemForGlobalNamespace()
119108
{
120109
$t = new Translator($this->getLoader(), 'en');

0 commit comments

Comments
 (0)