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

Use lang directive #1028

Merged
merged 12 commits into from
Apr 5, 2022
Merged

Use lang directive #1028

merged 12 commits into from
Apr 5, 2022

Conversation

michenly
Copy link
Contributor

@michenly michenly commented Mar 31, 2022

Description

Switch to using language directive instead of header to query for lang specific content.

https://shopify.dev/api/examples/multiple-languages#translatable-resources

Additional context


Before submitting the PR, please make sure you do the following:

  • Read the Contributing Guidelines
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123)
  • Update docs in this repository according to your change
  • Run yarn changeset add if this PR cause a version bump based on Keep a Changelog and adheres to Semantic Versioning

@michenly michenly force-pushed the use-lang-directive branch from 31cb73e to 7e74d4e Compare April 1, 2022 16:58
@michenly michenly self-assigned this Apr 1, 2022
@michenly michenly force-pushed the use-lang-directive branch from d6b2034 to 67ecff9 Compare April 1, 2022 17:34
@michenly michenly force-pushed the use-lang-directive branch from 67ecff9 to 0ff34df Compare April 1, 2022 17:54
@michenly michenly marked this pull request as ready for review April 1, 2022 20:20
@michenly michenly requested a review from a team April 1, 2022 20:20
@github-actions

This comment has been minimized.

@michenly michenly requested a review from mcvinci April 1, 2022 20:43
Copy link
Contributor

@mcvinci mcvinci left a comment

Choose a reason for hiding this comment

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

Thanks, @michenly! Left a few suggestions as well as a couple comments about two other files that need some minor updates.

packages/hydrogen/src/foundation/useShop/README.md Outdated Show resolved Hide resolved
packages/hydrogen/src/hooks/useShopQuery/README.md Outdated Show resolved Hide resolved
packages/hydrogen/src/hooks/useShopQuery/README.md Outdated Show resolved Hide resolved
.changeset/hungry-scissors-cross.md Outdated Show resolved Hide resolved
@michenly michenly force-pushed the use-lang-directive branch from fdfcc66 to 661ce0f Compare April 1, 2022 21:56
'test-server-components': patch
---

Starting from SF API version `2022-04`, the prefer way to request for translatable resources is using the `@inContext` directive. See [API docs](https://shopify.dev/api/examples/multiple-languages#retrieve-translations-with-the-storefront-api) on how to do this and which resources have translatable properties.
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems a bit unfortunate to me that this can't be more automatic, but has to be so manual.

@michenly michenly force-pushed the use-lang-directive branch 3 times, most recently from 571ea36 to ba6bdc6 Compare April 4, 2022 16:01
@michenly michenly force-pushed the use-lang-directive branch from e76f326 to a6bfbe0 Compare April 4, 2022 18:30
Copy link
Contributor

@jplhomer jplhomer left a comment

Choose a reason for hiding this comment

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

Thank you for tackling this! 🚀

.changeset/hungry-scissors-cross.md Outdated Show resolved Hide resolved
Copy link
Contributor

@vlucas vlucas left a comment

Choose a reason for hiding this comment

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

Thanks for taking on this work and getting it done! 👍

@michenly michenly merged commit ba17458 into v1.x-2022-07 Apr 5, 2022
@michenly michenly deleted the use-lang-directive branch April 5, 2022 15:07
blittle pushed a commit that referenced this pull request Apr 11, 2022
* remove lang code from shop query's header

* add lang directive to localization provider & add languageCode to useShop

* add lang directive to all the query that support lang in demo store

* fix test

* update shopify provider type and conver locale & lang code to upper case in the provider

* fix test

* update doc

* add changeset

* update test

* edit docs

* Remove LocalizationQuery.graphql and its type

* doc fix
blittle added a commit that referenced this pull request Apr 11, 2022
* v1.x-2022-07:
  [Hydrogen docs]: Analytics (#962)
  Analytics (#890)
  Allow line breaks inside script tags (#1061)
  Fix encoding of CSS Modules to solve hydration errors (#1062)
  [Hydrogen docs]: Update guidance on troubleshooting third-party dependencies (#1055)
  Update Vite RSC Plugin (#1054)
  Fix link prefetch (#1059)
  Initial devTools component (#998)
  Support sub request cache control header `stale-while-revalidate` everywhere (#1049)
  Fix cookie parsing (#1046)
  Update 3-external-images-with-a-custom-loader.example.tsx (#1045)
  Restore scroll position on browser navigation (#1047)
  Remove old changeset to unblock release (#1042)
  [ci] release v1.x-2022-07 (#1019)
  Update to Vite 2.9 (#1039)
  Use lang directive (#1028)
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.

6 participants