chore: rework the language audits for build (#42510)

This also reverts commit cd5c28b332.
This commit is contained in:
Mrugesh Mohapatra
2021-06-15 23:07:52 +05:30
committed by GitHub
parent 863c706440
commit a378bc6dd4
6 changed files with 52 additions and 31 deletions

View File

@@ -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 = {
@@ -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
@@ -55,3 +100,4 @@ exports.availableLangs = availableLangs;
exports.i18nextCodes = i18nextCodes;
exports.langDisplayNames = langDisplayNames;
exports.langCodes = langCodes;
exports.auditedCerts = auditedCerts;

View File

@@ -1,45 +0,0 @@
// this can go once all certs have been audited.
// Currently the auditing is going through Crowdin, so once a cert has been 100%
// proofread, we can add it in here. That means that translations can come
// through from Crowdin whenever they are done, but we don't show them on the
// client until we decide the entire cert is ready.
// NOTE: certificates themselves (.yml files) are not currently being
// 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'
]
};
function isAuditedCert(lang, cert) {
if (!lang || !cert)
throw Error('Both arguments must be provided for auditing');
return lang === 'english' || auditedCerts[lang].includes(cert);
}
exports.isAuditedCert = isAuditedCert;