Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug related to aliasing default domain translations. #4167

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public function load($locale, $filename)
*/
public function getLanguageFilename($locale, $domain)
{
return empty($domain)
return (empty($domain) || $domain === 'default')
? $locale . '.ini'
: $domain . '/' . $locale . '.ini';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ public function testMissingPathStack(): void
}

/**
* Test alias behavior.
* Test alias behavior in default domain.
*
* @return void
*/
public function testAliasing(): void
public function testAliasingInDefaultDomain(): void
{
$pathStack = [
realpath($this->getFixtureDir() . 'language/aliases'),
Expand All @@ -195,6 +195,27 @@ public function testAliasing(): void
);
}

/**
* Test alias behavior in non-default domain.
*
* @return void
*/
public function testAliasingInNonDefaultDomain(): void
{
$pathStack = [
realpath($this->getFixtureDir() . 'language/aliases'),
];
$loader = new ExtendedIni($pathStack, 'en');
$result = $loader->load('en', 'Domain');
$this->assertEquals(
[
'bar' => 'Domain Translation',
'foofoo' => 'Translation',
],
(array)$result
);
}

/**
* Test circular alias infinite loop prevention.
*
Expand Down
Loading