Skip to content
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 @@ -19,4 +19,9 @@ public function trans($id, array $parameters = [], $domain = null, $locale = nul
{
return '[trans]'.strtr($id, $parameters).'[/trans]';
}

public function getLocale(): string
{
return 'en';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,9 @@ class TranslatorWithTranslatorBag implements TranslatorInterface
public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null): string
{
}

public function getLocale(): string
{
return 'en';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ public function trans(string $id, array $parameters = [], string $domain = null,
return $trans;
}

public function getLocale(): string
{
return $this->translator->getLocale();
}

private function getParts(string $originalTrans): array
{
if (!$this->parseHTML) {
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CHANGELOG
---

* Add `HttpClientInterface::withOptions()`
* Add `TranslatorInterface::getLocale()`

2.3.0
-----
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Contracts/Translation/TranslatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

/**
* @author Fabien Potencier <fabien@symfony.com>
*
* @method string getLocale() Returns the default locale
*/
interface TranslatorInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Contracts/Translation/TranslatorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public function setLocale(string $locale)

/**
* {@inheritdoc}
*
* @return string
*/
public function getLocale()
{
Expand Down