Start a conversation

Overriding Text using GraphQL

How to create, update, or delete text overrides using a GraphQL mutation.

You can create, modify, and delete text overrides using GraphQL within Aurora's API. This guide will share examples of GraphQL queries (and their included variables) to help you get started.

Creating or Updating a Text override via GraphQL

To create or update Text overrides via GraphQL, you must make a GraphQL call to execute the createOrUpdateTextOverride mutation. Behind the scenes, this mutation creates text overrides and checks them into the Git repository for you.

Here is a list of currently supported locales:

Language Locale Code
English (United States) en-us
English (United Kingdom) en-gb
French (France) fr-fr
Spanish (Spain) es-es
Italian (Italy) it-it
Dutch (Netherlands) nl-nl
Portuguese (Brazil) pt-br
Portuguese (Portugal) pt-pt
Russian (Russia) ru-ru
Polish (Poland) pl-pl
Korean (South Korea) ko-kr
Chinese (Simplified, China) zh-cn
Japanese (Japan) ja-jp
German (Germany) de-de

Here is an example GraphQL call, which includes the query and the variables to create or update a text override:

Query

mutation createOrUpdateTextOverride

mutation createOrUpdateTextOverride($componentId: String!, $locale: Locale!, $values: JSON!) {
    createOrUpdateTextOverride(componentId: $componentId, locale: $locale, values: $values) {
        result {
            locale
            texts
            lastUpdatedTime
        }
        errors {
            ... on CreateOrUpdateTextFailedError {
                message
                fields
                name
            }
        }     
    }
}

Variables

{
    "componentId": "communityPage",
    "locale": "en-us",
    "values": {
      "community.pages.communityPage": {
        "NodeHeader.title": "Search test five",
        "NodeHeader.description": "Description test five",
        "NodePageHeaderWidget-title.title": "Header widget"
      }
    }
}

Deleting Text overrides via GraphQL

To delete Text overrides via GraphQL, you must make a request to execute the removeTextOverride mutation.

Behind the scenes, this mutation removes text overrides and checks them into the Git repository for you.

Here is an example GraphQL call, which includes the query and the variables to remove the NodeHeader.title key-value for US English:

Example

Mutation

mutation removeTextOverride($componentId: String!, $locale: Locale!, $key: String!) {
    createOrUpdateTextOverride(componentId: $componentId, locale: $locale, key: $key) {
        result {
            locale
            texts
            lastUpdatedTime
        }
        errors {
            ... on TextNotFoundError {
                message
                fields
                textKey
            }
            ... on TextFileNotFoundError {
                message
                fields
                file
            }
            ... on TextForComponentNotFoundError {
                message
                fields
                componentId
            }
        }     
    }
}

Variables

{
    "componentId": "community.pages.communityPage",
    "locale": "en-us",
    "key": "NodeHeader.title"
}

Creating/updating/Deleting Text override via Quilt Override

Quilt overrides support creating, updating, and deleting existing Text overrides. All we need to do is add some extra fields to the request.

Fields

These fields include addTextOverrides and removeTextOverrides. Here is a breakdown of the sub-fields you can use to refine your request.


Parameter: createOrUpdateBulkQuiltOverride

This parameter creates or updates text overrides.

Field Description
locale The text language.
component The component ID for which the text key and value are being added.
values The text key-value pair to store as a text override.

Parameter: TextOverrides

This parameter deletes the target text overrides.

Field Description
locale The text language.
component The component ID for which the text key and value are being added.
values The text key-value pair to store as a text override.

Example

Example Query

fragment Error on Error {
    message
    fields
}
  
fragment QuiltError on QuiltError {
    ...Error
    quiltId
}
  
fragment CoreNodeNotFoundError on CoreNodeNotFoundError {
    ...Error
    nodeId
}
  
fragment QuiltSection on QuiltSection {
  id
  layout
  bgColor
  showTitle
  showDescription
  textPosition
  textColor
  sectionEditLevel
  bgImage {
    assetName
    backgroundSize
    backgroundRepeat
    backgroundPosition
    lastModified
  }
  disableSpacing
  edgeToEdgeDisplay
  fullHeight
  showBorder
}
fragment Component on QuiltComponent {
  id
  className
  props
}
  
fragment OneColumnQuiltSection on OneColumnQuiltSection {
  ...QuiltSection
  columnMap {
    main {
      ...Component
    }
  }
}
  
fragment TwoColumnQuiltSection on TwoColumnQuiltSection {
  ...QuiltSection
  columnMap {
    column1 {
      ...Component
    }
    column2 {
      ...Component
    }
  }
}
  
fragment ThreeColumnQuiltSection on ThreeColumnQuiltSection {
  ...QuiltSection
  columnMap {
    column1 {
      ...Component
    }
    column2 {
      ...Component
    }
    column3 {
      ...Component
    }
  }
}
  
fragment MainSideQuiltSection on MainSideQuiltSection {
  ...QuiltSection
  columnMap {
    main {
      ...Component
    }
    side {
      ...Component
    }
  }
}
  
fragment SideMainQuiltSection on SideMainQuiltSection {
  ...QuiltSection
  columnMap {
    main {
      ...Component
    }
    side {
      ...Component
    }
  }
}
  
fragment QuiltHeader on QuiltHeader {
  id
  type
  className
  props
}
fragment QuiltFooter on QuiltFooter {
  id
  type
  className
  props
}
fragment QuiltList on QuiltList {
  id
  type
  wrapper {
    element
    className
  }
  items {
    ...OneColumnQuiltSection
    ...TwoColumnQuiltSection
    ...ThreeColumnQuiltSection
    ...MainSideQuiltSection
    ...SideMainQuiltSection
  }
}
  
fragment QuiltResource on QuiltResource {
  lastUpdatedTime
  quilt {
    id
    items {
      ...QuiltHeader
      ...QuiltList
      ...QuiltFooter
    }
  }
}  
mutation createOrUpdateBulkQuiltOverride($updatedQuiltsInput: [QuiltOverrideInput!]!, $addTextOverrides: [AddTextOverridesInput!], $removeTextOverrides: [RemoveTextOverridesInput!]) {
  createOrUpdateBulkQuiltOverride(bulkQuiltInput: $updatedQuiltsInput, addTextOverrides: $addTextOverrides, removeTextOverrides: $removeTextOverrides) {
         result {
            ...QuiltResource
        }
        errors {
            ...on QuiltNotFoundError {
                ...QuiltError
            }
            ... on CreateOrUpdateQuiltFailedError {
                ...QuiltError
            }
            ... on CoreNodeNotFoundError {
                ...CoreNodeNotFoundError
            }
        }
    }
}

Example Variables

{
  "bulkQuiltInput": [
    {
      "defaultQuiltId": "ForumBoardPage",
      "quiltInput": {
        "id": "CommunityPage",
        "items": [
          {
            "header": {
              "type": "HEADER",
              "id": "nodes.widget.nodePageHeaderWidget",
              "props": {
                "breadcrumbProps": {
                  "useBreadcrumb": false
                },
                "backgroundImageProps": {
                  "backgroundSize": "COVER",
                  "backgroundPosition": "CENTER_CENTER",
                  "backgroundRepeat": "NO_REPEAT"
                },
                "showNodeHeaderTitle": false,
                "showNodeHeaderDescription": false,
                "nodeHeaderPadding": {
                  "paddingTop": 50,
                  "paddingBottom": 50
                },
                "backgroundColor": "transparent",
                "useBottomBorder": false
              }
            }
          },
          {
            "list": {
              "type": "LIST",
              "id": "main",
              "wrapper": {
                "element": "main"
              },
              "items": [
                {
                  "oneColumn": {
                    "id": "node-navigation",
                    "layout": "ONE_COLUMN",
                    "columnMap": {
                      "main": [
                        {
                          "id": "places.widget.placesWidget"
                        }
                      ]
                    }
                  }
                },
                {
                  "oneColumn": {
                    "id": "home-widgets-section-1",
                    "layout": "ONE_COLUMN",
                    "columnMap": {
                      "main": [
                        {
                          "id": "messages.widget.messageListForNodeByTopContentWidget",
                          "props": {
                            "hideIfEmpty": true,
                            "conversationStyle": "BLOG",
                            "listVariant": {
                              "type": "grid",
                              "props": {
                                "itemSpacing": "lg"
                              }
                            },
                            "useTitle": false,
                            "showTabs": false,
                            "pageSize": 5,
                            "pagerVariant": {
                              "type": "none"
                            },
                            "style": "card",
                            "viewVariant": {
                              "type": "card",
                              "props": {
                                "useRepliesCount": true,
                                "useAuthorRank": false,
                                "useNode": false,
                                "truncateBodyLength": -1,
                                "useNodeLink": true,
                                "timeStampType": "postTime",
                                "useTextBody": true,
                                "useSolvedBadge": false,
                                "useImages": true,
                                "portraitClampBodyLines": 2,
                                "useCenteredContent": false,
                                "useTimeToRead": true,
                                "useSpoilerFreeBody": false,
                                "useKudosCount": true,
                                "usePreviewImage": true,
                                "useViewCount": true,
                                "landscapeClampBodyLines": 2,
                                "useBody": true,
                                "useTags": true,
                                "clampSubjectLines": 2,
                                "useBoardIcon": false,
                                "clampBodyLines": 2,
                                "useAuthorLogin": true,
                                "useNodeHoverCard": true,
                                "useClickableCard": true,
                                "useSearchSnippet": false
                              }
                            },
                            "panelType": "spaced",
                            "sorts": {
                              "kudosSum
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. ATLAS

  2. Posted
  3. Updated

Comments