refactor: tidy up translation-parser
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
9ff3a29a72
commit
73c06a5d71
@ -8,7 +8,7 @@ const util = require('util');
|
|||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
const {
|
const {
|
||||||
translateCommentsInChallenge
|
translateCommentsInChallenge
|
||||||
} = require('../tools/challenge-parser/translation-parser/translation-parser');
|
} = require('../tools/challenge-parser/translation-parser');
|
||||||
/* eslint-enable max-len*/
|
/* eslint-enable max-len*/
|
||||||
|
|
||||||
const { isAuditedCert } = require('../utils/is-audited');
|
const { isAuditedCert } = require('../utils/is-audited');
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
const { isEmpty } = require('lodash');
|
const { isEmpty, cloneDeep } = require('lodash');
|
||||||
const clone = require('lodash/cloneDeep');
|
|
||||||
|
|
||||||
exports.translateComments = (text, lang, dict, codeLang) => {
|
exports.translateComments = (text, lang, dict, codeLang) => {
|
||||||
const knownComments = Object.keys(dict);
|
const knownComments = Object.keys(dict);
|
||||||
@ -16,7 +15,7 @@ exports.translateComments = (text, lang, dict, codeLang) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.translateCommentsInChallenge = (challenge, lang, dict) => {
|
exports.translateCommentsInChallenge = (challenge, lang, dict) => {
|
||||||
const challClone = clone(challenge);
|
const challClone = cloneDeep(challenge);
|
||||||
if (!challClone.files) {
|
if (!challClone.files) {
|
||||||
console.warn(`Challenge ${challClone.title} has no comments to translate`);
|
console.warn(`Challenge ${challClone.title} has no comments to translate`);
|
||||||
} else {
|
} else {
|
@ -3,7 +3,7 @@ const {
|
|||||||
mergeChallenges,
|
mergeChallenges,
|
||||||
translateComments,
|
translateComments,
|
||||||
translateCommentsInChallenge
|
translateCommentsInChallenge
|
||||||
} = require('./translation-parser');
|
} = require('.');
|
||||||
const {
|
const {
|
||||||
ENGLISH_CERTIFICATE,
|
ENGLISH_CERTIFICATE,
|
||||||
ENGLISH_CHALLENGE,
|
ENGLISH_CHALLENGE,
|
Reference in New Issue
Block a user