@@ -49,27 +49,41 @@ var currentStep; //this will be used as current step object
4949var LANG ; //this will be used to store the current language
5050
5151var tutorialStrings = {
52- 'EN' : {
53- 'codeNotWellformed' : 'Your code is not well-formed.' ,
54- 'fetchOperationProblem' : 'There has been a problem with the fetch operation for:' ,
55- 'finish' : 'Finish' ,
56- 'goal' : 'Goal' ,
57- 'hideHint' : 'hide hint' ,
58- 'networkError' : 'Network response was not ok while trying to fetch:' ,
59- 'renderingError' : 'The current encoding cannot be rendered.' ,
60- 'showHint' : 'show hint' ,
61- 'task' : 'Task' ,
52+ 'codeNotWellformed' : {
53+ 'EN' : 'Your code is not well-formed.' ,
54+ 'ES' : 'Su código no está bien formado.'
6255 } ,
63- 'ES' : {
64- 'codeNotWellformed' : 'Su código no está bien formado.' ,
65- 'fetchOperationProblem' : 'Ha habido un problema con la operación fetch para:' ,
66- 'finish' : 'Terminar' ,
67- 'goal' : 'Objetivo' ,
68- 'hideHint' : 'ocultar pista' ,
69- 'networkError' : 'La respuesta de la red no fue correcta al intentar buscar:' ,
70- 'renderingError' : 'La codificación actual no se puede representar.' ,
71- 'showHint' : 'mostrar pista' ,
72- 'task' : 'Tarea' ,
56+ 'fetchOperationProblem' : {
57+ 'EN' : 'There has been a problem with the fetch operation for:' ,
58+ 'ES' : 'Ha habido un problema con la operación fetch para:'
59+ } ,
60+ 'finish' : {
61+ 'EN' : 'Finish' ,
62+ 'ES' : 'Terminar'
63+ } ,
64+ 'goal' : {
65+ 'EN' : 'Goal' ,
66+ 'ES' : 'Objetivo'
67+ } ,
68+ 'hideHint' : {
69+ 'EN' : 'hide hint' ,
70+ 'ES' : 'ocultar pista'
71+ } ,
72+ 'networkError' : {
73+ 'EN' : 'Network response was not ok while trying to fetch:' ,
74+ 'ES' : 'La respuesta de la red no fue correcta al intentar buscar:'
75+ } ,
76+ 'renderingError' : {
77+ 'EN' : 'The current encoding cannot be rendered.' ,
78+ 'ES' : 'La codificación actual no se puede representar.'
79+ } ,
80+ 'showHint' : {
81+ 'EN' : 'show hint' ,
82+ 'ES' : 'mostrar pista'
83+ } ,
84+ 'task' : {
85+ 'EN' : 'Task' ,
86+ 'ES' : 'Tarea'
7387 }
7488} ;
7589
@@ -136,7 +150,7 @@ function setupTutorial(data, language) {
136150 li . classList . add ( 'step-item' ) ;
137151 li . setAttribute ( 'data-step-n' , 'outro' ) ;
138152 var a = document . createElement ( 'a' ) ;
139- var text = tutorialStrings [ LANG ] [ 'finish' ] ;
153+ var text = tutorialStrings [ 'finish' ] [ LANG ] ;
140154 a . innerHTML = text ;
141155 li . appendChild ( a ) ;
142156 stepBox . appendChild ( li ) ;
@@ -232,7 +246,7 @@ function loadTutorialStep(data, stepNum) {
232246 }
233247 } )
234248 . catch ( function ( error ) {
235- console . error ( tutorialStrings [ LANG ] [ 'fetchOperationProblem' ] , promiseArray , error . message ) ;
249+ console . error ( tutorialStrings [ 'fetchOperationProblem' ] [ LANG ] , promiseArray , error . message ) ;
236250 } ) ;
237251 }
238252
@@ -243,8 +257,8 @@ function loadTutorialStep(data, stepNum) {
243257 document . getElementById ( 'instruction' ) . innerHTML = descriptionFile ;
244258
245259 // insert task and goal elements
246- prependTextToElementWithClass ( 'tutorialTask' , tutorialStrings [ LANG ] [ 'task' ] ) ;
247- prependTextToElementWithClass ( 'tutorialGoal' , tutorialStrings [ LANG ] [ 'goal' ] ) ;
260+ prependTextToElementWithClass ( 'tutorialTask' , tutorialStrings [ 'task' ] [ LANG ] ) ;
261+ prependTextToElementWithClass ( 'tutorialGoal' , tutorialStrings [ 'goal' ] [ LANG ] ) ;
248262
249263 // show buttons
250264 nextStepButton . style . display = 'inline-block' ;
@@ -254,7 +268,7 @@ function loadTutorialStep(data, stepNum) {
254268 document . getElementById ( 'acknowledgments' ) . style . display = 'none' ;
255269 } )
256270 . catch ( function ( error ) {
257- console . error ( tutorialStrings [ LANG ] [ 'fetchOperationProblem' ] , currentStep . descFile , error . message ) ;
271+ console . error ( tutorialStrings [ 'fetchOperationProblem' ] [ LANG ] , currentStep . descFile , error . message ) ;
258272 } ) ;
259273
260274}
@@ -334,8 +348,8 @@ function handleEditorChanges(file) {
334348 }
335349
336350 if ( ! wellformed ) {
337- console . warn ( tutorialStrings [ LANG ] [ 'codeNotWellformed' ] ) ;
338- displayWarning ( tutorialStrings [ LANG ] [ 'codeNotWellformed' ] ) ;
351+ console . warn ( tutorialStrings [ 'codeNotWellformed' ] [ LANG ] ) ;
352+ displayWarning ( tutorialStrings [ 'codeNotWellformed' ] [ LANG ] ) ;
339353 document . getElementById ( 'rendering' ) . innerHTML = '' ;
340354
341355
@@ -441,7 +455,7 @@ function showFinalPage(data) {
441455
442456 } )
443457 . catch ( function ( error ) {
444- console . error ( tutorialStrings [ LANG ] [ 'fetchOperationProblem' ] , data . end , error . message ) ;
458+ console . error ( tutorialStrings [ 'fetchOperationProblem' ] [ LANG ] , data . end , error . message ) ;
445459 } ) ;
446460
447461}
@@ -471,7 +485,7 @@ function renderVerovio(validationString) {
471485
472486 if ( error ) {
473487 // display message
474- document . getElementById ( 'rendering' ) . innerHTML = tutorialStrings [ LANG ] [ 'renderingError' ] ;
488+ document . getElementById ( 'rendering' ) . innerHTML = tutorialStrings [ 'renderingError' ] [ LANG ] ;
475489 } else {
476490 // display svg
477491 document . getElementById ( 'rendering' ) . innerHTML = svg ;
@@ -644,7 +658,7 @@ function fetchFile(file) {
644658 if ( response . ok ) {
645659 return response . text ( ) ;
646660 }
647- throw new Error ( tutorialStrings [ LANG ] [ 'networkError' ] , file ) ;
661+ throw new Error ( tutorialStrings [ 'networkError' ] [ LANG ] , file ) ;
648662 } )
649663}
650664
@@ -747,8 +761,8 @@ function toggleHint() {
747761 // read current values
748762 const hintStyle = document . getElementById ( 'hints' ) ;
749763 var hintMessage = document . getElementById ( 'btn-toggleHint' ) . innerText ;
750- var hideHint = tutorialStrings [ LANG ] [ 'hideHint' ] ;
751- var showHint = tutorialStrings [ LANG ] [ 'showHint' ] ;
764+ var hideHint = tutorialStrings [ 'hideHint' ] [ LANG ] ;
765+ var showHint = tutorialStrings [ 'showHint' ] [ LANG ] ;
752766
753767 // toggle values
754768 hintStyle . style . display = hintStyle . style . display === 'none' ? 'block' : 'none' ;
0 commit comments