Skip to content

Commit

Permalink
chore: rework the language audits for build (freeCodeCamp#42510)
Browse files Browse the repository at this point in the history
This also reverts commit cd5c28b.
  • Loading branch information
raisedadead authored Jun 15, 2021
1 parent 863c706 commit a378bc6
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 31 deletions.
2 changes: 1 addition & 1 deletion client/src/components/Map/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { generateIconComponent } from '../../assets/icons';
import { Link, Spacer } from '../helpers';
import LinkButton from '../../assets/icons/LinkButton';
import './map.css';
import { isAuditedCert } from '../../../../config/is-audited';
import { isAuditedCert } from '../../../../utils/is-audited';
import envData from '../../../../config/env.json';

const { curriculumLocale } = envData;
Expand Down
2 changes: 1 addition & 1 deletion client/src/templates/Introduction/components/Block.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Challenges from './Challenges';
import Caret from '../../../assets/icons/Caret';
import GreenPass from '../../../assets/icons/GreenPass';
import GreenNotCompleted from '../../../assets/icons/GreenNotCompleted';
import { isAuditedCert } from '../../../../../config/is-audited';
import { isAuditedCert } from '../../../../../utils/is-audited';
import envData from '../../../../../config/env.json';
import { Link } from '../../../components/helpers/';

Expand Down
48 changes: 47 additions & 1 deletion config/i18n/all-langs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
/* An error will be thrown if the CLIENT_LOCALE and CURRICULUM_LOCALE variables
// ---------------------------------------------------------------------------

/*
* List of languages with localizations enabled for builds.
*
* Client is the UI, and Curriculum is the Challenge Content.
*
* An error will be thrown if the CLIENT_LOCALE and CURRICULUM_LOCALE variables
* from the .env file aren't found in their respective arrays below
*/
const availableLangs = {
Expand All @@ -13,6 +20,44 @@ const availableLangs = {
]
};

/*
* List of certifications with localization enabled in their world language.
*
* These certifications have been approved 100% on Crowdin at least during
* their launch, and hence meet the QA standard to be published live. Other
* certifications which have not been audited & approved will fallback to
* English equivalent.
*/
const auditedCerts = {
espanol: [
'responsive-web-design',
'javascript-algorithms-and-data-structures'
],
chinese: [
'responsive-web-design',
'javascript-algorithms-and-data-structures',
'front-end-libraries',
'data-visualization',
'apis-and-microservices',
'quality-assurance'
],
'chinese-traditional': [
'responsive-web-design',
'javascript-algorithms-and-data-structures',
'front-end-libraries',
'data-visualization',
'apis-and-microservices',
'quality-assurance'
],
italian: [
'responsive-web-design',
'javascript-algorithms-and-data-structures'
],
portuguese: ['responsive-web-design']
};

// ---------------------------------------------------------------------------

// Each client language needs an entry in the rest of the variables below

/* These strings set the i18next language. It needs to be the two character
Expand Down Expand Up @@ -55,3 +100,4 @@ exports.availableLangs = availableLangs;
exports.i18nextCodes = i18nextCodes;
exports.langDisplayNames = langDisplayNames;
exports.langCodes = langCodes;
exports.auditedCerts = auditedCerts;
2 changes: 1 addition & 1 deletion curriculum/getChallenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const {
} = require('../tools/challenge-parser/translation-parser');
/* eslint-enable max-len*/

const { isAuditedCert } = require('../config/is-audited');
const { isAuditedCert } = require('../utils/is-audited');
const { dasherize } = require('../utils/slugs');
const { createPoly } = require('../utils/polyvinyl');
const { helpCategoryMap } = require('../client/utils/challengeTypes');
Expand Down
2 changes: 1 addition & 1 deletion curriculum/test/test-challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const path = require('path');
const liveServer = require('live-server');
const stringSimilarity = require('string-similarity');
const { isAuditedCert } = require('../../config/is-audited');
const { isAuditedCert } = require('../../utils/is-audited');

const spinner = require('ora')();

Expand Down
27 changes: 1 addition & 26 deletions config/is-audited.js → utils/is-audited.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,7 @@
// translated, but when they are they can be included by adding 'certificates'
// to the arrays below

const auditedCerts = {
espanol: [
'responsive-web-design',
'javascript-algorithms-and-data-structures'
],
chinese: [
'responsive-web-design',
'javascript-algorithms-and-data-structures',
'front-end-libraries',
'data-visualization',
'apis-and-microservices',
'quality-assurance'
],
'chinese-traditional': [
'responsive-web-design',
'javascript-algorithms-and-data-structures',
'front-end-libraries',
'data-visualization',
'apis-and-microservices',
'quality-assurance'
],
italian: [
'responsive-web-design',
'javascript-algorithms-and-data-structures'
]
};
const { auditedCerts } = require('../config/i18n/all-langs');

function isAuditedCert(lang, cert) {
if (!lang || !cert)
Expand Down

0 comments on commit a378bc6

Please sign in to comment.