Storefront API and multiple languages

Highlighted
Tourist
4 0 2

I did not find the docs for the direct checkout links but if you do a POST to "/de/cart" and checkout param is set you get redirected /checkout but with german translations.

I tried it in standard template on the cart page by editing changing the cart-form-url from "/cart" to "/de/cart".

 

0 Likes
Highlighted
Shopify Partner
21 0 3

Might work now. Did not test but found this in the docs:

 

Retrieving Storefront API translations:
You can query the supported resources using the Accept-Language HTTP header, to return translated content to the Storefront API.

Source: https://help.shopify.com/en/api/guides/multi-language/translating-content-api#retrieving-storefront-...

1 Like
Highlighted
Tourist
4 0 1

I've tested this. The documentation seems to indicate that this should be possible, but it doesn't work.

 

Here is what I did:

  • installed a translation app
  • published a language - "German"
  • added some translated content for this language
  • added the "Accept-Language" HTTP Header to the Storefront API request and gave it the value of the ISO-code of the language, "de"

But the content comes back in English. Has anyone else tried this and had more success?

0 Likes
Highlighted
Tourist
4 0 1

After further investigation, I am pleased to report that this feature is working as described in the documentation here: https://shopify.dev/tutorials/manage-app-translations-with-admin-api#storefront-api-translation-head...

 

My mistake was to initially not use a sufficiently recent version of the Storefront API. This functionality works from version 2020-01 onwards.

0 Likes