Skip to content

Commit 1aa7ab2

Browse files
[Contracts] extract LocaleAwareInterface out of TranslatorInterface
1 parent 3edf0ab commit 1aa7ab2

File tree

3 files changed

+32
-17
lines changed

3 files changed

+32
-17
lines changed

Translation/LocaleAwareInterface.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Contracts\Translation;
13+
14+
interface LocaleAwareInterface
15+
{
16+
/**
17+
* Sets the current locale.
18+
*
19+
* @param string $locale The locale
20+
*
21+
* @throws \InvalidArgumentException If the locale contains invalid characters
22+
*/
23+
public function setLocale($locale);
24+
25+
/**
26+
* Returns the current locale.
27+
*
28+
* @return string The locale
29+
*/
30+
public function getLocale();
31+
}

Translation/TranslatorInterface.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,4 @@ interface TranslatorInterface
6262
* @throws \InvalidArgumentException If the locale contains invalid characters
6363
*/
6464
public function trans($id, array $parameters = array(), $domain = null, $locale = null);
65-
66-
/**
67-
* Sets the current locale.
68-
*
69-
* @param string $locale The locale
70-
*
71-
* @throws \InvalidArgumentException If the locale contains invalid characters
72-
*/
73-
public function setLocale($locale);
74-
75-
/**
76-
* Returns the current locale.
77-
*
78-
* @return string The locale
79-
*/
80-
public function getLocale();
8165
}

Translation/TranslatorTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Symfony\Component\Translation\Exception\InvalidArgumentException;
1515

1616
/**
17-
* A trait to help implement TranslatorInterface.
17+
* A trait to help implement TranslatorInterface and LocaleAwareInterface.
1818
*
1919
* @author Fabien Potencier <fabien@symfony.com>
2020
*/

0 commit comments

Comments
 (0)