Add pathPrefix to i18n and use storefront.i18n#330
Merged
frandiox merged 7 commits intov0.x-2022-10from Jan 12, 2023
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
blittle
approved these changes
Jan 11, 2023
Contributor
blittle
left a comment
There was a problem hiding this comment.
LGTM, though I like the idea of always having a default i18n to make the type more easy to work with.
Contributor
Author
I can change that in this PR. @jplhomer @wizardlyhel do you see any concern with that? |
wizardlyhel
approved these changes
Jan 11, 2023
Contributor
|
love this, great stuff @frandiox |
juanpprieto
reviewed
Jan 11, 2023
| import {ProductSwimlane, FeaturedCollections, Hero} from '~/components'; | ||
| import {COLLECTION_CONTENT_FRAGMENT, PRODUCT_CARD_FRAGMENT} from '~/data'; | ||
| import {getHeroPlaceholder} from '~/lib/placeholders'; | ||
| import {getLocaleFromRequest} from '~/lib/utils'; |
Contributor
There was a problem hiding this comment.
should we delete this util?
Contributor
Author
There was a problem hiding this comment.
It's still needed in server.ts to extract the locale from request the first time.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We were calling the
getLocaleFromRequestin many loaders but we already have the same information instorefront.i18n. This PR starts using that instead. Also, it addspathPrefixto the types of thei18nwith a default value.Thoughts?
On a side note, it's unfortunate that
storefront.i18nis possiblyundefined, even though we are passing a value increateStorefrontClientbut we can't infer it, so we always need to access it asstorefront.i18n!. Should we add a default value of{language: 'EN', country: 'US'}tostorefront.i18nto improve the type? Would this default value be a problem?