Process: Traditional Chinese Translations Update for BabyCentral Hong Kong in Shopify

Process: Traditional Chinese Translations Update for BabyCentral Hong Kong in Shopify



The "Update\translations\babycentral Hongkong" process plays a crucial role in maintaining accurate and up-to-date Traditional Chinese translations for Products and Collections between the BabyCentral Portal and the Shopify store Babycentralhk. By leveraging the Shopify GraphQL API version 2023-07, this Boomi process ensures seamless communication and synchronisation of translated content, enhancing the overall customer experience for BabyCentral's Hong Kong-based Shopify store.

Process Details:

1. Set Properties:
  The process initiates by setting a dynamic document property "date" to the current date. This property is essential to update the translations on a daily basis and do improve performance.
2. Fetch Translations:
  This critical step involves fetching translations from a designated API endpoint. The API request is constructed with specific parameters:
    `storeid=0` targets BabyCentral Hong Kong, ensuring that translations are retrieved for the correct store.
    `languageid=2` specifies Traditional Chinese, the desired language for the translations.
    The `fromdate=currentdate` parameter ensures that only translations updated on or after the specified date are obtained, reducing unnecessary data retrieval.
    The API response data is received in JSON format and strictly adheres to a defined schema. This schema ensures consistency and facilitates smooth data processing throughout the subsequent steps.\
      \


      {% code fullWidth="true" %}
      ```json
      {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "title": "Generated schema for Root",
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "sku": {
              "type": "string"
            },
            "titlezh": {
              "type": "string"
            },
            "descriptionzh": {
              "type": "string"
            },
            "metatitlezh": {
              "type": "string"
            },
            "metadescriptionzh": {}
          },
          "required": [
            "sku",
            "titlezh",
            "descriptionzh",
            "metatitlezh",
            "metadescriptionzh"
          ]
        }
      }
      ```
      {% endcode %}
3. Data Process:
  To facilitate efficient handling of incoming data, the process utilizes the Data Process shape. It employs this shape to logically split documents based on their SKU (Stock Keeping Unit), effectively organising the translations for further processing.
4. Map: Decode HTML & Fetch Product resource id.
  During the mapping phase, the process focuses on decoding HTML strings using a JavaScript function. This transformation is crucial to render the HTML content in a human-readable format, enabling ease of understanding and validation during translation updates.
    Additionally, within the mapping process, the Boomi process queries the Product gid (Global Identifier) from Shopify. This step ensures that each translation is accurately associated with the appropriate product or collection in the Shopify store.\
      \
      Adding the Mapping Sheet :\


      | Map Name:                                             | Map:Query\product\data                                    |


                        |


                        |


  |


                                          |
      | ----------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------- | ----------------------------------- | ------------- | ----------------------------------------------------- |
      | Folder:                                               | Bloom Connect HK/Translations                               |


                        |


                        |


  |


                                          |
      | Description:                                          |


                                                |


                        |


                        |


  |


                                          |
      | Version:                                              | 7                                                           |


                        |


                        |


  |


                                          |
      | Source Profile:                                       | Profile: Babycentral\translation\product\json            |


                        |


                        |


  |


                                          |
      | Source Profile Type:                                  | JSON Profile                                                |


                        |


                        |


  |


                                          |
      | Destination Profile:                                  | Profile: Babycentral\translation\product\json\with\gid |


                        |


                        |


  |


                                          |
      | Destination Profile Type:                             | JSON Profile                                                |


                        |


                        |


  |


                                          |
      |


                                          |


                                                |


                        |


                        |


  |


                                          |
      | Source Element                                        | Function Default                                            | Function Input                      | Function Output                     | Default Value | Destination Element                                   |
      | Root/Array/ArrayElement1/Object/meta\description\zh |


                                                |


                        |


                        |


  | Root/Array/ArrayElement1/Object/meta\description\zh |
      | Root/Array/ArrayElement1/Object/meta\title\zh       |


                                                |


                        |


                        |


  | Root/Array/ArrayElement1/Object/meta\title\zh       |
      | Root/Array/ArrayElement1/Object/title\zh             |


                                                |


                        |


                        |


  | Root/Array/ArrayElement1/Object/title\zh             |
      | Root/Array/ArrayElement1/Object/sku                   |


                                                | Function: Query Product\id\[1]/sku |


                        |


  |


                                          |
      |


                                          |


                                                |


                        | Function: Query Product\id\[1]/gid |


  | Root/Array/ArrayElement1/Object/product\gid          |
      | Root/Array/ArrayElement1/Object/description\zh       |


                                                | Scripting\[1]/description\encoded  |


                        |


  |


                                          |
      |


                                          |


                                                |


                        | Scripting\[1]/output                |


  | Root/Array/ArrayElement1/Object/description\zh       |
5. Business Rules:
  The Boomi process enforces a crucial business rule at this stage to validate the presence of a "Product gid" for each document. Documents lacking a valid "Product gid" are rejected to prevent any potential data discrepancies during the update process.
6. Branched: 2 Branches
  Branch 1: Add to Cache
    In this branch, documents that have successfully passed validation are saved to the cache with an index "gid". Caching the translations streamlines subsequent operations, reducing the need for redundant data access.
    Branch 2: Map - Query Translatable Resources \
      \
               

      1.  Map - Convert JSON Profile to a Structured Map\
         In this step Boomi converts the Json profile to a Graphql request based profile to be used in the next step.
      2.  HTTP - Querying Translatable resources Utilizing the Global GraphQL Endpoint

          Once the JSON profile is successfully transformed into a structured Map, the Boomi process proceeds to interact with the Shopify store's data using GraphQL.

          To perform the GraphQL queries, the Boomi process uses the HTTP connector, which establishes a connection with the global GraphQL endpoint for Shopify API version 2023-07.
      3.  Step 3: Flow Control - Running Each Document Individually

          Documents are flown individually to map translation from cache.
      4.  Step 4: Data Process - Splitting Documents to Add Cache Translations

          By splitting the documents, the process can better manage and prepare the translations for the final synchronization.
      5.  Step 5: Map - Adding Translations to Resource IDs

          In this critical mapping step, the Boomi process takes the translations from the Data Process shape and  associates them with their respective resource IDs. The mapping is done based on the "KEYs" (resource identifiers) of each translation resource.

          By accurately mapping translations to their corresponding resource IDs, the process guarantees that each updated translation is precisely applied to the correct product or collection in the Shopify store. \
          \
          Adding the map export:\


          | Map Name:                                                                                                                                                                                 | Map:translations\map\from\cache                  |


                         |


                      |


                                                                                                                                                                                                                     |


                                                                                   |
          | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | ------------------------------------ | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
          | Folder:                                                                                                                                                                                   | Bloom Connect HK/Translations                       |


                         |


                      |


                                                                                                                                                                                                                     |


                                                                                   |
          | Description:                                                                                                                                                                              |


                                        |


                         |


                      |


                                                                                                                                                                                                                     |


                                                                                   |
          | Version:                                                                                                                                                                                  | 12                                                  |


                         |


                      |


                                                                                                                                                                                                                     |


                                                                                   |
          | Source Profile:                                                                                                                                                                           | Profile: Shopify\translatable\resources\response |


                         |


                      |


                                                                                                                                                                                                                     |


                                                                                   |
          | Source Profile Type:                                                                                                                                                                      | JSON Profile                                        |


                         |


                      |


                                                                                                                                                                                                                     |


                                                                                   |
          | Destination Profile:                                                                                                                                                                      | Profile:IM\Shopify\translation\request           |


                         |


                      |


                                                                                                                                                                                                                     |


                                                                                   |
          | Destination Profile Type:                                                                                                                                                                 | JSON Profile                                        |


                         |


                      |


                                                                                                                                                                                                                     |


                                                                                   |
          |


                                                                                                                                                                              |


                                        |


                         |


                      |


                                                                                                                                                                                                                     |


                                                                                   |
          | Source Element                                                                                                                                                                            | Function Default                                    | Function Input                       | Function Output                   | Default Value                                                                                                                                                                                                                    | Destination Element                                                                            |
          |


                                                                                                                                                                              |


                                        |


                         |


                      | mutation translationsRegister($resourceId: ID!, $translations: \[TranslationInput!]!) { translationsRegister(resourceId: $resourceId, translations: $translations) { userErrors { message field } translations { key value } \}} | Root/Object/query                                                                              |
          | Root/Object/data/Object/translatableResource/Object/resourceId                                                                                                                            |


                                        |


                         |


                      |


                                                                                                                                                                                                                     | Root/Object/variables/Object/resourceId                                                        |
          | Root/Object/data/Object/translatableResource/Object/translatableContent/Array/ArrayElement1/Object/key                                                                                    |


                                        |


                         |


                      |


                                                                                                                                                                                                                     | Root/Object/variables/Object/translations/Array/ArrayElement1/Object/key                       |
          |


                                                                                                                                                                              |


                                        |


                         |


                      | zh-TW                                                                                                                                                                                                                            | Root/Object/variables/Object/translations/Array/ArrayElement1/Object/locale                    |
          | Root/Object/data/Object/translatableResource/Object/translatableContent/Array/ArrayElement1/Object/digest                                                                                 |


                                        |


                         |


                      |


                                                                                                                                                                                                                     | Root/Object/variables/Object/translations/Array/ArrayElement1/Object/translatableContentDigest |
          | Root/Object/data/Object/translatableResource/Object/translatableContent/Array/ArrayElement1/Object/key                                                                                    |


                                        | Scripting\[1]/key                    |


                      |


                                                                                                                                                                                                                     |


                                                                                   |
          | Root/Object/data/Object/translatableResource/Object/translatableContent/Array/ArrayElement1/Object/key/Cache:Product\translation\cache \[gid]/Root/Array/ArrayElement1/Object/title\zh |


                                        | Scripting\[1]/title\zh\input       |


                      |


                                                                                                                                                                                                                     |


                                                                                   |
          | Root/Object/data/Object/translatableResource/Object/resourceId                                                                                                                            |


                                        | Scripting\[1]/description\zh\input |


                      |


                                                                                                                                                                                                                     |


                                                                                   |
          |


                                                                                                                                                                              |


                                        |


                         | Scripting\[1]/output\translation |


                                                                                                                                                                                                                     | Root/Object/variables/Object/translations/Array/ArrayElement1/Object/value                     |
      6. Business Rules:\
         The Boomi process implements a vital business rule. This rule requires that each document must have a valid "KEY" for translation. The "KEY" serves as a unique identifier for each resource, essential for ensuring accurate and reliable updates.
      7.   HTTP - Posting Translations Using HTTP GraphQL Global Shopify API

          The final step in this branch involves posting the  updated translations back to the Shopify store. To accomplish this, the Boomi process uses the HTTP connector to communicate with the global GraphQL Shopify API.

          The Boomi process packages the updated translations, along with their corresponding "KEYs," into GraphQL requests to update the specific resources in the Shopify store. This seamless data transmission ensures that the translations are accurately and reliably applied to the corresponding products and collections.\


             

















Conclusion:

Subscribe to Bloom and Grow Documentation

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe