function translateKey(key, lang) {
  if(null == lang) lang = getLang();
  // This check is more performant then always processing all Keys.
  if(EscapedLangDict[lang] === undefined) {
    if (Object.keys(HMIdentifier[lang]).length === 0 ||
        Object.keys(langJSON[lang]).length === 0) {
      loadTextResource();
    } else {
      EscapedLangDict[lang] = {};
    }
    var text = langJSON[lang][key];
    if(text === undefined) text = key;
    return unescape(text);
  }
  
  // Check if we already have an escaped variant of the ressource
  if(EscapedLangDict[lang][key] !== undefined) {
    return EscapedLangDict[lang][key];
  }

  // Get ressource, escape and cach it
  var keyText = langJSON[lang][key];
  if(keyText === undefined) keyText = key;
  var result = unescape(keyText);
  EscapedLangDict[lang][key] = result;
  return result;
}
Translates a single key
@param {string} key The key to translate
@return {*} The translated key