mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-22 21:08:12 +08:00
fix: run comment translation logic on english builds (#48520)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
parent
a4795b41c3
commit
af65859ff8
@ -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);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user