Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Please help! metafield json data cannot be translated

Please help! metafield json data cannot be translated

richee_2023
Visitor
2 0 0

Please help! metafield json data cannot be translated

I tried to use Translate & Adapt to automatically translate the product metafield json (I will give a concrete example of the data), but I found that it doesn't work.

1. Does Translate & Adapt support automatic translation of metafield json?

2. if Translate & Adapt doesn't know, can I use python program outside of shopify to translate my data in bulk. Translation wise I am my solution, now I want to know how I can export this metafield json data to CSV automatically, and import the translated data to the store via CSV format again.

3. If the idea of 2 does not work, do you have a solution for it?

 

 

This is an example, I use this json to store my product descriptions for different sku, by rewriting the code, I will read the corresponding product descriptions from this metafield json data for rendering when I switch between sku.

richee_2023_0-1680748578481.png

 

Replies 2 (2)

richee_2023
Visitor
2 0 0

Request guidance from official technicians.

Transcy
Shopify Partner
285 19 87

 Hello @richee_2023 ,

 

For your questions:

1. No, Shopify Translate and Adapt doesn't support metafield JSON.

 

2. Yes, you can use Python program to translate the data outside of Shopify.

To export the metafield JSON data to CSV, you can use the Shopify API to retrieve the data and convert it to a CSV file. Here are the general steps:

  1. Authenticate your app with the Shopify API and retrieve an access token.
  2. Use the API to retrieve the metafield data for your products, variants, or other objects.
  3. Parse the JSON data and extract the fields you want to translate. You may want to exclude any fields that should not be translated, such as IDs or other internal data.
  4. Use a Python library such as Pandas to create a CSV file from the data.
  5. Save the CSV file to your local computer or a cloud storage service.

To import the translated data back into Shopify, you can use the Shopify API to update the metafield data for your objects. Here are the general steps:

  • Authenticate your app with the Shopify API and retrieve an access token.
  • Parse the translated data from the CSV file and create a dictionary or list of objects.
  • Use the API to update the metafield data for your objects. You will need to specify the object type (e.g. product or variant), the object ID, the namespace and key of the metafield, and the translated value.
  • Repeat the update process for each object in your list.

Hope our answer can help you out. 

Transcy team.

Transcy - The #1 Translation and Currency Converter
- Was my answer helpful? Please hit Like or Mark it as solution!
- Get in touch with us: App Store | Blog