text: import React from 'react';
  import { Link as GatsbyLink } from 'gatsby';
  import { DEF_LANG } from '../config';
  import {injectIntl} from 'gatsby-plugin-intl';
  // Since DOM elements <a> cannot receive activeClassName
  // and partiallyActive, destructure the prop here and
  // pass it only to GatsbyLink
  const Link = ({ children, to, activeClassName, partiallyActive,intl, ...other }) => {
    // Tailor the following test to your environment.
    // This example assumes that any internal link (intended for Gatsby)
    // will start with exactly one slash, and that anything else is external.
    const internal = /^\/(?!\/)/.test(to);
    const {locale} = intl;
    to = locale === DEF_LANG  || !internal ? to : '/en' + to;
    // Use Gatsby Link for internal links, and <a> for others
    if (internal) {
      return (
        <GatsbyLink
          to={to}
          activeClassName={activeClassName}
          partiallyActive={partiallyActive}
          {...other}
        >
          {children}
        </GatsbyLink>
      )
    }
    return (
      <a href={to} {...other}>
        {children}
      </a>
    )
  };
  
  export default injectIntl(Link);
  