Skip to content
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

[#19908] locale in rest calls is always default locale #19913

Merged

Conversation

jwundrak
Copy link

Description (*)

If there are multiple store views with different locales, always default store locale is present. For reproducing see #19908 .

Fixed Issues (if relevant)

#19908

Manual testing scenarios (*)

  1. Configure stores. I use Store-View "default" with locale en_US and StoreView "second" with locale de_DE
  2. Use something, that returns magento phrase (I wrote a test module here: https://github.com/jwundrak/magento2-api-locale )
  3. Call rest API (with the module /rest/second/V1/localeTest)

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

Sorry, something went wrong.

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Dec 20, 2018

CLA assistant check
All committers have signed the CLA.

@magento-engcom-team
Copy link
Contributor

Hi @jwundrak. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@magento-engcom-team magento-engcom-team added Component: Webapi Use with concrete module component label E.g. "Component: Webapi" + "Catalog" Release Line: 2.3 labels Dec 20, 2018
{
public function __construct(
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Framework\Locale\ResolverInterface $localeResolver
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, inject new dependencies according to our Backward Compatible Development Guide

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sidolov Sorry, done

'Default store code' => ['', 'default', 0],
'Arbitrary store code' => [$this->arbitraryStoreCode, $this->arbitraryStoreCode],
'Explicit default store code' => ['default', 'default']
'All store code' => ['all', Store::ADMIN_CODE],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, revert indentation

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sidolov Sorry, done

$storeCodeInPath = !$storeCodeInPath ?: '/' . $storeCodeInPath; // add leading slash if store code not empty
$inPath = 'rest' . $storeCodeInPath . $this->endpointPath;
$storeCodeInPath = !$storeCodeInPath ? : '/' . $storeCodeInPath; // add leading slash if store code not empty
$inPath = 'rest' . $storeCodeInPath . $this->endpointPath;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, revert indentation

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sidolov Sorry, done

/**
* @var \Magento\Framework\Locale\ResolverInterface::class
*/
protected $localeResolver;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, make this property private

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sidolov Sorry, done

@ghost ghost assigned orlangur Apr 4, 2019
@magento-engcom-team
Copy link
Contributor

Hi @orlangur, thank you for the review.
ENGCOM-4674 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

@jwundrak thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@m2-assistant
Copy link

m2-assistant bot commented Apr 29, 2019

Hi @jwundrak, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.2 milestone Apr 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Award: bug fix Component: Webapi Use with concrete module component label E.g. "Component: Webapi" + "Catalog" Component: WebapiAsync Progress: accept Release Line: 2.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants