Translate content for an online store
You can use the GraphQL Admin API to translate an online store's content so that you can sell in multiple languages.
This guide shows you how to enable the
es (Spanish) locale on your store, retrieve a product, translate the product's title, publish the new locale, and view the translated content on your store.
RequirementsAnchor link to section titled "Requirements"
- Your app can make authenticated requests to the GraphQL Admin API.
- Your app has the
write_localesaccess scopes. For more information on requesting access scopes when your app is installed, refer to Getting started with OAuth.
- You've created at least one product in your Shopify store.
Step 1: Enable a localeAnchor link to section titled "Step 1: Enable a locale"
You can use the
shopLocaleEnable mutation to enable the
es locale on your store.
shopLocale response, include the
published fields to verify that the locale has been successfully enabled.
Step 2: Retrieve a translatable productAnchor link to section titled "Step 2: Retrieve a translatable product"
To retrieve the first product eligible for translation, use the
translatableResources query with the parameters
first: 1 and
translatableContent response, include the
locale fields. You need their response values to write the translation in the next step.
Step 3: Write a translationAnchor link to section titled "Step 3: Write a translation"
You can use the
translationsRegister mutation to create a new translation for a translatable resource.
When you create a translation, you need to include the translatable content's
digest value in the
translatableContentDigest field. A unique digest is returned from the
translatableResources query for each
Step 4: Publish the localeAnchor link to section titled "Step 4: Publish the locale"
Step 5: Visit your online storeAnchor link to section titled "Step 5: Visit your online store"
To view the translation on your online store, complete the following steps:
Navigate to the product's page on your online store.
esto your URL. For example,
- Use the GraphQL Admin API to manage country fields.
- Use the Storefront API to retrieve translated content.
- Explore an example for retrieving a list of shop locales with the GraphQL Admin API.
- Explore examples for retrieving translatable resources with the GraphQL Admin API.
- Learn how to support multiple currencies and languages in your theme.