feat: i18n user interface (#40306)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
} from 'redux-saga/effects';
|
||||
import { channel } from 'redux-saga';
|
||||
import escape from 'lodash/escape';
|
||||
import i18next from 'i18next';
|
||||
|
||||
import {
|
||||
challengeDataSelector,
|
||||
@@ -67,7 +68,7 @@ export function* executeChallengeSaga() {
|
||||
|
||||
try {
|
||||
yield put(initLogs());
|
||||
yield put(initConsole('// running tests'));
|
||||
yield put(initConsole(i18next.t('learn.running-tests')));
|
||||
// reset tests to initial state
|
||||
const tests = (yield select(challengeTestsSelector)).map(
|
||||
({ text, testString }) => ({ text, testString })
|
||||
@@ -94,8 +95,8 @@ export function* executeChallengeSaga() {
|
||||
const testResults = yield executeTests(testRunner, tests);
|
||||
|
||||
yield put(updateTests(testResults));
|
||||
yield put(updateConsole('// tests completed'));
|
||||
yield put(logsToConsole('// console output'));
|
||||
yield put(updateConsole(i18next.t('learn.tests-completed')));
|
||||
yield put(logsToConsole(i18next.t('learn.console-output')));
|
||||
} catch (e) {
|
||||
yield put(updateConsole(e));
|
||||
} finally {
|
||||
@@ -205,6 +206,7 @@ function* previewChallengeSaga({ flushLogs = true } = {}) {
|
||||
}
|
||||
} catch (err) {
|
||||
if (err === 'timeout') {
|
||||
// TODO: translate the error
|
||||
// eslint-disable-next-line no-ex-assign
|
||||
err = `The code you have written is taking longer than the ${previewTimeout}ms our challenges allow. You may have created an infinite loop or need to write a more efficient algorithm`;
|
||||
}
|
||||
|
Reference in New Issue
Block a user