text: import React from 'react'
  import PropTypes from 'prop-types'
  import { StaticQuery, graphql } from 'gatsby'
  import Language from '@input-output-hk/front-end-core-components/components/Language'
  
  const NotFoundPageQuery = ({ render }) => (
    <Language.Consumer>
      {({ key: lang }) => (
        <StaticQuery
          query={graphql`
            query {
              allFile(filter:{relativePath:{glob:"content/pages/404/*.md"}}) {
                nodes{
                  relativePath,
                  childMarkdownRemark{
                    frontmatter {
                      content {
                        title
                        body_content
                      }
                    }
                  }
                }
              }
            }
          `}
          render={({ allFile }) => {
            const content = allFile.nodes.filter(node => node.relativePath === `content/pages/404/404-${lang}.md`).shift()
            if (!content || !content.childMarkdownRemark) throw new Error(`No 404 translations found for language ${lang}`)
            return render(content.childMarkdownRemark.frontmatter.content)
          }}
        />
      )}
    </Language.Consumer>
  )
  
  NotFoundPageQuery.propTypes = {
    render: PropTypes.func.isRequired
  }
  
  export default NotFoundPageQuery
  