Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
[Translation] Revert LocoProvider runtime change, document provider-s…
…pecific behavior
  • Loading branch information
ousamabenyounes committed May 12, 2026
commit 6bb2182e726abfa505dc8df29950eda3d449081a
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,9 @@ public function write(TranslatorBagInterface $translatorBag): void

public function read(array $domains, array $locales): TranslatorBag
{
$domains = $domains ?: ['*'];
$translatorBag = new TranslatorBag();

if (!$domains) {
return $translatorBag;
}

foreach ($locales as $locale) {
foreach ($domains as $domain) {
$previousCatalogue = $this->translatorBag?->getCatalogue($locale);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1155,21 +1155,6 @@ public static function getResponsesForReadWithLastModified(): \Generator
}
}

public function testReadReturnsEmptyBagWhenNoDomainsAreProvided()
{
$provider = self::createProvider(
new MockHttpClient(function (): ResponseInterface {
$this->fail('No HTTP request should be made when no domains are provided.');
}, 'https://localise.biz/api/'),
$this->getLoader(),
$this->getLogger(),
$this->getDefaultLocale(),
'localise.biz/api/',
);

$this->assertSame([], $provider->read([], ['en'])->getCatalogues());
}

public function testReadForAllDomains()
{
$this->loader = $this->createMock(LoaderInterface::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ public function write(TranslatorBagInterface $translatorBag): void;
/**
* Returns translations from the provider for the given $domains and $locales.
*
* If $domains is empty, an empty TranslatorBag is returned: callers that want
* every available domain must pass them explicitly.
* Behavior with an empty $domains array is provider-specific (some return all
* available domains, others return an empty bag); pass an explicit domain list
* for portable results.
*/
public function read(array $domains, array $locales): TranslatorBag;

Expand Down
Loading