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
[ApiBundle] Unification of locale in translations #15535
[ApiBundle] Unification of locale in translations #15535
Conversation
Wojdylak
commented
Nov 15, 2023
Q | A |
---|---|
Branch? | 1.13 |
Bug fix? | no |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Related tickets | N?A |
License | MIT |
Bunnyshell Preview Environment deletedAvailable commands:
|
Thanks, Karol! 🎉 |
@@ -167,7 +166,7 @@ public function iWantToModifyTheProductAssociationType(ProductAssociationTypeInt | |||
*/ | |||
public function iRenameItToIn(string $name, string $language): void |
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.
--- public function iRenameItToIn(string $name, string $language): void
+++ public function iRenameItToIn(string $name, string $localeCode): void
@@ -167,7 +166,7 @@ public function iWantToModifyTheProductAssociationType(ProductAssociationTypeInt | |||
*/ | |||
public function iRenameItToIn(string $name, string $language): void | |||
{ | |||
$this->client->updateRequestData(['translations' => [$language => ['name' => $name, 'locale' => $language]]]); | |||
$this->client->updateRequestData(['translations' => [$language => ['name' => $name]]]); |
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->client->updateRequestData(['translations' => [$language => ['name' => $name]]]);
+++ $this->client->updateRequestData(['translations' => [$localeCode => ['name' => $name]]]);
@@ -61,7 +61,7 @@ public function iWantToModifyProductOption(ProductOptionInterface $productOption | |||
*/ | |||
public function iNameItInLanguage(?string $name = null, ?string $language = 'en_US'): void | |||
{ | |||
$data = ['translations' => [$language => ['locale' => $language]]]; | |||
$data = ['translations' => [$language => []]]; |
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.
--- $data = ['translations' => [$language => []]];
+++ $data = ['translations' => [$localeCode => []]];
@@ -74,15 +74,15 @@ public function iNameItInLanguage(?string $name = null, ?string $language = 'en_ | |||
*/ | |||
public function iRenameItInLanguage(string $name, string $language): void | |||
{ | |||
$this->client->updateRequestData(['translations' => [$language => ['name' => $name, 'locale' => $language]]]); | |||
$this->client->updateRequestData(['translations' => [$language => ['name' => $name]]]); |
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->client->updateRequestData(['translations' => [$language => ['name' => $name]]]);
+++ $this->client->updateRequestData(['translations' => [$localeCode => ['name' => $name]]]);
} | ||
|
||
/** | ||
* @When I remove its name from :language translation | ||
*/ | ||
public function iRemoveItsNameFromTranslation(string $language): void | ||
{ | ||
$this->client->updateRequestData(['translations' => [$language => ['name' => '', 'locale' => $language]]]); | ||
$this->client->updateRequestData(['translations' => [$language => ['name' => '']]]); |
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->client->updateRequestData(['translations' => [$language => ['name' => '']]]);
+++ $this->client->updateRequestData(['translations' => [$localeCode => ['name' => '']]]);
|
||
$this | ||
->shouldThrow(TranslationLocaleMismatchException::class) | ||
->during('denormalize', [['translations' => ['de_DE' => ['locale' => 'locale']]], TranslatableInterface::class]) |
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.
As idea for more readability. (I assume test is about two valid locales mismatch)
--- ->during('denormalize', [['translations' => ['de_DE' => ['locale' => 'locale']]], TranslatableInterface::class])
+++ ->during('denormalize', [['translations' => ['de_DE' => ['locale' => 'en_US']]], TranslatableInterface::class])
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.
@Wojdylak cc
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.
It looks better
This PR was merged into the 1.13 branch. Discussion ---------- | Q | A | |-----------------|--------------------------------------------------------------| | Branch? | 1.13 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Related tickets | N/A | License | MIT #15535 Commits ------- [AttributeBundle] Add unique entity constraint to AttributeTranslation [PaymentBundle] Add unique entity constraint to PaymentMethodTranslation [ProductBundle] Add unique entity constraint to ProductAssociationTypeTranslation [ProductBundle] Add unique entity constraint to ProductOptionTranslation and ProductOptionValueTranslation [ProductBundle] Add unique entity constraint to ProductTranslation [ProductBundle] Add unique entity constraint to ProductVariantTranslation [PromotionBundle] Add unique entity constraint to CatalogPromotionTranslation [PromotionBundle] Add unique entity constraint to PromotionTranslation [ShippingBundle] Add unique entity constraint to ShippingMethodTranslation [TaxonBundle] Add unique entity constraint to TaxonTranslation [Behat] Rename language to localeCode for improved clarity [Api][Test] Improve spec test of throwing an exception if locale is not the same as key Change message of unique entity constraint of translations Rename unique constraint error message in translation