-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Translator] move loading catalogue out of Translator. #14671
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
7527f65
to
557537f
Compare
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getCatalogue($locale = null) |
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.
$locale
may be null, which probably does not work for the other methods you're calling from here.
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.
hmm I know about it, right now I'm not sure how to deal with it :), any thought ?
in 3.0
I would like to remove the default value:
public function getCatalogue($locale)
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.
fixed, I removed the default value of locale argument in TranslatorBagInterface
protected function computeFallbackLocales($locale) | ||
{ | ||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Rely on FallbackTranslatorBag instead.', E_USER_DEPRECATED); |
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.
Two things –
- Is that the right way to deprecate
protected
functions? I mean, people might override this method without calling the parent class and never get the deprecation notice. (@stof?) - How can people provide their own implementation for this? Currently this is possible. That also applies to other protected methods as well.
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.
- I think so, if someone override public method too he can't get the deprecation notice.
- It depends, for example to override
computeFallbackLocales
method they must use custom FallbackTranslatorBag.
b5c28e5
to
65361ff
Compare
Hello, I just have a quick look on this PR. It seems I also did a custom implementation of the Translator to split the different responsibilities. What bothered me was the fact that the If you're insterested to have a look, here is the implementation I wrote: openl10n-translation/SimpleTranslator.php I introduced a new MessageCatalogueLoader interface and use decoration, which is basically the equivalent of your usage of I'll have a closer look to your PR but I'm 👍 for this improvement. |
* | ||
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com> | ||
*/ | ||
class TranslatorBag implements TranslatorBagInterface, TranslatorBagIdentifiable |
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.
Others TranslatorBag
have a named (Cache, Fallback) except this one.
I would have renamed it to ResourceTranslatorBag
.
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.
sound good to me 👍 , done
a646aa7
to
0a2363e
Compare
21431e3
to
70d0b85
Compare
ping @symfony/deciders |
Also, tests do not pass. |
ping @symfony/deciders |
d6d9ee1
to
07a4775
Compare
I added another PR #16036 which improve the performances and allows using custom provider. |
The failure tests is not related to this PR. |
a874893
to
e53217d
Compare
Honestly, I have spent quite some time reviewing this and I am not sure I have completely understood this change and all its implications. My gut feeling is that this is not ready, but I find it hard to give precise technical reasons for that. I am not in a position to decide on this, but I would really recommend to get in-depth reviews from some more other people. |
@mpdude what part do you think should be improved ? |
Once again, I am currently working through your code :) I'll let you know! |
This is a little mess because there are two code paths (with and without caching) through @fabpot Would entirely deprecating the current Do we absolutely have to provide a flex/extension point for every conceivable tweak users could have made through And, by the way, do we still have time or is 2.8 already feature-frozen? |
e53217d
to
95e23d2
Compare
Honestly I don't see what going wrong with the current implementation. Right now I guess 2.8 already feature-frozen, so I'm going to close. |
Oh, seriously! All this work for nothing? |
@MattKetmo I haven't abandoned, I must have at least one vote from deciders to be able to merge it. |
reopened in #16286 |
Before
After