Skip to content

Commit b3329fa

Browse files
authored
Fix regression with capitalizing translation params (#39424)
1 parent 9bd19df commit b3329fa

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Illuminate/Translation/Translator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ protected function makeReplacements($line, array $replace)
218218
$shouldReplace = [];
219219

220220
foreach ($replace as $key => $value) {
221-
$shouldReplace[':'.$key] = $value;
222-
$shouldReplace[':'.Str::upper($key)] = Str::upper($value);
223221
$shouldReplace[':'.Str::ucfirst($key)] = Str::ucfirst($value);
222+
$shouldReplace[':'.Str::upper($key)] = Str::upper($value);
223+
$shouldReplace[':'.$key] = $value;
224224
}
225225

226226
return strtr($line, $shouldReplace);

tests/Translation/TranslationTranslatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ public function testGetMethodProperlyLoadsAndRetrievesItemWithCapitalization()
7878
{
7979
$t = $this->getMockBuilder(Translator::class)->onlyMethods([])->setConstructorArgs([$this->getLoader(), 'en'])->getMock();
8080
$t->getLoader()->shouldReceive('load')->once()->with('en', '*', '*')->andReturn([]);
81-
$t->getLoader()->shouldReceive('load')->once()->with('en', 'bar', 'foo')->andReturn(['foo' => 'foo', 'baz' => 'breeze :Foo :BAR']);
82-
$this->assertSame('breeze Bar FOO', $t->get('foo::bar.baz', ['foo' => 'bar', 'bar' => 'foo'], 'en'));
81+
$t->getLoader()->shouldReceive('load')->once()->with('en', 'bar', 'foo')->andReturn(['foo' => 'foo', 'baz' => 'breeze :0 :Foo :BAR']);
82+
$this->assertSame('breeze john Bar FOO', $t->get('foo::bar.baz', ['john', 'foo' => 'bar', 'bar' => 'foo'], 'en'));
8383
$this->assertSame('foo', $t->get('foo::bar.foo'));
8484
}
8585

0 commit comments

Comments
 (0)