Queries Library
Queries LibraryTranslate posts for MultilingualPress (Gutenberg)

Translate posts for MultilingualPress (Gutenberg)

This GraphQL query is an integration for the MultilingualPress plugin, to translate posts based on the Gutenberg editor.

This query requires the endpoint to have Nested Mutations enabled.

The query must be executed on the master site (with source content), which must have the PRO plugin. All other sites in the network can have the free Gato GraphQL plugin.

An Application Password is used to connect to the network sites. Make sure to provide the $username and $appPassword variables for a user with access to all sites.

The query takes an origin post, translates it using the Google Translate API to the other languages defined as connections via MultilingualPress, and stores those translations in the corresponding sites in the network. All translation posts must already exist.

To limit for what languages to execute the translation, pass variables $includeSiteIDsToTranslate (if empty, all sites will be included) and $excludeSiteIDsToTranslate.

By default it also translates the post slug. To disable, pass variable updateSlug with false.

There are languages for which the code used by WordPress and by Google Translate are different. For instance, Norwegian is represented as "nb" by WordPress, and as "no" by Google Translate. To support translating to these languages, provide the language code mapping via the $languageMapping GraphQL variable:

{
  "languageMapping": {
    "nb": "no"
  }
}
########################################################################
# 
# Variables:
#   - username: The username to log into the external site
#   - appPassword: The application password to log into the external site
#   - postId: The post with the origin language, from where all translations will be made
#   - updateSlug: Indicate if to update the post slug, using the translated title. It is `true` by default.
#   - includeSiteIDsToTranslate: Limit sites to execute the translation for. If empty, all sites are included
#   - excludeSiteIDsToTranslate: Exclude sites from executing the translation
#   - languageMapping: JSON object to convert languages codes to work with Google Translate. For instance, WordPress uses "nb" as the code for Norwegian, but Google Translate uses "no" instead; to translate to Norwegian, then pass value `{"nb": "no"}`
#   - (Optional) externalSiteGraphQLEndpointPath: Path to the GraphQL endpoint on the external site
#
# *********************************************************************
#
# === Description ===
#
# This Persisted GraphQL query is an integration for MultilingualPress,
# to translate posts based on the Gutenberg editor, where very site in a
# WordPress multisite network is a translation site.
# 
# It must be executed on the master site, which must have the PRO plugin.
# All other sites in the network can have the free Gato GraphQL plugin.
#
# It takes an origin post on the master site, it translates it using the
# Google Translate API to all the other languages defined as connections
# in MultilingualPress, and stores those translations in the corresponding
# sites in the network. All translation posts in the network sites must
# already exist.
#
# To limit for what sites to execute the translation, pass
# variables `$includeSiteIDsToTranslate` (if empty, all sites
# will be included) and `$excludeSiteIDsToTranslate`.
#
# By default it also translates the post slug. To disable, pass
# variable `updateSlug` with `false`.
#
# For some languages, the code used by WordPress and Google Translate
# are different. For instance, Norwegian is represented as "nb" by
# WordPress, and as "no" by Google Translate. To support translating
# to these languages, provide the language code mapping via the
# `$languageMapping` GraphQL variable, such as:
#
#   {
#     "languageMapping": {
#       "nb": "no"
#     }
#   }
#
# See Persisted Query "Translate post (Gutenberg)" for additional
# documentation.
#
########################################################################
query InitializeVariables
  @configureWarningsOnExportingDuplicateVariable(enabled: false)
{
  emptyBool: _echo(value: false)
    @export(as: "hasTranslationConnections")
    @export(as: "executeTranslation")
    @remove
  
  emptyArray: _echo(value: [])
    @export(as: "networkSiteTranslationConnectionDataItems")
 
    @export(as: "originCoreHeadingContentItems")
    @export(as: "originCoreHeadingContentReplacementsFrom")
    @export(as: "originCoreHeadingContentReplacementsTo")
 
    @export(as: "originCoreParagraphContentItems")
    @export(as: "originCoreParagraphContentReplacementsFrom")
    @export(as: "originCoreParagraphContentReplacementsTo")
 
    @export(as: "originCoreImageAltItems")
    @export(as: "originCoreImageAltReplacementsFrom")
    @export(as: "originCoreImageAltReplacementsTo")
 
    @export(as: "originCoreImageCaptionItems")
    @export(as: "originCoreImageCaptionReplacementsFrom")
    @export(as: "originCoreImageCaptionReplacementsTo")
 
    @export(as: "originCoreButtonTextItems")
    @export(as: "originCoreButtonTextReplacementsFrom")
    @export(as: "originCoreButtonTextReplacementsTo")
 
    @export(as: "originCoreTableCaptionItems")
    @export(as: "originCoreTableCaptionReplacementsFrom")
    @export(as: "originCoreTableCaptionReplacementsTo")
 
    @export(as: "originCoreTableBodyCellsContentItems")
    @export(as: "originCoreTableBodyCellsContentReplacementsFrom")
    @export(as: "originCoreTableBodyCellsContentReplacementsTo")
 
    @export(as: "originCoreListItemContentItems")
    @export(as: "originCoreListItemContentReplacementsFrom")
    @export(as: "originCoreListItemContentReplacementsTo")
 
    @export(as: "originCoreCoverAltItems")
    @export(as: "originCoreCoverAltReplacementsFrom")
    @export(as: "originCoreCoverAltReplacementsTo")
 
    @export(as: "originCoreMediaTextAltItems")
    @export(as: "originCoreMediaTextAltReplacementsFrom")
    @export(as: "originCoreMediaTextAltReplacementsTo")
 
    @export(as: "originCoreVerseContentItems")
    @export(as: "originCoreVerseContentReplacementsFrom")
    @export(as: "originCoreVerseContentReplacementsTo")
 
    @export(as: "originCoreQuoteCitationItems")
    @export(as: "originCoreQuoteCitationReplacementsFrom")
    @export(as: "originCoreQuoteCitationReplacementsTo")
 
    @export(as: "originCorePullquoteCitationItems")
    @export(as: "originCorePullquoteCitationReplacementsFrom")
    @export(as: "originCorePullquoteCitationReplacementsTo")
 
    @export(as: "originCorePullquoteValueItems")
    @export(as: "originCorePullquoteValueReplacementsFrom")
    @export(as: "originCorePullquoteValueReplacementsTo")
 
    @export(as: "originCoreAudioCaptionItems")
    @export(as: "originCoreAudioCaptionReplacementsFrom")
    @export(as: "originCoreAudioCaptionReplacementsTo")
 
    @export(as: "originCoreVideoCaptionItems")
    @export(as: "originCoreVideoCaptionReplacementsFrom")
    @export(as: "originCoreVideoCaptionReplacementsTo")
 
    @export(as: "originCorePreformattedContentItems")
    @export(as: "originCorePreformattedContentReplacementsFrom")
    @export(as: "originCorePreformattedContentReplacementsTo")
 
    @export(as: "originCoreEmbedCaptionItems")
    @export(as: "originCoreEmbedCaptionReplacementsFrom")
    @export(as: "originCoreEmbedCaptionReplacementsTo")
 
    @remove
}
 
query ExportData(
  $username: String!
  $appPassword: String!
  $externalSiteGraphQLEndpointPath: String! = "/graphql/internal/"
)
  @depends(on: "InitializeVariables")
{
  # Retrieve the language of the content
  siteLanguage
    @export(as: "fromLanguage")
 
  # Sites in the network
  networkSites {
    name
    url
    siteID: id
    # Generate the external site's GraphQL endpoint to connect to
    endpoint: _sprintf(
      string: "%s%s",
      values: [
        $__url,
        $externalSiteGraphQLEndpointPath
      ]
    )
    language
      @export(
        as: "networkSiteDataItems"
        type: LIST
        affectAdditionalFieldsUnderPos: [1, 2]
      )
  }
 
  # Generate the authorization header to connect to the external site
  loginCredentials: _sprintf(
    string: "%s:%s",
    values: [$username, $appPassword]
  )
    @remove
  base64EncodedLoginCredentials: _strBase64Encode(
    string: $__loginCredentials
  )
    @remove
  authorizationHeaderValue: _sprintf(
    string: "Basic %s",
    values: [$__base64EncodedLoginCredentials]
  )
    @remove
    @export(as: "authorizationHeaderValue")
}
 
query ExportOriginPost(
  $postId: ID!
  $includeSiteIDsToTranslate: [ID!]
  $excludeSiteIDsToTranslate: [ID!]
)
  @depends(on: "ExportData")
{
  originPost: post(by: { id: $postId }, status: any) {
    id
    
 
    multilingualpressTranslationConnections(filter: {
      includeSiteIDs: $includeSiteIDsToTranslate
      excludeSiteIDs: $excludeSiteIDsToTranslate
    }) {
      siteID
      postID: entityID
        @export(
          as: "translationConnectionDataItems",
          type: LIST,
          affectAdditionalFieldsUnderPos: 1
        )
    }
 
    hasTranslationConnections: _notEmpty(value: $__multilingualpressTranslationConnections)
      @export(as: "hasTranslationConnections")
 
 
    rawTitle
      @export(as: "originRawTitle")
    rawContent
      @export(as: "originRawContent")
    rawExcerpt
      @export(as: "originRawExcerpt")
    
 
    originCoreHeading: blockFlattenedDataItems(
      filterBy: { include: "core/heading" }
    )
      @underEachArrayItem
        @underJSONObjectProperty(
          by: { path: "attributes.content" }
          failIfNonExistingKeyOrPath: false
        )
          @export(
            as: "originCoreHeadingContentItems"
          )
    
 
    originCoreParagraph: blockFlattenedDataItems(
      filterBy: { include: "core/paragraph" }
    )
      @underEachArrayItem
        @underJSONObjectProperty(
          by: { path: "attributes.content" }
          failIfNonExistingKeyOrPath: false
        )
          @export(
            as: "originCoreParagraphContentItems"
          )
    
 
    originCoreImage: blockFlattenedDataItems(
      filterBy: { include: "core/image" }
    )
      @underEachArrayItem
        @underJSONObjectProperty(
          by: { key: "attributes" }
          affectDirectivesUnderPos: [1, 3]
        )
          @underJSONObjectProperty(
            by: { key: "alt" }
            failIfNonExistingKeyOrPath: false
          )
            @export(
              as: "originCoreImageAltItems"
            )
    
          @underJSONObjectProperty(
            by: { key: "caption" }
            failIfNonExistingKeyOrPath: false
          )
            @export(
              as: "originCoreImageCaptionItems"
            )
 
    
    originCoreButton: blockFlattenedDataItems(
      filterBy: { include: "core/button" }
    )
      @underEachArrayItem
        @underJSONObjectProperty(
          by: { path: "attributes.text" }
          failIfNonExistingKeyOrPath: false
        )
          @export(
            as: "originCoreButtonTextItems"
          )
    
 
    originCoreTable: blockFlattenedDataItems(
      filterBy: { include: "core/table" }
    )
      @underEachArrayItem
        @underJSONObjectProperty(
          by: { key: "attributes" }
          affectDirectivesUnderPos: [1, 3]
        )
          @underJSONObjectProperty(
            by: { key: "caption" }
            failIfNonExistingKeyOrPath: false
          )
            @export(
              as: "originCoreTableCaptionItems"
            )
    
          @underJSONObjectProperty(
            by: { key: "body" }
            failIfNonExistingKeyOrPath: false
          )
            @underEachArrayItem
              @underJSONObjectProperty(
                by: { key: "cells" }
              )
                @underEachArrayItem
                  @underJSONObjectProperty(
                    by: { key: "content" }
                  )
                    @export(
                      as: "originCoreTableBodyCellsContentItems"
                    )
 
    
    originCoreListItem: blockFlattenedDataItems(
      filterBy: { include: "core/list-item" }
    )
      @underEachArrayItem
        @underJSONObjectProperty(
          by: { path: "attributes.content" }
          failIfNonExistingKeyOrPath: false
        )
          @export(
            as: "originCoreListItemContentItems"
          )
    
 
    originCoreCover: blockFlattenedDataItems(
      filterBy: { include: "core/cover" }
    )
      @underEachArrayItem
        @underJSONObjectProperty(
          by: { path: "attributes.alt" }
          failIfNonExistingKeyOrPath: false
        )
          @export(
            as: "originCoreCoverAltItems"
          )
    
 
    originCoreMediaText: blockFlattenedDataItems(
      filterBy: { include: "core/media-text" }
    )
      @underEachArrayItem
        @underJSONObjectProperty(
          by: { path: "attributes.mediaAlt" }
          failIfNonExistingKeyOrPath: false
        )
          @export(
            as: "originCoreMediaTextAltItems"
          )
    
 
    originCoreVerse: blockFlattenedDataItems(
      filterBy: { include: "core/verse" }
    )
      @underEachArrayItem
        @underJSONObjectProperty(
          by: { path: "attributes.content" }
          failIfNonExistingKeyOrPath: false
        )
          @export(
            as: "originCoreVerseContentItems"
          )
    
 
    originCoreQuote: blockFlattenedDataItems(
      filterBy: { include: "core/quote" }
    )
      @underEachArrayItem
        @underJSONObjectProperty(
          by: { path: "attributes.citation" }
          failIfNonExistingKeyOrPath: false
        )
          @export(
            as: "originCoreQuoteCitationItems"
          )
    
 
    originCorePullquote: blockFlattenedDataItems(
      filterBy: { include: "core/pullquote" }
    )
      @underEachArrayItem
        @underJSONObjectProperty(
          by: { key: "attributes" }
          affectDirectivesUnderPos: [1, 3]
        )
          @underJSONObjectProperty(
            by: { key: "citation" }
            failIfNonExistingKeyOrPath: false
          )
            @export(
              as: "originCorePullquoteCitationItems"
            )
    
          @underJSONObjectProperty(
            by: { key: "value" }
            failIfNonExistingKeyOrPath: false
          )
            @export(
              as: "originCorePullquoteValueItems"
            )
    
 
    originCoreAudio: blockFlattenedDataItems(
      filterBy: { include: "core/audio" }
    )
      @underEachArrayItem
        @underJSONObjectProperty(
          by: { path: "attributes.caption" }
          failIfNonExistingKeyOrPath: false
        )
          @export(
            as: "originCoreAudioCaptionItems"
          )
    
 
    originCoreVideo: blockFlattenedDataItems(
      filterBy: { include: "core/video" }
    )
      @underEachArrayItem
        @underJSONObjectProperty(
          by: { path: "attributes.caption" }
          failIfNonExistingKeyOrPath: false
        )
          @export(
            as: "originCoreVideoCaptionItems"
          )
    
 
    originCorePreformatted: blockFlattenedDataItems(
      filterBy: { include: "core/preformatted" }
    )
      @underEachArrayItem
        @underJSONObjectProperty(
          by: { path: "attributes.content" }
          failIfNonExistingKeyOrPath: false
        )
          @export(
            as: "originCorePreformattedContentItems"
          )
    
 
    originCoreEmbed: blockFlattenedDataItems(
      filterBy: { include: "core/embed" }
    )
      @underEachArrayItem
        @underJSONObjectProperty(
          by: { path: "attributes.caption" }
          failIfNonExistingKeyOrPath: false
        )
          @export(
            as: "originCoreEmbedCaptionItems"
          )
  }
}
 
query CombineConnectionData
  @depends(on: "ExportOriginPost")
  @include(if: $hasTranslationConnections)
{
  networkSiteTranslationConnectionDataItems: _arrayInnerJoinJSONObjectProperties(
    source: $networkSiteDataItems,
    target: $translationConnectionDataItems,
    index: "siteID"
  )
    @export(as: "networkSiteTranslationConnectionDataItems")
 
  executeTranslation: _notEmpty(value: $__networkSiteTranslationConnectionDataItems)
    @export(as: "executeTranslation")
}
 
query InitializeTranslationVariables
  @depends(on: "CombineConnectionData")
  @include(if: $executeTranslation)
{
  arrayItems: _arrayLength(array: $networkSiteTranslationConnectionDataItems)
 
  rawTitle: _arrayPad(array: [], length: $__arrayItems, value: $originRawTitle)
    @export(as: "rawTitle")
  rawContent: _arrayPad(array: [], length: $__arrayItems, value: $originRawContent)
    @export(as: "rawContent")
  rawExcerpt: _arrayPad(array: [], length: $__arrayItems, value: $originRawExcerpt)
    @export(as: "rawExcerpt")
    
  coreHeadingContentItems: _arrayPad(array: [], length: $__arrayItems, value: $originCoreHeadingContentItems)
    @export(as: "coreHeadingContentItems")
  coreHeadingContentReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCoreHeadingContentReplacementsFrom)
    @export(as: "coreHeadingContentReplacementsFrom")
  coreHeadingContentReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCoreHeadingContentReplacementsTo)
    @export(as: "coreHeadingContentReplacementsTo")
 
  coreParagraphContentItems: _arrayPad(array: [], length: $__arrayItems, value: $originCoreParagraphContentItems)
    @export(as: "coreParagraphContentItems")
  coreParagraphContentReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCoreParagraphContentReplacementsFrom)
    @export(as: "coreParagraphContentReplacementsFrom")
  coreParagraphContentReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCoreParagraphContentReplacementsTo)
    @export(as: "coreParagraphContentReplacementsTo")
 
  coreImageAltItems: _arrayPad(array: [], length: $__arrayItems, value: $originCoreImageAltItems)
    @export(as: "coreImageAltItems")
  coreImageAltReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCoreImageAltReplacementsFrom)
    @export(as: "coreImageAltReplacementsFrom")
  coreImageAltReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCoreImageAltReplacementsTo)
    @export(as: "coreImageAltReplacementsTo")
 
  coreImageCaptionItems: _arrayPad(array: [], length: $__arrayItems, value: $originCoreImageCaptionItems)
    @export(as: "coreImageCaptionItems")
  coreImageCaptionReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCoreImageCaptionReplacementsFrom)
    @export(as: "coreImageCaptionReplacementsFrom")
  coreImageCaptionReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCoreImageCaptionReplacementsTo)
    @export(as: "coreImageCaptionReplacementsTo")
 
  coreButtonTextItems: _arrayPad(array: [], length: $__arrayItems, value: $originCoreButtonTextItems)
    @export(as: "coreButtonTextItems")
  coreButtonTextReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCoreButtonTextReplacementsFrom)
    @export(as: "coreButtonTextReplacementsFrom")
  coreButtonTextReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCoreButtonTextReplacementsTo)
    @export(as: "coreButtonTextReplacementsTo")
 
  coreTableCaptionItems: _arrayPad(array: [], length: $__arrayItems, value: $originCoreTableCaptionItems)
    @export(as: "coreTableCaptionItems")
  coreTableCaptionReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCoreTableCaptionReplacementsFrom)
    @export(as: "coreTableCaptionReplacementsFrom")
  coreTableCaptionReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCoreTableCaptionReplacementsTo)
    @export(as: "coreTableCaptionReplacementsTo")
 
  coreTableBodyCellsContentItems: _arrayPad(array: [], length: $__arrayItems, value: $originCoreTableBodyCellsContentItems)
    @export(as: "coreTableBodyCellsContentItems")
  coreTableBodyCellsContentReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCoreTableBodyCellsContentReplacementsFrom)
    @export(as: "coreTableBodyCellsContentReplacementsFrom")
  coreTableBodyCellsContentReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCoreTableBodyCellsContentReplacementsTo)
    @export(as: "coreTableBodyCellsContentReplacementsTo")
 
  coreListItemContentItems: _arrayPad(array: [], length: $__arrayItems, value: $originCoreListItemContentItems)
    @export(as: "coreListItemContentItems")
  coreListItemContentReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCoreListItemContentReplacementsFrom)
    @export(as: "coreListItemContentReplacementsFrom")
  coreListItemContentReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCoreListItemContentReplacementsTo)
    @export(as: "coreListItemContentReplacementsTo")
 
  coreCoverAltItems: _arrayPad(array: [], length: $__arrayItems, value: $originCoreCoverAltItems)
    @export(as: "coreCoverAltItems")
  coreCoverAltReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCoreCoverAltReplacementsFrom)
    @export(as: "coreCoverAltReplacementsFrom")
  coreCoverAltReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCoreCoverAltReplacementsTo)
    @export(as: "coreCoverAltReplacementsTo")
 
  coreMediaTextAltItems: _arrayPad(array: [], length: $__arrayItems, value: $originCoreMediaTextAltItems)
    @export(as: "coreMediaTextAltItems")
  coreMediaTextAltReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCoreMediaTextAltReplacementsFrom)
    @export(as: "coreMediaTextAltReplacementsFrom")
  coreMediaTextAltReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCoreMediaTextAltReplacementsTo)
    @export(as: "coreMediaTextAltReplacementsTo")
 
  coreVerseContentItems: _arrayPad(array: [], length: $__arrayItems, value: $originCoreVerseContentItems)
    @export(as: "coreVerseContentItems")
  coreVerseContentReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCoreVerseContentReplacementsFrom)
    @export(as: "coreVerseContentReplacementsFrom")
  coreVerseContentReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCoreVerseContentReplacementsTo)
    @export(as: "coreVerseContentReplacementsTo")
 
  coreQuoteCitationItems: _arrayPad(array: [], length: $__arrayItems, value: $originCoreQuoteCitationItems)
    @export(as: "coreQuoteCitationItems")
  coreQuoteCitationReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCoreQuoteCitationReplacementsFrom)
    @export(as: "coreQuoteCitationReplacementsFrom")
  coreQuoteCitationReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCoreQuoteCitationReplacementsTo)
    @export(as: "coreQuoteCitationReplacementsTo")
 
  corePullquoteCitationItems: _arrayPad(array: [], length: $__arrayItems, value: $originCorePullquoteCitationItems)
    @export(as: "corePullquoteCitationItems")
  corePullquoteCitationReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCorePullquoteCitationReplacementsFrom)
    @export(as: "corePullquoteCitationReplacementsFrom")
  corePullquoteCitationReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCorePullquoteCitationReplacementsTo)
    @export(as: "corePullquoteCitationReplacementsTo")
 
  corePullquoteValueItems: _arrayPad(array: [], length: $__arrayItems, value: $originCorePullquoteValueItems)
    @export(as: "corePullquoteValueItems")
  corePullquoteValueReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCorePullquoteValueReplacementsFrom)
    @export(as: "corePullquoteValueReplacementsFrom")
  corePullquoteValueReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCorePullquoteValueReplacementsTo)
    @export(as: "corePullquoteValueReplacementsTo")
 
  coreAudioCaptionItems: _arrayPad(array: [], length: $__arrayItems, value: $originCoreAudioCaptionItems)
    @export(as: "coreAudioCaptionItems")
  coreAudioCaptionReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCoreAudioCaptionReplacementsFrom)
    @export(as: "coreAudioCaptionReplacementsFrom")
  coreAudioCaptionReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCoreAudioCaptionReplacementsTo)
    @export(as: "coreAudioCaptionReplacementsTo")
 
  coreVideoCaptionItems: _arrayPad(array: [], length: $__arrayItems, value: $originCoreVideoCaptionItems)
    @export(as: "coreVideoCaptionItems")
  coreVideoCaptionReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCoreVideoCaptionReplacementsFrom)
    @export(as: "coreVideoCaptionReplacementsFrom")
  coreVideoCaptionReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCoreVideoCaptionReplacementsTo)
    @export(as: "coreVideoCaptionReplacementsTo")
 
  corePreformattedContentItems: _arrayPad(array: [], length: $__arrayItems, value: $originCorePreformattedContentItems)
    @export(as: "corePreformattedContentItems")
  corePreformattedContentReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCorePreformattedContentReplacementsFrom)
    @export(as: "corePreformattedContentReplacementsFrom")
  corePreformattedContentReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCorePreformattedContentReplacementsTo)
    @export(as: "corePreformattedContentReplacementsTo")
 
  coreEmbedCaptionItems: _arrayPad(array: [], length: $__arrayItems, value: $originCoreEmbedCaptionItems)
    @export(as: "coreEmbedCaptionItems")
  coreEmbedCaptionReplacementsFrom: _arrayPad(array: [], length: $__arrayItems, value: $originCoreEmbedCaptionReplacementsFrom)
    @export(as: "coreEmbedCaptionReplacementsFrom")
  coreEmbedCaptionReplacementsTo: _arrayPad(array: [], length: $__arrayItems, value: $originCoreEmbedCaptionReplacementsTo)
    @export(as: "coreEmbedCaptionReplacementsTo")
 
    @remove
}
 
query AdaptData
  @depends(on: "InitializeTranslationVariables")
  @include(if: $executeTranslation)
{
  adaptedToTitle: _echo(value: $rawTitle)
    @underEachArrayItem(
      passValueOnwardsAs: "value"
    )
      @applyField(
        name: "_echo"
        arguments: {
          value: [$value]
        }
        setResultInResponse: true
      )
    @export(as: "adaptedToTitle")
  adaptedFromTitle: _echo(value: $rawTitle)
    @underEachArrayItem
      @applyField(
        name: "_echo"
        arguments: {
          value: [""]
        }
        setResultInResponse: true
      )
    @export(as: "adaptedFromTitle")
 
  adaptedToRawExcerpt: _echo(value: $rawExcerpt)
    @underEachArrayItem(
      passValueOnwardsAs: "value"
    )
      @applyField(
        name: "_echo"
        arguments: {
          value: [$value]
        }
        setResultInResponse: true
      )
    @export(as: "adaptedToRawExcerpt")
  adaptedFromRawExcerpt: _echo(value: $rawExcerpt)
    @underEachArrayItem
      @applyField(
        name: "_echo"
        arguments: {
          value: [""]
        }
        setResultInResponse: true
      )
    @export(as: "adaptedFromRawExcerpt")
}
 
query TransformData(
  $languageMapping: JSONObject! = {}
)
  @depends(on: "AdaptData")
  @include(if: $executeTranslation)
{
  transformations: _echo(value: {
    metaRawTitle: {
      from: $adaptedFromTitle,
      to: $adaptedToTitle,
    },
    metaRawExcerpt: {
      from: $adaptedFromRawExcerpt,
      to: $adaptedToRawExcerpt,
    },
    coreHeadingContent: {
      from: $coreHeadingContentItems,
      to: $coreHeadingContentItems,
    },
    coreParagraphContent: {
      from: $coreParagraphContentItems,
      to: $coreParagraphContentItems,
    },
    coreImageAlt: {
      from: $coreImageAltItems,
      to: $coreImageAltItems,
    },
    coreImageCaption: {
      from: $coreImageCaptionItems,
      to: $coreImageCaptionItems,
    },
    coreButtonText: {
      from: $coreButtonTextItems
      to: $coreButtonTextItems
    },
    coreTableCaption: {
      from: $coreTableCaptionItems,
      to: $coreTableCaptionItems,
    },
    coreTableBodyCellsContent: {
      from: $coreTableBodyCellsContentItems,
      to: $coreTableBodyCellsContentItems,
    },
    coreListItemContent: {
      from: $coreListItemContentItems,
      to: $coreListItemContentItems,
    },
    coreCoverAlt: {
      from: $coreCoverAltItems,
      to: $coreCoverAltItems,
    },
    coreMediaTextAlt: {
      from: $coreMediaTextAltItems,
      to: $coreMediaTextAltItems,
    },
    coreVerseContent: {
      from: $coreVerseContentItems,
      to: $coreVerseContentItems,
    },
    coreQuoteCitation: {
      from: $coreQuoteCitationItems,
      to: $coreQuoteCitationItems,
    },
    corePullquoteCitation: {
      from: $corePullquoteCitationItems,
      to: $corePullquoteCitationItems,
    },
    corePullquoteValue: {
      from: $corePullquoteValueItems,
      to: $corePullquoteValueItems,
    },
    coreAudioCaption: {
      from: $coreAudioCaptionItems,
      to: $coreAudioCaptionItems,
    },
    coreVideoCaption: {
      from: $coreVideoCaptionItems,
      to: $coreVideoCaptionItems,
    },
    corePreformattedContent: {
      from: $corePreformattedContentItems,
      to: $corePreformattedContentItems,
    },
    coreEmbedCaption: {
      from: $coreEmbedCaptionItems,
      to: $coreEmbedCaptionItems,
    },
  })
    @underEachJSONObjectProperty
      @underJSONObjectProperty(by: { key: "to" })
        @underEachArrayItem(
          passIndexOnwardsAs: "itemNumber"
          affectDirectivesUnderPos: [1, 2, 3, 4]
        )
          @applyField(
            name: "_arrayItem",
            arguments: {
              array: $networkSiteTranslationConnectionDataItems,
              position: $itemNumber
            },
            passOnwardsAs: "networkSiteTranslationConnectionDataItem"
          )
          @applyField(
            name: "_objectProperty",
            arguments: {
              object: $networkSiteTranslationConnectionDataItem,
              by: { key: "language" }
            },
            passOnwardsAs: "toLanguage"
          )
          @applyField(
            name: "_objectProperty",
            arguments: {
              object: $languageMapping,
              by: { key: $toLanguage }
              failIfNonExistingKeyOrPath: false
              valueWhenNonExistingKeyOrPath: $toLanguage
            },
            passOnwardsAs: "toLanguage"
          )
          @underEachArrayItem
            @strTranslate(
              from: $fromLanguage,
              to: $toLanguage
            )
    @export(as: "transformations")
}
 
query EscapeRegexStrings
  @depends(on: "TransformData")
  @include(if: $executeTranslation)
{  
  escapedRegexStrings: _echo(value: $transformations)
    @underEachJSONObjectProperty(
      filter: {
        by: {
          excludeKeys: [
            "metaRawTitle",
            "metaRawExcerpt"
          ]
        }
      }
    )
      @underJSONObjectProperty(by: { key: "from" })
        @underEachArrayItem
          @underEachArrayItem
            @strReplaceMultiple(
              search: [
                "’",
                "ñ",
 
                "\\",
                "^",
                "$",
                "|",
                "[",
                "]",
                "(",
                ")",
                "{",
                "{",
                "#",
                "?",
                ".",
                "*",
                "+"
              ],
              replaceWith: [
                "’",
                "ñ",
 
                "\\\\",
                "\\^",
                "\\$",
                "\\|",
                "\\[",
                "\\]",
                "\\(",
                "\\)",
                "\\{",
                "\\}",
                "\\#",
                "\\?",
                "\\.",
                "\\*",
                "\\+"
              ]
            )
    @underEachJSONObjectProperty(
      filter: {
        by: {
          excludeKeys: [
            "metaRawTitle",
            "metaRawExcerpt"
          ]
        }
      }
    )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @underEachArrayItem(
          affectDirectivesUnderPos: [1, 3]
        )
          @underEachArrayItem
            @strRegexReplace(
              searchRegex: "#\\$(\\d+)#",
              replaceWith: "\\\\\\$1"
            )
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "${1}%s${2}",
                values: [$value]
              },
              setResultInResponse: true
            )
    @export(as: "escapedRegexTransformations")
}
 
query CreateRegexReplacements
  @depends(on: "EscapeRegexStrings")
  @include(if: $executeTranslation)
{  
  regexReplacements: _echo(value: $escapedRegexTransformations)
    @underJSONObjectProperty(
      by: { key: "coreHeadingContent" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:heading .*?-->\\n?<h[1-6] ?.*?>)%s(</h[1-6]>\\n?<!-- /wp:heading -->)#",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "coreHeadingContentReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "coreHeadingContentReplacementsTo",
        )
 
 
    @underJSONObjectProperty(
      by: { key: "coreParagraphContent" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:paragraph .*?-->\\n?<p ?.*?>)%s(</p>\\n?<!-- /wp:paragraph -->)#",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "coreParagraphContentReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "coreParagraphContentReplacementsTo",
        )
  
  
    @underJSONObjectProperty(
      by: { key: "coreImageAlt" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:image .*?-->\\n?.*<img .*?alt=\\\")%s(\\\".*>.*\\n?<!-- /wp:image -->)#",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "coreImageAltReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "coreImageAltReplacementsTo",
        )
  
  
    @underJSONObjectProperty(
      by: { key: "coreImageCaption" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:image .*?-->\\n?.*<figcaption ?.*?>)%s(</figcaption>.*\\n?<!-- /wp:image -->)#",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "coreImageCaptionReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "coreImageCaptionReplacementsTo",
        )
  
  
    @underJSONObjectProperty(
      by: { key: "coreButtonText" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:button .*?-->\\n?.*<a ?.*?>)%s(</a>.*\\n?<!-- /wp:button -->)#",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "coreButtonTextReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "coreButtonTextReplacementsTo",
        )
  
  
    @underJSONObjectProperty(
      by: { key: "coreTableCaption" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:table .*?-->\\n?.*<figcaption ?.*?>.*)%s(.*</figcaption>.*\\n?<!-- /wp:table -->)#",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "coreTableCaptionReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "coreTableCaptionReplacementsTo",
        )
  
  
    @underJSONObjectProperty(
      by: { key: "coreTableBodyCellsContent" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:table .*?-->\\n?.*<table ?.*?>.*)%s(.*</table>.*\\n?<!-- /wp:table -->)#",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "coreTableBodyCellsContentReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "coreTableBodyCellsContentReplacementsTo",
        )
 
 
    @underJSONObjectProperty(
      by: { key: "coreListItemContent" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:list-item .*?-->\\n?<li ?.*?>)%s(</li>\\n?<!-- /wp:list-item -->)#",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "coreListItemContentReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "coreListItemContentReplacementsTo",
        )
 
 
    @underJSONObjectProperty(
      by: { key: "coreCoverAlt" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:cover .*?-->\\n?.*<img .*?alt=\\\")%s(\\\".*>.*\\n?<!-- /wp:cover -->)#",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "coreCoverAltReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "coreCoverAltReplacementsTo",
        )
 
 
    @underJSONObjectProperty(
      by: { key: "coreMediaTextAlt" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:media-text .*?-->\\n?<div .*><figure .*><img .*?alt=\\\")%s(\\\")#",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "coreMediaTextAltReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "coreMediaTextAltReplacementsTo",
        )
 
 
    @underJSONObjectProperty(
      by: { key: "coreVerseContent" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:verse .*?-->\\n?<pre ?.*?>)%s(</pre>\\n?<!-- /wp:verse -->)#",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "coreVerseContentReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "coreVerseContentReplacementsTo",
        )
 
 
    @underJSONObjectProperty(
      by: { key: "coreQuoteCitation" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:quote .*?-->\\n?<blockquote ?.*?>.*<cite ?.*?>)%s(</cite></blockquote>\\n?<!-- /wp:quote -->)#s",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "coreQuoteCitationReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "coreQuoteCitationReplacementsTo",
        )
 
 
    @underJSONObjectProperty(
      by: { key: "corePullquoteCitation" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:pullquote .*?-->\\n?<figure ?.*?><blockquote ?.*?><p ?.*?>.*</p><cite ?.*?>)%s(</cite></blockquote></figure>\\n?<!-- /wp:pullquote -->)#",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "corePullquoteCitationReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "corePullquoteCitationReplacementsTo",
        )
 
 
    @underJSONObjectProperty(
      by: { key: "corePullquoteValue" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:pullquote .*?-->\\n?<figure ?.*?><blockquote ?.*?><p ?.*?>)%s(</p>(?:<cite ?.*?>.*</cite>)?</blockquote></figure>\\n?<!-- /wp:pullquote -->)#",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "corePullquoteValueReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "corePullquoteValueReplacementsTo",
        )
 
 
    @underJSONObjectProperty(
      by: { key: "coreAudioCaption" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:audio .*?-->\\n?<figure ?.*?><audio ?.*?>.*</audio><figcaption ?.*?>)%s(</figcaption></figure>\\n?<!-- /wp:audio -->)#",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "coreAudioCaptionReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "coreAudioCaptionReplacementsTo",
        )
 
 
    @underJSONObjectProperty(
      by: { key: "coreVideoCaption" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:video .*?-->\\n?<figure ?.*?><video ?.*?>.*</video><figcaption ?.*?>)%s(</figcaption></figure>\\n?<!-- /wp:video -->)#",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "coreVideoCaptionReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "coreVideoCaptionReplacementsTo",
        )
 
 
    @underJSONObjectProperty(
      by: { key: "corePreformattedContent" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:preformatted .*?-->\\n?<pre ?.*?>)%s(</pre>\\n?<!-- /wp:preformatted -->)#",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "corePreformattedContentReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "corePreformattedContentReplacementsTo",
        )
 
 
    @underJSONObjectProperty(
      by: { key: "coreEmbedCaption" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachArrayItem
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:embed .*?-->\\n?<figure ?.*?><div ?.*?>.*</div><figcaption ?.*?>)%s(</figcaption></figure>\\n?<!-- /wp:embed -->)#s",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "coreEmbedCaptionReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "coreEmbedCaptionReplacementsTo",
        )
}
 
query ExecuteRegexReplacements
  @depends(on: "CreateRegexReplacements")
  @include(if: $executeTranslation)
{
  transformedRawContent: _echo(value: $rawContent)
    @underEachArrayItem(
      passIndexOnwardsAs: "itemNumber"
      affectDirectivesUnderPos: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54]
    )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreHeadingContentReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreHeadingContentReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreHeadingContentReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreHeadingContentReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCoreHeadingContentReplacementsFrom,
        replaceWith: $postCoreHeadingContentReplacementsTo
      )
    
    
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreParagraphContentReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreParagraphContentReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreParagraphContentReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreParagraphContentReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCoreParagraphContentReplacementsFrom,
        replaceWith: $postCoreParagraphContentReplacementsTo
      )
    
    
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreImageAltReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreImageAltReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreImageAltReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreImageAltReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCoreImageAltReplacementsFrom,
        replaceWith: $postCoreImageAltReplacementsTo
      )
    
    
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreImageCaptionReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreImageCaptionReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreImageCaptionReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreImageCaptionReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCoreImageCaptionReplacementsFrom,
        replaceWith: $postCoreImageCaptionReplacementsTo
      )
    
    
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreButtonTextReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreButtonTextReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreButtonTextReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreButtonTextReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCoreButtonTextReplacementsFrom,
        replaceWith: $postCoreButtonTextReplacementsTo
      )
    
    
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreTableCaptionReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreTableCaptionReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreTableCaptionReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreTableCaptionReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCoreTableCaptionReplacementsFrom,
        replaceWith: $postCoreTableCaptionReplacementsTo
      )
    
    
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreTableBodyCellsContentReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreTableBodyCellsContentReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreTableBodyCellsContentReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreTableBodyCellsContentReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCoreTableBodyCellsContentReplacementsFrom,
        replaceWith: $postCoreTableBodyCellsContentReplacementsTo
      )
    
    
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreListItemContentReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreListItemContentReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreListItemContentReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreListItemContentReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCoreListItemContentReplacementsFrom,
        replaceWith: $postCoreListItemContentReplacementsTo
      )
    
    
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreCoverAltReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreCoverAltReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreCoverAltReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreCoverAltReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCoreCoverAltReplacementsFrom,
        replaceWith: $postCoreCoverAltReplacementsTo
      )
    
    
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreMediaTextAltReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreMediaTextAltReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreMediaTextAltReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreMediaTextAltReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCoreMediaTextAltReplacementsFrom,
        replaceWith: $postCoreMediaTextAltReplacementsTo
      )
    
    
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreVerseContentReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreVerseContentReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreVerseContentReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreVerseContentReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCoreVerseContentReplacementsFrom,
        replaceWith: $postCoreVerseContentReplacementsTo
      )
    
    
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreQuoteCitationReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreQuoteCitationReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreQuoteCitationReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreQuoteCitationReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCoreQuoteCitationReplacementsFrom,
        replaceWith: $postCoreQuoteCitationReplacementsTo
      )
    
    
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $corePullquoteCitationReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCorePullquoteCitationReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $corePullquoteCitationReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCorePullquoteCitationReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCorePullquoteCitationReplacementsFrom,
        replaceWith: $postCorePullquoteCitationReplacementsTo
      )
    
    
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $corePullquoteValueReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCorePullquoteValueReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $corePullquoteValueReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCorePullquoteValueReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCorePullquoteValueReplacementsFrom,
        replaceWith: $postCorePullquoteValueReplacementsTo
      )
    
    
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreAudioCaptionReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreAudioCaptionReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreAudioCaptionReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreAudioCaptionReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCoreAudioCaptionReplacementsFrom,
        replaceWith: $postCoreAudioCaptionReplacementsTo
      )
    
    
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreVideoCaptionReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreVideoCaptionReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreVideoCaptionReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreVideoCaptionReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCoreVideoCaptionReplacementsFrom,
        replaceWith: $postCoreVideoCaptionReplacementsTo
      )
    
    
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $corePreformattedContentReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCorePreformattedContentReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $corePreformattedContentReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCorePreformattedContentReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCorePreformattedContentReplacementsFrom,
        replaceWith: $postCorePreformattedContentReplacementsTo
      )
    
    
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreEmbedCaptionReplacementsFrom,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreEmbedCaptionReplacementsFrom"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $coreEmbedCaptionReplacementsTo,
          position: $itemNumber
        },
        passOnwardsAs: "postCoreEmbedCaptionReplacementsTo"
      )
      @strRegexReplaceMultiple(
        limit: 1,
        searchRegex: $postCoreEmbedCaptionReplacementsFrom,
        replaceWith: $postCoreEmbedCaptionReplacementsTo
      )
    
    @export(as: "transformedRawContent")
}
 
query PrepareMetaReplacements
  @depends(on: "TransformData")
  @include(if: $executeTranslation)
{
  transformedMetaTitle: _echo(value: $rawTitle)
    @underEachArrayItem(
      passIndexOnwardsAs: "itemNumber"
      affectDirectivesUnderPos: [1, 2, 3]
    )
      @applyField(
        name: "_objectProperty",
        arguments: {
          object: $transformations
          by: { path: "metaRawTitle.to" }
        }
        passOnwardsAs: "transformedPostTitleItem"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $transformedPostTitleItem
          position: $itemNumber
        }
        passOnwardsAs: "transformedPostTitleAsArray"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $transformedPostTitleAsArray
          position: 0
        }
        setResultInResponse: true
      )
    @export(
      as: "transformedRawTitle"
    )
 
  transformedMetaRawExcerpt: _echo(value: $rawExcerpt)
    @underEachArrayItem(
      passIndexOnwardsAs: "itemNumber"
      affectDirectivesUnderPos: [1, 2, 3]
    )
      @applyField(
        name: "_objectProperty",
        arguments: {
          object: $transformations
          by: { path: "metaRawExcerpt.to" }
        }
        passOnwardsAs: "transformedPostExcerptItem"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $transformedPostExcerptItem
          position: $itemNumber
        }
        passOnwardsAs: "transformedPostExcerptAsArray"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $transformedPostExcerptAsArray
          position: 0
        }
        setResultInResponse: true
      )
    @export(
      as: "transformedRawExcerpt"
    )
}
 
query ExportMutationInputs(
  $updateSlug: Boolean! = true
)
  @depends(on: [
    "ExecuteRegexReplacements",
    "PrepareMetaReplacements"
  ])
  @include(if: $executeTranslation)
{
  updatePostMutationInputDataItems: _echo(value: $networkSiteTranslationConnectionDataItems)
    @underEachArrayItem(
      passIndexOnwardsAs: "itemNumber"
      passValueOnwardsAs: "networkSiteTranslationConnectionDataItem"
      affectDirectivesUnderPos: [1, 2, 3, 4, 5, 6, 7]
    )
      @applyField(
        name: "_objectProperty",
        arguments: {
          object: $networkSiteTranslationConnectionDataItem,
          by: { key: "endpoint" }
        },
        passOnwardsAs: "itemEndpoint"
      )
      @applyField(
        name: "_objectProperty",
        arguments: {
          object: $networkSiteTranslationConnectionDataItem,
          by: { key: "postID" }
        },
        passOnwardsAs: "itemPostID"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $transformedRawContent,
          position: $itemNumber
        },
        passOnwardsAs: "itemTransformedRawContent"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $transformedRawTitle,
          position: $itemNumber
        },
        passOnwardsAs: "itemTransformedRawTitle"
      )
      @applyField(
        name: "_if",
        arguments: {
          condition: $updateSlug,
          then: $itemTransformedRawTitle,
          else: null
        },
        passOnwardsAs: "itemTransformedSlug"
      )
      @applyField(
        name: "_arrayItem",
        arguments: {
          array: $transformedRawExcerpt,
          position: $itemNumber
        },
        passOnwardsAs: "itemTransformedRawExcerpt"
      )
      @applyField(
        name: "_echo"
        arguments: {
          value: {
            endpoint: $itemEndpoint,
            input: {
              id: $itemPostID,
              title: $itemTransformedRawTitle,
              slug: $itemTransformedSlug,
              excerpt: $itemTransformedRawExcerpt,
              contentAs: {
                html: $itemTransformedRawContent
              }
            }
          }
        }
        setResultInResponse: true
      )
    @export(
      as: "updatePostMutationInputDataItems"
    )
}
 
mutation UpdatePagesWithTranslationOnExternalSite
  @depends(on: "ExportMutationInputs")
  @include(if: $executeTranslation)
{
  updateExternalSitePageHTTPRequests: _echo(value: $updatePostMutationInputDataItems)
    @underEachArrayItem(
      passValueOnwardsAs: "mutationInputDataItem"
      affectDirectivesUnderPos: [1, 2, 3]
    )
      @applyField(
        name: "_objectProperty",
        arguments: {
          object: $mutationInputDataItem,
          by: { key: "endpoint" }
        },
        passOnwardsAs: "endpoint"
      )
      @applyField(
        name: "_objectProperty",
        arguments: {
          object: $mutationInputDataItem,
          by: { key: "input" }
        },
        passOnwardsAs: "input"
      )
      @applyField(
        name: "_sendGraphQLHTTPRequest"
        arguments: {
          input: {
            endpoint: $endpoint,
            query: """
          
mutation UpdatePostFromMasterSite($input: JSONObject!) {
  updatePost(input: $input) {
    status
    errors {
      __typename
      ...on ErrorPayload {
        message
      }
    }
    post {
      id
      slug
      title
      content
      status
      excerpt
    }
  }
}
 
            """,
            variables: [
              {
                name: "input",
                value: $input
              }
            ],
            options: {
              headers: [
                {
                  name: "Authorization",
                  value: $authorizationHeaderValue
                }
              ]
            }
          }
        },
        setResultInResponse: true
      )
}