@@ -23,6 +23,17 @@ goog.require('app.Level');
2323goog . require ( 'app.LevelResult' ) ;
2424goog . require ( 'app.Step' ) ;
2525
26+ // TODO(samthor): duplicated from blocks.js, where we insert into Blockly.
27+ const stepNames = {
28+ [ app . Step . LEFT_ARM ] : _msg `codeboogie-block-leftarm` ,
29+ [ app . Step . RIGHT_ARM ] : _msg `codeboogie-block-rightarm` ,
30+ [ app . Step . LEFT_FOOT ] : _msg `codeboogie-block-leftfoot` ,
31+ [ app . Step . RIGHT_FOOT ] : _msg `codeboogie-block-rightfoot` ,
32+ [ app . Step . JUMP ] : _msg `codeboogie-block-jump` ,
33+ [ app . Step . SPLIT ] : _msg `codeboogie-block-split` ,
34+ [ app . Step . SHAKE ] : _msg `codeboogie-block-shake` ,
35+ } ;
36+
2637/**
2738 * Dance result constants.
2839 * @enum {string}
@@ -95,15 +106,15 @@ app.DanceLevel = class extends app.Level {
95106 animation . unshift ( {
96107 teacherStep : app . Step . IDLE ,
97108 playerStep : app . Step . IDLE ,
98- title : app . I18n . getMsg ( 'CB_watchClosely' ) ,
109+ title : _msg `codeboogie-watch-closely` ,
99110 isIntro : true
100111 } ) ;
101112 }
102113
103114 return new app . DanceLevelResult ( false , null , {
104115 animationQueue : animation ,
105116 danceStatus : danceStatus ,
106- endTitle : app . I18n . getMsg ( 'CB_yourTurn' )
117+ endTitle : _msg `codeboogie-your-turn`
107118 } ) ;
108119 }
109120
@@ -119,13 +130,13 @@ app.DanceLevel = class extends app.Level {
119130 if ( blockly . hasEmptyContainerBlocks ( ) ) {
120131 // Block is assumed to be "if" or "repeat" if we reach here.
121132 return new app . DanceLevelResult ( false ,
122- app . I18n . getMsg ( 'CB_resultEmptyBlockFail' ) ,
133+ _msg `codelab-result-empty-repeat-fail` ,
123134 { skipAnimation : true } ) ;
124135 }
125136
126137 if ( blockly . hasExtraTopBlocks ( ) ) {
127138 return new app . DanceLevelResult ( false ,
128- app . I18n . getMsg ( 'CB_resultExtraTopBlockFail' ) ,
139+ _msg `codelab-result-extra-top-block-fail` ,
129140 { skipAnimation : true } ) ;
130141 }
131142
@@ -134,7 +145,7 @@ app.DanceLevel = class extends app.Level {
134145 if ( this . freestyle &&
135146 playerStepCount > app . DanceLevel . FREESTYLE_STEP_LIMIT ) {
136147 return new app . DanceLevelResult ( false ,
137- app . I18n . getMsg ( 'CB_resultTooManySteps' ) ,
148+ _msg `codeboogie-result-too-many-steps` ,
138149 { skipAnimation : true } ) ;
139150 }
140151
@@ -145,11 +156,16 @@ app.DanceLevel = class extends app.Level {
145156 var missingBlocks = blockly . getMissingBlocks ( this . requiredBlocks ) ;
146157 var numEnabledBlocks = blockly . getCountableBlocks ( ) . length ;
147158
148- var endTitleMsg = '' ;
159+ var endTitle = '' ;
149160
150161 if ( ! this . freestyle ) {
151- endTitleMsg = danceStatus === app . DanceStatus . NO_STEPS ? 'CB_yourTurn' :
152- levelComplete ? 'CB_success' : 'CB_tryAgain' ;
162+ if ( danceStatus === app . DanceStatus . NO_STEPS ) {
163+ endTitle = _msg `codeboogie-your-turn` ;
164+ } else if ( levelComplete ) {
165+ endTitle = _msg `codeboogie-success` ;
166+ } else {
167+ endTitle = _msg `codelab-try-again` ;
168+ }
153169 }
154170
155171 var allowRetry = true ;
@@ -158,20 +174,20 @@ app.DanceLevel = class extends app.Level {
158174
159175 if ( missingBlocks . length ) {
160176 message = levelComplete ?
161- app . I18n . getMsg ( 'CB_resultMissingBlockSuccess' ) :
162- app . I18n . getMsg ( 'CB_resultMissingBlockFail' ) ;
177+ _msg `codeboogie-result-missing-block-success` :
178+ _msg `codeboogie-result-missing-block-fail` ;
163179 } else if ( ! levelComplete ) {
164180 if ( this . idealBlockCount !== Infinity &&
165181 numEnabledBlocks < this . idealBlockCount ) {
166- message = app . I18n . getMsg ( 'CB_resultTooFewBlocksFail' ) ;
182+ message = _msg `codeboogie-result-too-few-blocks-fail` ;
167183 } else {
168- message = app . I18n . getMsg ( 'CB_resultGenericFail' ) ;
184+ message = _msg `codelab-result-generic-fail` ;
169185 }
170186 } else if ( numEnabledBlocks > this . idealBlockCount ) {
171- message = app . I18n . getMsg ( 'CB_resultTooManyBlocksSuccess' ) ;
187+ message = _msg `codeboogie-result-too-many-blocks-success` ;
172188 } else if ( this . freestyle ) {
173- message = app . I18n . getMsg ( 'CB_shareMoves' ) ;
174- endTitleMsg = 'CB_keepDancing' ;
189+ message = _msg `codeboogie-share-moves` ;
190+ endTitle = _msg `codeboogie-keep-dancing` ;
175191 } else {
176192 allowRetry = false ;
177193 }
@@ -180,7 +196,7 @@ app.DanceLevel = class extends app.Level {
180196 allowRetry,
181197 animationQueue : animationQueue ,
182198 code : code ,
183- endTitle : app . I18n . getMsg ( endTitleMsg ) ,
199+ endTitle : endTitle ,
184200 danceStatus : danceStatus ,
185201 idealBlockCount : this . idealBlockCount ,
186202 missingBlocks : missingBlocks ,
@@ -251,7 +267,7 @@ app.DanceLevel = class extends app.Level {
251267 playerStep : playerStep ? playerStep . step : 'watch' ,
252268 tile : step ,
253269 blockId : playerStep && playerStep . blockId ,
254- title : app . I18n . getMsg ( 'CB_' + step )
270+ title : stepNames [ step ] || '?' ,
255271 } ;
256272
257273 queue . push ( animation ) ;
@@ -262,11 +278,11 @@ app.DanceLevel = class extends app.Level {
262278 queue . push ( {
263279 teacherStep : app . Step . WATCH ,
264280 playerStep : app . Step . FAIL ,
265- title : app . I18n . getMsg ( 'CB_oops' )
281+ title : _msg `codelab-oops`
266282 } ) ;
267283 } else {
268284 queue [ playerSteps . length ] . playerStep = app . Step . FAIL ;
269- queue [ playerSteps . length ] . title = app . I18n . getMsg ( 'CB_oops' ) ;
285+ queue [ playerSteps . length ] . title = _msg `codelab-oops` ;
270286 }
271287 }
272288
@@ -276,12 +292,12 @@ app.DanceLevel = class extends app.Level {
276292 teacherStep : app . Step . WATCH ,
277293 playerStep : extraBlock . step ,
278294 blockId : extraBlock . blockId ,
279- title : app . I18n . getMsg ( 'CB_oops' )
295+ title : _msg `codelab-oops`
280296 } ) ;
281297 queue . push ( {
282298 teacherStep : app . Step . WATCH ,
283299 playerStep : app . Step . FAIL ,
284- title : app . I18n . getMsg ( 'CB_oops' )
300+ title : _msg `codelab-oops`
285301 } ) ;
286302 }
287303
@@ -291,17 +307,17 @@ app.DanceLevel = class extends app.Level {
291307 queue . push ( {
292308 teacherStep : specialMove ,
293309 playerStep : specialMove ,
294- title : app . I18n . getMsg ( 'CB_success' )
310+ title : _msg `codeboogie-success`
295311 } ) ;
296312 }
297313
298314 if ( ! ( this . freestyle && result === app . DanceStatus . NO_STEPS ) ) {
299315 queue . unshift ( {
300316 teacherStep : app . Step . IDLE ,
301317 playerStep : app . Step . IDLE ,
302- title : app . I18n . getMsg ( result === app . DanceStatus . NO_STEPS ?
303- 'CB_watchClosely' :
304- 'CB_letsDance' ) ,
318+ title : result === app . DanceStatus . NO_STEPS ?
319+ _msg `codeboogie-watch-closely` :
320+ _msg `codeboogie-lets-dance` ,
305321 isCountdown : true ,
306322 isIntro : true
307323 } ) ;
0 commit comments