mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix: comment dictionary with submodule (#55527)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
@@ -8,6 +8,7 @@ client/config/browser-scripts/*.json
|
||||
client/static
|
||||
curriculum/challenges/_meta/*/*
|
||||
curriculum/challenges/**/*
|
||||
curriculum/i18n-curriculum
|
||||
docs/**/*.md
|
||||
/playwright
|
||||
pnpm-lock.yaml
|
||||
|
||||
@@ -45,11 +45,11 @@ const COMMENT_TRANSLATIONS = createCommentMap(
|
||||
);
|
||||
|
||||
function createCommentMap(dictionariesDir, englishDictionariesDir) {
|
||||
// get all the languages for which there are dictionaries. Note: this has to
|
||||
// include the english dictionaries since translateCommentsInChallenge treats
|
||||
// all languages equally and will simply remove comments if there is no entry
|
||||
// in the comment map.
|
||||
const languages = fs.readdirSync(dictionariesDir);
|
||||
// get all the languages for which there are dictionaries. Note: the english
|
||||
// entries are created separately, so we remove it from languages.
|
||||
const languages = fs
|
||||
.readdirSync(dictionariesDir)
|
||||
.filter(lang => lang !== 'english'); // TODO: Remove the filter after migrating to i18n-curriculum
|
||||
|
||||
// get all their dictionaries
|
||||
const dictionaries = languages.reduce(
|
||||
@@ -101,7 +101,15 @@ function createCommentMap(dictionariesDir, englishDictionariesDir) {
|
||||
};
|
||||
}, {});
|
||||
|
||||
return { ...translatedCommentMap, ...untranslatableCommentMap };
|
||||
const allComments = { ...translatedCommentMap, ...untranslatableCommentMap };
|
||||
|
||||
// the english entries need to be added here, because english is not in
|
||||
// languages
|
||||
Object.keys(allComments).forEach(comment => {
|
||||
allComments[comment].english = comment;
|
||||
});
|
||||
|
||||
return allComments;
|
||||
}
|
||||
|
||||
exports.createCommentMap = createCommentMap;
|
||||
|
||||
Submodule curriculum/i18n-curriculum updated: 531d189f02...6659d0702a
Reference in New Issue
Block a user