-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Translator] move loading catalogue out of Translator. #17563
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
@@ -87,17 +87,17 @@ public function getTransTests() | |||
|
|||
// transchoice | |||
array('{% transchoice count from "messages" %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', | |||
'There is no apples', array('count' => 0)), | |||
'There is no apples', array('count' => 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.
This looks wrong.
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, it is an issue in cs-fixer
a5808e2
to
e63e1e5
Compare
Would love to see this in the translation component! ❤️ @aitboudad Do you still plan on making this ready? |
looks good, any updates on that PR |
@sstok provided a link to this issue, which then triggers this naive question: what is this supposed to solve? |
@nicolas-grekas you mean arrays initialized statically in code are shared, similar to code in the opcache? |
yes, that's what I mean, see https://blog.blackfire.io/php-7-performance-improvements-immutable-arrays.html |
Moving the MessageCatalogue outside of the Translator allows to make it possible to use a Lazy loading MessageCatalogueProvider (eg. ServiceProvider based or Cache decorated) so you don't have to register all the Loaders every time this service is initialized (once per request, but still). Minor correction, this makes it possible to use a different MessageCatalogueProvider that can use a more optimized system (rather then then only static arrays, especially for large Catalogues or Catalogues that change often). |
The main reason is delegating the loading message catalogue (caching, loaders, locale fallback) into separate class which allow us a bunch of things:
I'll try to split this PR in small commits for easy review but before let me know WDYT in overall. |
👍 |
rebase needed then :) |
@aitboudad still wanting to work on this? Could you please rebase before we enter feat. freeze? (end of week) |
gogogoo! finally its happening 🍺 |
Shall we close? Anyone willing to take over? |
Before
After