@@ -13,10 +13,9 @@ import { TutorialContext, SolutionContext } from './contexts';
1313import { parseStackTrace } from '../repl/errors' ;
1414import cx from '../../../lib/cx' ;
1515import { CodeEditor , Runner , ErrorOverlay , Splitter } from '../../routes' ;
16- import { useLanguage } from '../../../lib/i18n' ;
17- import config from '../../../config.json' ;
1816import { MarkdownRegion } from '../markdown-region' ;
1917import style from './style.module.css' ;
18+ import englishTranslations from '../../../locales/en.json' ;
2019
2120const resultHandlers = new Set ( ) ;
2221const realmHandlers = new Set ( ) ;
@@ -75,7 +74,6 @@ export function Tutorial({ html, meta }) {
7574 return ( ) => clearTimeout ( delay ) ;
7675 } , [ editorCode ] ) ;
7776
78-
7977 const useResult = fn => {
8078 useEffect ( ( ) => {
8179 resultHandlers . add ( fn ) ;
@@ -197,15 +195,15 @@ export function Tutorial({ html, meta }) {
197195 components = { TUTORIAL_COMPONENTS }
198196 />
199197
200- { meta . tutorial ?. setup &&
198+ { meta . tutorial ?. setup && (
201199 < TutorialSetupBlock
202200 code = { meta . tutorial . setup }
203201 runner = { runner }
204202 useResult = { useResult }
205203 useRealm = { useRealm }
206204 useError = { useError }
207205 />
208- }
206+ ) }
209207
210208 < ButtonContainer meta = { meta } showCode = { showCode } help = { help } />
211209 </ div >
@@ -217,13 +215,11 @@ export function Tutorial({ html, meta }) {
217215}
218216
219217function ButtonContainer ( { meta, showCode, help } ) {
220- const [ lang ] = useLanguage ( ) ;
221-
222218 return (
223219 < div class = { style . buttonContainer } >
224220 { meta . prev && (
225221 < a class = { style . prevButton } href = { meta . prev } >
226- { config . i18n . previous [ lang ] || config . i18n . previous . en }
222+ { englishTranslations . previous }
227223 </ a >
228224 ) }
229225 { meta . solvable && (
@@ -233,16 +229,14 @@ function ButtonContainer({ meta, showCode, help }) {
233229 disabled = { ! showCode }
234230 title = "Show solution to this example"
235231 >
236- { config . i18n . tutorial . solve [ lang ] ||
237- config . i18n . tutorial . solve . en }
232+ { englishTranslations . tutorial . solve }
238233 </ button >
239234 ) }
240235 { meta . next && (
241236 < a class = { style . nextButton } href = { meta . next } >
242237 { meta . code == false
243- ? ( config . i18n . tutorial . begin [ lang ] || config . i18n . tutorial . begin . en )
244- : ( config . i18n . next [ lang ] || config . i18n . next . en )
245- }
238+ ? englishTranslations . tutorial . begin
239+ : englishTranslations . next }
246240 </ a >
247241 ) }
248242 </ div >
0 commit comments