function translateElemValue(elem, translate) {
  if (!elem.innerText) {
    return elem.innerHTML;
  }

  const elemValue = elem.innerText.replace(Evaluator.templateSettings.interpolate, '').replace(/\s\s+/g, ' ').trim();
  const translatedValue = translate(elemValue);

  if (elemValue !== translatedValue) {
    const links = elem.innerHTML.match(/<a[^>]*>(.*?)<\/a>/g);

    if (links && links.length) {
      if (links.length === 1 && links[0].length === elem.innerHTML.length) {
        return elem.innerHTML.replace(elemValue, translatedValue);
      }

      const translatedLinks = links.map(link => {
        const linkElem = document.createElement('a');
        linkElem.innerHTML = link;
        return translateElemValue(linkElem, translate);
      });

      return `${translatedValue} (${translatedLinks.join(', ')})`;
    }
    else {
      return elem.innerText.replace(elemValue, translatedValue);
    }
  }
  else {
    return elem.innerHTML;
  }
}
Helper function for 'translateHTMLTemplate'. Translates text value of the passed html element.
@param {HTMLElement} elem - The element to translate.
@param {Function} translate - The translation function.
@returns {string} - Translated element template.