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

Ability to switch between different Locales and Currencies in a single Store #10764

Merged
merged 27 commits into from Feb 15, 2021

Conversation

damianlegawiec
Copy link
Member

@damianlegawiec damianlegawiec commented Feb 5, 2021

Screen.Recording.2021-02-12.at.6.56.11.PM.mov

spencerwp added a commit to spencerwp/spree that referenced this pull request Feb 6, 2021
add multi-locale support to store
@spencerwp
Copy link

This is great - I'm only seeing one problem where :supported_locales is not a valid parameter of the store_attributes.

spree/core/lib/spree/permitted_attributes.rb -
@@store_attributes += [:supported_locales]

@squash-labs
Copy link

squash-labs bot commented Feb 10, 2021

Manage this branch in Squash

Test this branch here: https://featuresupported-locale-t2bev.squash.io

@damianlegawiec damianlegawiec force-pushed the feature/supported-locale branch 5 times, most recently from 1ca939e to 89c5727 Compare February 11, 2021 16:58
@damianlegawiec damianlegawiec marked this pull request as ready for review February 11, 2021 21:04
@flobby
Copy link
Contributor

flobby commented Feb 12, 2021

Not sure if related but on admin backend when I try to access store translations I receive this error. Might be related to globalize though.

NoMethodError - undefined method `translated_attribute_names' for #Class:0x00007fefa2c5c580:

I tracked it down to admin/translations_controller.rb:10 // something in the index action which is very generic.

(using master on commit 166b543)

@damianlegawiec
Copy link
Member Author

Not sure if related but on admin backend when I try to access store translations I receive this error. Might be related to globalize though.

NoMethodError - undefined method `translated_attribute_names' for #Class:0x00007fefa2c5c580:

I tracked it down to admin/translations_controller.rb:10 // something in the index action which is very generic.

(using master on commit 166b543)

Alongside this PR I'm preparing PRs for Spree Globalize and Spree I18n ( spree-contrib/spree_i18n#876 ) to ease the migration path, hopefully, I can finish all of it today/Monday.

@channainfo
Copy link

@damianlegawiec awesome! thank you

@damianlegawiec damianlegawiec force-pushed the feature/supported-locale branch 2 times, most recently from 39fa2fe to 484e1f1 Compare February 15, 2021 07:13
@damianlegawiec damianlegawiec changed the title Feature/supported locale Ability to switch between different Locales and Currencies in a single Store Feb 15, 2021
@damianlegawiec damianlegawiec added this to the 4.2 milestone Feb 15, 2021
@damianlegawiec damianlegawiec force-pushed the feature/supported-locale branch 3 times, most recently from fc7b16c to 69943cc Compare February 15, 2021 07:43
@damianlegawiec
Copy link
Member Author

This is great - I'm only seeing one problem where :supported_locales is not a valid parameter of the store_attributes.

spree/core/lib/spree/permitted_attributes.rb -
@@store_attributes += [:supported_locales]

Done and done!

frontend/app/helpers/spree/store_helper.rb Outdated Show resolved Hide resolved
* adds ability to switch locale within scope of current store
* endpoint to render dropdown with a list supported currencies
* additional tests
To be able to use it in Storefront as well
`params[:currency]` can pass not supported currency in current store.
Most people will use single store with multiple currencies / locales
This is compatible with Spree I18n / Spree Multi Currency behaviour and is best suited for single store installations that want one store on a single domain with multiple currencies / locales
Fallback to `Spree::Config[:currency]` as a last resort
@damianlegawiec damianlegawiec merged commit 13bfafb into master Feb 15, 2021
@damianlegawiec damianlegawiec deleted the feature/supported-locale branch February 25, 2021 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants