in index.js [471:497]
async function translateIssue(context, createdIssue) {
if (!createdIssue) {
return;
}
const {
title, body,
translatedTitle, translatedBody
} = createdIssue;
const titleNeedsTranslation = translatedTitle && translatedTitle[0] !== title;
const bodyNeedsTranslation = translatedBody && translatedBody[0] !== removeHTMLComment(body);
const needsTranslation = titleNeedsTranslation || bodyNeedsTranslation;
logger.info('issue needs translation: ' + needsTranslation);
// translate the issue if needed
if (needsTranslation) {
const translateTip = replaceAll(
text.ISSUE_COMMENT_TRANSLATE_TIP,
'AT_ISSUE_AUTHOR',
'@' + createdIssue.issue.user.login
);
const translateComment = `${translateTip}\n<details><summary><b>TRANSLATED</b></summary><br>${titleNeedsTranslation ? '\n\n**TITLE**\n\n' + translatedTitle[0] : ''}${bodyNeedsTranslation ? '\n\n**BODY**\n\n' + fixMarkdown(translatedBody[0]) : ''}\n</details>`;
await commentIssue(context, translateComment);
}
}