diff --git a/curriculum/getChallenges.js b/curriculum/getChallenges.js index 1e944be8893..d1dab90be02 100644 --- a/curriculum/getChallenges.js +++ b/curriculum/getChallenges.js @@ -113,17 +113,12 @@ async function buildCurriculum(file, curriculum) { async function parseTranslation(engPath, transPath, dict) { const engChal = await parseMarkdown(engPath); const translatedChal = await parseMarkdown(transPath); - const codeLang = - engChal.files && engChal.files[0] ? engChal.files[0].ext : null; - const engWithTranslatedComments = codeLang - ? translateCommentsInChallenge( - engChal, - getChallengeLang(transPath), - dict, - codeLang - ) - : engChal; + const engWithTranslatedComments = translateCommentsInChallenge( + engChal, + getChallengeLang(transPath), + dict + ); return mergeChallenges(engWithTranslatedComments, translatedChal); } diff --git a/tools/challenge-md-parser/translation-parser/translation-parser.js b/tools/challenge-md-parser/translation-parser/translation-parser.js index 4c5756019c0..614f4e0fbfb 100644 --- a/tools/challenge-md-parser/translation-parser/translation-parser.js +++ b/tools/challenge-md-parser/translation-parser/translation-parser.js @@ -15,17 +15,19 @@ exports.translateComments = (text, lang, dict, codeLang) => { } }; -exports.translateCommentsInChallenge = (challenge, lang, dict, codeLang) => { +exports.translateCommentsInChallenge = (challenge, lang, dict) => { const challClone = clone(challenge); - if (challClone.files[0] && challClone.files[0].contents) { - challClone.files[0].contents = this.translateComments( - challenge.files[0].contents, - lang, - dict, - codeLang - ); - } + Object.keys(challClone.files).forEach(key => { + if (challClone.files[key].contents) { + challClone.files[key].contents = this.translateComments( + challenge.files[key].contents, + lang, + dict, + challClone.files[key].ext + ); + } + }); return challClone; };