[ProductAttribute] Make select attribute translatable#8766
Conversation
285acf9 to
a471fa4
Compare
d8b316c to
1e915bf
Compare
There was a problem hiding this comment.
after locale change -> in different locale?
There was a problem hiding this comment.
Hmm, is there any way we can get rid of those parent calls?
There was a problem hiding this comment.
I've been trying to come up with better solution, but without success. If you have any suggestion, please share with me 😃
There was a problem hiding this comment.
Strict types can be added here (and to this class entirely)
There was a problem hiding this comment.
What happens if values[attribute.value][fallbackLocale] is not defined?
bd8f5be to
dc8dbe5
Compare
There was a problem hiding this comment.
array_search returns either a key (int / string) or false when the value was not found, so this expression can be reduced to $localeCode === $key only.
There was a problem hiding this comment.
Why is it so? Empty treats 0 value as empty.
There was a problem hiding this comment.
$newKey cannot be null here as getUniqueKey returns string.
There was a problem hiding this comment.
Missing typehints here (+ other method definitions).
dc8dbe5 to
889f071
Compare
There was a problem hiding this comment.
SelectAttributeChoicesCollectionType uses LocaleProviderInterface::getDefaultLocaleCode() to get its default locale, this one has base locale injected as $defaultLocale, is that intentional?
There was a problem hiding this comment.
Anyway, if it's intentional, I guess $baseLocale would be more appropriate name then.
…a select product attribute
…ect attributes in different locales
…elect product attribute
889f071 to
bacae1d
Compare
There was a problem hiding this comment.
I guess there's still something wrong with those definitions, %locale% points to a base locale code, whereas sylius.translation_locale_provider service has getDefaultLocaleCode method which returns current channel's default locale. Is there any reason for using these two simultaneously instead of only one of them?
There was a problem hiding this comment.
I didn't notice that 👍
I've changed to use sylius.translation_locale_provider instead of %locale%.
bacae1d to
79c0178
Compare
Based on the PR #8206 created by @Lowlo and partially based on the PR #8751