export function applyTranslation()

in src/contentScripts/functions.ts [278:291]


export function applyTranslation(nodeMap: NodeMap, pages: string[]): void {
  // Loop over each
  pages.forEach(page => {
    let [id, text] = page.split(':');
    // This is a workaround for an Amazon Translate bug that occasionally returns the wrong colon
    if (id === undefined || text === undefined) {
      [id, text] = page.split(':');
    }
    const node = nodeMap[Number(id)];
    if (node) {
      node.textContent = text;
    }
  });
}