-
Notifications
You must be signed in to change notification settings - Fork 315
Add Hydrogen context provider for i18n overrides #2739
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
base: main
Are you sure you want to change the base?
Conversation
Oxygen deployed a preview of your
Learn more about Hydrogen's GitHub integration. |
Hi, just wanted to know if this will get merged soon? Thanks. |
|
||
export default function App() { | ||
return ( | ||
<HydrogenProvider countryIsoCode="CA" languageIsoCode="EN"> |
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.
Nit picky, but we should be consistent on what these are called throughout Hydrogen:
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.
If we introduce an official "ShopifyProvider", what does that mean for the AnalyticsProvider? Should that stay separate, or be included with the ShopifyProvider?
WHY are these changes introduced?
Fixes #2507
useMoney
andMoney
inside Hydrogen don't respect i18n localization params passed to the storefront context as those components take the localization data from a wrappingShopifyProvider
.There are multiple possible ways of tackling this, with the spectrum going from introducing breaking changes, to adding renamed counterparts that receive explicit i18n data, to introducing a Hydrogen specific context that overrides the localization data. This PR implements the approach of the H2 context.
WHAT is this pull request doing?
HydrogenContext
that contains the i18n data (country and language codes).useShop
hook (used byuseMoney
) to override the context data coming fromShopifyProvider
with the values coming fromHydrogenContext
(if present).Layout
function so that it wraps everything withHydrogenContext.Provider
.Checklist