-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Translation] Remove TranslatorBagInterface to allow for optimized caching in 3.0 #14530
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
Changes from all commits
65962c3
2688b09
3077d80
fa055ec
e4bba37
372c247
98b1a74
89df6f5
24f0830
1364559
c0f6bf0
4df5021
2a72a09
ad53737
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Translation; | ||
|
||
/** | ||
* An implementing class handles multiple locales and possible MessageCatalogues | ||
* to find appropriate translations with some kind of fallback strategy. | ||
* | ||
* Through this interface it is possible to query which locale the translation | ||
* for a given message id and domain will be taken from. | ||
* | ||
* @author Matthias Pigulla <mp@webfactory.de> | ||
*/ | ||
interface FallbackLocaleAwareInterface | ||
{ | ||
/** | ||
* Determines the locale that the translation will ultimately be taken from. | ||
* | ||
* @param string $id The message id (may also be an object that can be cast to string) | ||
* @param string|null $domain The domain for the message or null to use the default | ||
* @param string|null $locale The locale or null to use the default | ||
* | ||
* @return string|null The locale of the best available translation or null for unknown messages. | ||
*/ | ||
public function resolveLocale($id, $domain = null, $locale = null); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,7 +178,10 @@ public function testDifferentCacheFilesAreUsedForDifferentSetsOfFallbackLocales( | |
$this->assertEquals('bar', $translator->trans('bar')); | ||
} | ||
|
||
public function testPrimaryAndFallbackCataloguesContainTheSameMessagesRegardlessOfCaching() | ||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it shoud be removed in $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); |
||
* @group legacy | ||
*/ | ||
public function testLegacyPrimaryAndFallbackCataloguesContainTheSameMessagesRegardlessOfCaching() | ||
{ | ||
/* | ||
* As a safeguard against potential BC breaks, make sure that primary and fallback | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,7 +75,10 @@ public function testSetValidLocale($locale) | |
$this->assertEquals($locale, $translator->getLocale()); | ||
} | ||
|
||
public function testGetCatalogue() | ||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
* @group legacy | ||
*/ | ||
public function testLegacyGetCatalogue() | ||
{ | ||
$translator = new Translator('en'); | ||
|
||
|
@@ -85,7 +88,10 @@ public function testGetCatalogue() | |
$this->assertEquals(new MessageCatalogue('fr'), $translator->getCatalogue('fr')); | ||
} | ||
|
||
public function testGetCatalogueReturnsConsolidatedCatalogue() | ||
/** | ||
* @deprecated | ||
*/ | ||
public function testLegacyGetCatalogueReturnsConsolidatedCatalogue() | ||
{ | ||
/* | ||
* This will be useful once we refactor so that different domains will be loaded lazily (on-demand). | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TranslatorLocaleAwareInterface
?