8000 [Translation][FrameworkBundle] Adding Translation Providers by welcoMattic · Pull Request #37462 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Translation][FrameworkBundle] Adding Translation Providers #37462

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

Closed
Closed
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
Next Next commit
Revert signature change because of possible BC Break
  • Loading branch information
welcoMattic committed Sep 28, 2020
commit 33f192a49d4d3db7497c4ea65b7d5386c81878a0
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function ($path, $catalogue) use ($localMessages) {
->expects($this->any())
->method('read')
->willReturnCallback(
function(array $domains, array $locales) use($remoteMessages) {
function (array $domains, array $locales) use ($remoteMessages) {
$translatorBag = new TranslatorBag();
foreach ($locales as $locale) {
foreach ($domains as $domain) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Translation\Exception\TransportException;
use Symfony\Component\Translation\Loader\LoaderInterface;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Translation\Remote\AbstractRemote;
use Symfony\Component\Translation\TranslatorBag;
use Symfony\Contracts\HttpClient\HttpClientInterface;
Expand Down
6 changes: 5 additions & 1 deletion src/Symfony/Component/Translation/TranslatorBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ public function all(): array
return $messages;
}

public function getCatalogue(string $locale): ?MessageCatalogue
public function getCatalogue(string $locale = null): ?MessageCatalogue
{
if (null === $locale) {
return null;
}

return $this->catalogues[$locale] ?? null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ interface TranslatorBagInterface
*
* @throws InvalidArgumentException If the locale contains invalid characters
*/
public function getCatalogue(string $locale);
public function getCatalogue(string $locale = null);
}
0