Skip to content

Commit

Permalink
Revert "fallback to fallback_locale translation when requested transl…
Browse files Browse the repository at this point in the history
…ation line is empty (#34136)" (#34228)

This reverts commit 02e983e.
  • Loading branch information
driesvints authored Sep 9, 2020
1 parent 36db948 commit 7c54eb6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Translation/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function get($key, array $replace = [], $locale = null, $fallback = true)
$locales = $fallback ? $this->localeArray($locale) : [$locale];

foreach ($locales as $locale) {
if (! empty($line = $this->getLine(
if (! is_null($line = $this->getLine(
$namespace, $group, $locale, $item, $replace
))) {
return $line ?? $key;
Expand Down
11 changes: 0 additions & 11 deletions tests/Translation/TranslationTranslatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,6 @@ public function testGetMethodProperlyLoadsAndRetrievesItemForFallback()
$this->assertSame('foo', $t->get('foo::bar.foo'));
}

public function testGetMethodProperlyLoadsAndRetrievesItemForFallbackWhenLineIsEmpty()
{
$t = new Translator($this->getLoader(), 'en');
$t->setFallback('lv');
$t->getLoader()->shouldReceive('load')->once()->with('en', '*', '*')->andReturn([]);
$t->getLoader()->shouldReceive('load')->once()->with('en', 'bar', 'foo')->andReturn(['baz' => '']);
$t->getLoader()->shouldReceive('load')->once()->with('lv', 'bar', 'foo')->andReturn(['foo' => 'foo', 'baz' => 'breeze :foo']);
$this->assertSame('breeze bar', $t->get('foo::bar.baz', ['foo' => 'bar'], 'en'));
$this->assertSame('foo', $t->get('foo::bar.foo'));
}

public function testGetMethodProperlyLoadsAndRetrievesItemForGlobalNamespace()
{
$t = new Translator($this->getLoader(), 'en');
Expand Down

0 comments on commit 7c54eb6

Please sign in to comment.