fix: run comment translation logic on english builds (#48520)

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Naomi Carrigan
2023-01-09 22:56:54 +05:30
committed by GitHub
co-authored by Oliver Eyton-Williams
parent a4795b41c3
commit af65859ff8
+9 -11
View File
@@ -34,9 +34,7 @@ const COMMENT_TRANSLATIONS = createCommentMap(
function createCommentMap(dictionariesDir) {
// get all the languages for which there are dictionaries.
const languages = fs
.readdirSync(dictionariesDir)
.filter(x => x !== 'english');
const languages = fs.readdirSync(dictionariesDir);
// get all their dictionaries
const dictionaries = languages.reduce(
@@ -363,18 +361,18 @@ Challenges that have been already audited cannot fall back to their English vers
await validate(filePath, meta.superBlock);
const useEnglish =
lang === 'english' ||
!isAuditedCert(lang, meta.superBlock) ||
!fs.existsSync(getFullPath(lang, filePath));
// We always try to translate comments (even English ones) to confirm that translations exist.
const translateComments =
isAuditedCert(lang, meta.superBlock) &&
fs.existsSync(getFullPath(lang, filePath));
const challenge = await (useEnglish
? parseMD(getFullPath('english', filePath))
: parseTranslation(
const challenge = await (translateComments
? parseTranslation(
getFullPath(lang, filePath),
COMMENT_TRANSLATIONS,
lang
));
)
: parseMD(getFullPath('english', filePath)));
addMetaToChallenge(challenge, meta);