Skip to content

Commit 2bb7904

Browse files
committed
refactor: Fix temporary translation hook standin
1 parent 5dafe52 commit 2bb7904

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/components/controllers/tutorial/index.jsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import { TutorialContext, SolutionContext } from './contexts';
1313
import { parseStackTrace } from '../repl/errors';
1414
import cx from '../../../lib/cx';
1515
import { CodeEditor, Runner, ErrorOverlay, Splitter } from '../../routes';
16+
import { useTranslation } from '../../../lib/i18n.jsx';
1617
import { MarkdownRegion } from '../markdown-region';
1718
import style from './style.module.css';
18-
import englishTranslations from '../../../locales/en.json';
1919

2020
const resultHandlers = new Set();
2121
const realmHandlers = new Set();
@@ -215,11 +215,16 @@ export function Tutorial({ html, meta }) {
215215
}
216216

217217
function ButtonContainer({ meta, showCode, help }) {
218+
const previousPage = useTranslation('previousPage');
219+
const nextPage = useTranslation('nextPage');
220+
const solve = useTranslation('solve');
221+
const tutorialBegin = useTranslation('beginTutorial');
222+
218223
return (
219224
<div class={style.buttonContainer}>
220225
{meta.prev && (
221226
<a class={style.prevButton} href={meta.prev}>
222-
{englishTranslations.previous}
227+
{previousPage}
223228
</a>
224229
)}
225230
{meta.solvable && (
@@ -229,14 +234,12 @@ function ButtonContainer({ meta, showCode, help }) {
229234
disabled={!showCode}
230235
title="Show solution to this example"
231236
>
232-
{englishTranslations.tutorial.solve}
237+
{solve}
233238
</button>
234239
)}
235240
{meta.next && (
236241
<a class={style.nextButton} href={meta.next}>
237-
{meta.code == false
238-
? englishTranslations.tutorial.begin
239-
: englishTranslations.next}
242+
{meta.code == false ? tutorialBegin : nextPage}
240243
</a>
241244
)}
242245
</div>

0 commit comments

Comments
 (0)