Skip to content

Commit

Permalink
Merge pull request #1075 from spiral/bugfix/translations
Browse files Browse the repository at this point in the history
  • Loading branch information
spiralbot committed Feb 13, 2024
1 parent c87ea20 commit 272e608
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Config/TranslatorConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function getLocaleDirectory(string $locale, ?string $directory = null): s
return \rtrim($directory, '/') . '/' . $locale . '/';
}

return \trim($this->getLocalesDirectory(), '/') . '/' . $locale . '/';
return \rtrim($this->getLocalesDirectory(), '/') . '/' . $locale . '/';
}

/**
Expand Down
9 changes: 9 additions & 0 deletions tests/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ public function testLocaleDirectoryWithDirectoryParam(): void
$this->assertSame('directory/en/', $config->getLocaleDirectory('en', 'directory/'));
}

public function testLocaleDirectoryLeadingSlash(): void
{
$config = new TranslatorConfig([
'directory' => '/directory/locale'
]);

$this->assertSame('/directory/locale/en/', $config->getLocaleDirectory('en'));
}

public function testDomains(): void
{
$config = new TranslatorConfig([
Expand Down

0 comments on commit 272e608

Please sign in to comment.