-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[ResourceBundle] Create Sylius translations type #4318
Conversation
tuka217
commented
Feb 26, 2016
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Fixed tickets | #4146, #4147, #4256 |
License | MIT |
Doc PR | - |
81ca4b4
to
b3d1c1f
Compare
8c4e9f9
to
00fe2f9
Compare
a7e689f
to
8865c7f
Compare
@@ -37,7 +39,7 @@ public function __construct(LocaleContextInterface $localeContext) | |||
*/ | |||
public function getCurrentLocale() | |||
{ | |||
return $this->localeContext->getCurrentLocale(); | |||
return $this->container->get('sylius.context.locale')->getCurrentLocale(); |
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.
Why?
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.
To avoid a problem with circular reference. I now, that it isn't the best solution, but only this work.
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.
After a discussion with @pjedrzejewski we agreed that the best solution for this issue would be to move getAvailableLocales
method to another service AvailableTranslationLocalesProvider
. It will make TranslationLocaleProvider
not dependent on the database so the circular dependency issue would be solved. What do you think about that?
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.
Ok, that should be better solution 👍
4f4f0af
to
e174fa5
Compare
0c5c401
to
a6c1212
Compare
* @var array | ||
*/ | ||
private $availableLocales; | ||
|
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.
Extra blank line.
@@ -27,13 +27,20 @@ class LocaleProvider implements LocaleProviderInterface | |||
private $fallbackLocale; | |||
|
|||
/** | |||
* @var string|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.
string
only
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.
Why? In constructor $defaultLocale can be null by default.
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.
IIRC we used to define only type for properties. Just a thought.
af45644
to
e95253e
Compare
701429e
to
40d7733
Compare
[ResourceBundle] Create ResourceTranslationsSubscriber [WebBundle] Add block for rendering sylius_translations_widget in forms.html.twig [sylius] Change occurences of 'a2lix_translationsForms' to 'sylius_translations' [CoreBundle] Add cofinguration for news locales providers, create AvailableTranslationLocalesProvider [ResourceBundle] Add configuration for translation locales providers [ResourceBundle] Create configuration tests for translation [ResourceBundle] Change api tests, add new configuration test
40d7733
to
19ca019
Compare
{ | ||
use TranslatableTrait { | ||
__construct as private initializeTranslationsCollection; |
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.
Aren't you forgetting to call initializeTranslationsCollection
in the constructor?
0de3470
to
19ca019
Compare
} | ||
|
||
/** | ||
* @return array |
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.
{@inheritdoc}
[ResourceBundle] Create Sylius translations type
Really great work Ania! In separate PR, please apply small comments from @Zales0123 and also uninstall a2lix from composer.json's & Kernel to make sure it is not used anywhere. 👍 |