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

Fix for setting locale #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rossmc
Copy link

@rossmc rossmc commented Jul 8, 2022

Hello, thank you for the module, it works very nicely. I have a small improvement I'd like to share.

The Issue

The locale is currently set by the value from the HTML tag's lang attribute.

'locale' => (string) $this->pageConfig->getElementAttribute('html', 'lang')

This includes the language, e.g. en, but not the region which makes it invalid for Flowbox.
https://help.getflowbox.com/en/articles/4485750-changing-the-language-region-of-your-flow#our-supported-locales.

The Solution

The changes here fixes this to get the locale from the widget options, or if a locale is not set in the widget options, it will be gotten from the Magento store locale.

New Widget Option:

Magento store locale:

The reason for having an option in the widget, is that some Magento stores do not have their locale configured correctly.

The locale is currently set by the value from the HTML tag's `lang` attribute.
https://github.com/Itonomy/module-flowbox/blob/075ee836544f485e28e8743d3282c976202f4958/Block/Widget/Flow.php#L53

This includes the language, e.g. `en`, but not the region which makes it invalid for Flowbox.
https://help.getflowbox.com/en/articles/4485750-changing-the-language-region-of-your-flow#our-supported-locales.

The changes here fixes this to get the locale from the widget options,
or if a locale is not set in the widget options,
it will be gotten from the Magento store locale.
https://docs.magento.com/user-guide/configuration/general/general.html#locale-options

The reason for having an option in the widget, is that some Magento stores do not have their locale configured correctly.
@rossmc rossmc changed the title Improvements for setting locale Fix for setting locale Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant