-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle][Translation] moved cache to Translation component (new PR) #11373
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
Conversation
@OwlyCode Squash your commits please |
Given the security issue: http://symfony.com/blog/security-releases-cve-2014-4931-symfony-2-3-18-2-4-8-and-2-5-2-released, you have to rebase this PR and re-apply modifications on Translator: 06a80fb#diff-abaa70edd88fdf9fbf5f2ab72ab89891R100 |
I rebased the commits on master so they benefit from the security release and are ready to be merged. All tests on Translator are green on my machine. @jeremy-derusse is it ok for you ? |
@OwlyCode sounds good. And fix the Coding Standard: http://fabbot.io/report/symfony/symfony/11373/4022cb2c12d8ef7a24773e09430e200459a9bdb2 |
* Constructor. | ||
* | ||
* @param string $locale The locale | ||
* @param MessageSelector|null $selector The message selector for pluralization | ||
* @param string $cacheDir The directory to use for the cache |
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.
string|null
If there is a cache within a component it should be a generic CacheInterface injected and one implementation by using the filesystem. As it has been refactored in twig. |
The cache only makes sense if this a PHP file that PHP itself is able to "optimize". There is indeed a PR on Twig, but I'm still not in favor of it. I can understand some usages, but people should not use it blindly. So, we can indeed provide a cache interface, but we need to make it clear that we will only ever support the PHP implementation and document the limitation of the other possible implementations. |
{ | ||
$translator = $this->getTranslator($this->getLoader()); | ||
$translator->setLocale('fr'); | ||
$translator->setFallbackLocales(array('en', 'es', 'pt-PT', 'pt_BR')); |
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.
Can you add tests for locales with .
and @
from FrameworkBundle? https://github.com/symfony/symfony/pull/11403/files#diff-990df0e8238847f8ae54e8227f295c22R48
Can you rebase this PR on current master. Be careful as we made several security issue fixes. |
[Translation][Cache] removed accessors for options.
I rebased master, the security fixes didn't conflict but the |
@jeremy-derusse Can you review this one? |
@@ -1,6 +1,10 @@ | |||
CHANGELOG | |||
========= | |||
|
|||
2.6.0 | |||
----- |
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.
missing blank line below
Can you add (or move) new tests added on https://github.com/symfony/symfony/pull/11830/files ? |
I fixed the issues reported by @fabpot and @jeremy-derusse on this PR. |
…ator Fixed phpdoc Aligned variables and description Removed enableCache and added cache setup in constructor Added tests for locales with . and @ with caching
Is it mergeable now? |
👍 |
@OwlyCode Can you fix the CS issue reported by fabbot? |
I'm not sure on the way to solve this as the |
Indeed. It looks like a false positive of the PHP-CS-Fixer here. I suspect fabbot is running the stable release for now, while the dev version should be fixed for this case |
👍 |
Thank you @OwlyCode. |
…ion component (new PR) (aitboudad, OwlyCode) This PR was merged into the 2.6-dev branch. Discussion ---------- [FrameworkBundle][Translation] moved cache to Translation component (new PR) | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #10628 | License | MIT | Doc PR | This supersedes the PR #11197 (while including the changes made by it). I removed the `$options` argument for `Symfony\Component\Translation\Translator` and replaced it by a public method `enableCache($cacheDir, $debug = false)`. It aims to solve what @fabpot said about passing an array of options in #11197 <s>while not modifying the existing constructors</s>. Commits ------- 30fed6a [Translation][Cache] Removed the options from the arguments of Translator 8b2d9a8 [FrameworkBundle][Translation] moved cache to Translation component
This supersedes the PR #11197 (while including the changes made by it). I removed the
$options
argument forSymfony\Component\Translation\Translator
and replaced it by a public methodenableCache($cacheDir, $debug = false)
. It aims to solve what @fabpot said about passing an array of options in #11197while not modifying the existing constructors.