make training section translatable

This commit is contained in:
Thibault Duplessis 2014-02-24 23:57:33 +01:00
parent 71788cccbf
commit b498ab54e3
10 changed files with 95 additions and 55 deletions

View file

@ -13,7 +13,7 @@ final class SiteMenu(trans: I18nKeys) {
val play = new Elem("play", routes.Lobby.home, trans.play)
val game = new Elem("game", routes.Game.realtime, trans.games)
val puzzle = new Elem("puzzle", routes.Puzzle.home, I18nKey untranslated "Training")
val puzzle = new Elem("puzzle", routes.Puzzle.home, trans.training)
val tournament = new Elem("tournament", routes.Tournament.home, trans.tournaments)
val user = new Elem("user", routes.User.list(page = 1), trans.players)
val team = new Elem("team", routes.Team.home(page = 1), trans.teams)

View file

@ -1,3 +0,0 @@
@(puzzle: lila.puzzle.Puzzle, attempt: lila.puzzle.Attempt)(implicit ctx: Context)
@attempt

View file

@ -2,7 +2,7 @@
<div class="undertable">
<div class="undertable_top">
<span class="title">Recently played puzzles</span>
<span class="title">@trans.recentlyPlayedPuzzles()</span>
</div>
<div class="undertable_inner">
<div class="content">
@ -18,8 +18,7 @@
</td>
<td>
<a class="user_link" href="@routes.Puzzle.show(attempt.puzzleId)">
Puzzle @attempt.puzzleId
(@attempt.puzzleRating)
@trans.puzzleId(attempt.puzzleId) (@attempt.puzzleRating)
</a>
</td>
<td>

View file

@ -10,12 +10,12 @@
<div class="side">
@trainingBox(puzzle, userInfos, true)
<div class="comment retry none"><h3><strong>Good move</strong></h3>But you can do better.</div>
<div class="comment great none"><h3 data-icon="E"> <strong>Best move!</strong></h3>Keep going&#8230;</div>
<div class="comment retry none"><h3><strong>@trans.goodMove()</strong></h3>@trans.butYouCanDoBetter()</div>
<div class="comment great none"><h3 data-icon="E"> <strong>@trans.bestMove()</strong></h3>@trans.keepGoing()</div>
@if(asPlay) {
<div class="comment fail none"><h3 data-icon="k"> <strong>Puzzle failed</strong></h3></div>
<div class="comment fail none"><h3 data-icon="k"> <strong>@trans.puzzleFailed()</strong></h3></div>
} else {
<div class="comment fail none"><h3 data-icon="k"> <strong>Puzzle failed</strong></h3>But you can keep trying.</div>
<div class="comment fail none"><h3 data-icon="k"> <strong>@trans.puzzleFailed()</strong></h3>@trans.butYouCanKeepTrying()</div>
}
</div>
@ -44,7 +44,7 @@
</div>
</div>
<div class="lichess_control">
<a class="giveup button">Give up</a>
<a class="giveup button">@trans.giveUp()</a>
</div>
</div>
</div>

View file

@ -1,6 +1,6 @@
@(puzzle: lila.puzzle.Puzzle, userInfos: Option[lila.puzzle.UserInfos], asPlay: Boolean)(implicit ctx: Context)
@layout("Puzzle") {
@layout(trans.training.str()) {
<div id="puzzle_wrap">
@playMode(puzzle, userInfos, asPlay)

View file

@ -1,9 +1,9 @@
@(puzzle: lila.puzzle.Puzzle, userInfos: Option[lila.puzzle.UserInfos], isPlay: Boolean)(implicit ctx: Context)
<div class="box">
<h1>Training</h1>
<h1>@trans.training()</h1>
@userInfos.map { i =>
Your puzzle rating: <strong>@i.user.perfs.puzzle.intRating</strong>
@trans.yourPuzzleRatingX(s"<strong>${i.user.perfs.puzzle.intRating}</strong>")
@if(i.history.nonEmpty) {
<div class="user_chart" data-points="@toJson(i.chart)"></div>
} else {
@ -11,15 +11,13 @@
}
}.getOrElse {
@if(isPlay) {
<p>Find the best move for @{puzzle.color.name}.</p>
<p>@trans.findTheBestMoveForColor(puzzle.color.name)</p>
} else {
<p>To track your progress:</p>
<p>@trans.toTrackYourProgress()</p>
<p class="signup">
<a class="button" href="@routes.Auth.signup">Create a username</a>
</p>
<p>
Lichess will provide puzzles that match your ability, making for better training sessions.
<a class="button" href="@routes.Auth.signup">@trans.signUp()</a>
</p>
<p>@trans.trainingSignupExplanation()</p>
}
}
</div>

View file

@ -12,20 +12,20 @@
@trainingBox(puzzle, userInfos, false)
@win.map { w =>
@if(w) {
<div class="comment win"><h3 data-icon="E"> <strong>Victory!</strong></h3></div>
<div class="comment win"><h3 data-icon="E"> <strong>@trans.victory()</strong></h3></div>
} else {
<div class="comment loss"><h3 data-icon="k"> <strong>Puzzle failed</strong></h3></div>
<div class="comment loss"><h3 data-icon="k"> <strong>@trans.puzzleFailed()</strong></h3></div>
}
}.getOrElse {
@attempt.map { a =>
@if(a.win) {
<div class="comment win">
<h3 data-icon="E"> <strong>Victory!</strong><strong class="rating"> @showNumber(a.userRatingDiff)</strong></h3>
Puzzle solved in @a.seconds seconds.
<h3 data-icon="E"> <strong>@trans.victory()</strong><strong class="rating"> @showNumber(a.userRatingDiff)</strong></h3>
@trans.puzzleSolvedInXSeconds(a.seconds)
</div>
} else {
<div class="comment loss">
<h3 data-icon="k"> <strong>Puzzle failed</strong><strong class="rating"> @showNumber(a.userRatingDiff)</strong></h3>
<h3 data-icon="k"> <strong>@trans.puzzleFailed()</strong><strong class="rating"> @showNumber(a.userRatingDiff)</strong></h3>
</div>
}
}
@ -51,13 +51,12 @@
@if(voted == Some(false)) {
<div class="please_vote">
<p class="first">
<strong>Was this puzzle any good?</strong><br />
Help lichess improve by voting<br />
using the up or down arrow:
<strong>@trans.wasThisPuzzleAnyGood()</strong><br />
@trans.pleaseVotePuzzle()
</p>
<p class="then">
<br />
<strong>Thank you!</strong>
<strong>@trans.thankYou()</strong>
<br /><br />
</p>
</div>
@ -67,35 +66,26 @@
<div class="vote_wrap">@vote(puzzle, attempt)</div>
}
<h2 class="puzzle_link">
<a href="@routes.Puzzle.show(puzzle.id)">Puzzle @puzzle.id</a>
<a href="@routes.Puzzle.show(puzzle.id)">@trans.puzzleId(puzzle.id)</a>
</h2>
<p>
Rating: <strong>@puzzle.perf.intRating</strong>
@trans.ratingX(s"<strong>${puzzle.perf.intRating}</strong>")
<small title="Glicko rating deviation"> ±@puzzle.perf.glicko.intDeviationDoubled</small>
</p>
<p>
Played
@puzzle.attempts match {
case 1 => { <strong>once</strong> }
case 2 => { <strong>twice</strong> }
case x => { <strong>@x</strong> times }
}
</p>
<p>
Win rate: <strong>@puzzle.winPercent</strong>%
</p>
<p>@trans.playedXTimes(s"<strong>${puzzle.attempts}</strong>")</p>
<p>@trans.winRateX(s"<strong>${puzzle.winPercent}</strong}>%")</p>
@puzzle.gameId.map { id =>
<p>From game <a href="@routes.Round.watcher(id, puzzle.color.name)">#@id</a></p>
<p>@trans.fromGameLink(s"""<a href="${routes.Round.watcher(id, puzzle.color.name)}">#$id</a>""")</p>
}
</div>
<div class="continue_wrap">
@if(win.isDefined) {
<a class="continue button" href="@routes.Puzzle.home" data-icon="G"> Start training</a>
<a class="continue button" href="@routes.Puzzle.home" data-icon="G"> @trans.startTraining()</a>
} else {
<button class="continue button" data-icon="G"> Continue training</button>
<button class="continue button" data-icon="G"> @trans.continueTraining()</button>
}
@if(win.fold(attempt.exists(_.loss))(!_)) {
<a class="retry" href="@routes.Puzzle.show(puzzle.id)">Retry this puzzle</a>
<a class="retry" href="@routes.Puzzle.show(puzzle.id)">@trans.retryThisPuzzle()</a>
}
</div>
</div>

View file

@ -1,17 +1,17 @@
@(puzzle: lila.puzzle.Puzzle, attempt: Option[lila.puzzle.Attempt])
@(puzzle: lila.puzzle.Puzzle, attempt: Option[lila.puzzle.Attempt])(implicit ctx: Context)
@if(puzzle.enabled) {
<div class="upvote @if(attempt.isDefined) { enabled }"
data-post-url="@routes.Puzzle.vote(puzzle.id)">
<a
title="This puzzle is correct and interesting"
data-vote="1"
<a
title="@trans.thisPuzzleIsCorrect()"
data-vote="1"
data-icon="S"
class="upvote @if(attempt.flatMap(_.vote) == Some(true)) { active }"></a>
<span title="Popularity" class="count">@puzzle.vote.sum</span>
<a
title="This puzzle is wrong or boring"
data-vote="0"
<a
title="@trans.thisPuzzleIsWrong()"
data-vote="0"
data-icon="R"
class="downvote @if(attempt.flatMap(_.vote) == Some(false)) { active }"></a>
</div>

View file

@ -264,3 +264,31 @@ bestBulletPlayers=Best bullet players
bestBlitzPlayers=Best blitz players
bestSlowPlayers=Best slow players
bewareTheGameIsRatedButHasNoClock=Beware, the game is rated but has no clock!
training=Training
yourPuzzleRatingX=Your puzzle rating: %s
findTheBestMoveForColor=Find the best move for %s.
toTrackYourProgress=To track your progress:
trainingSignupExplanation=Lichess will provide puzzles that match your ability, making for better training sessions.
recentlyPlayedPuzzles=Recently played puzzles
puzzleId=Puzzle %s
goodMove=Good move
butYouCanDoBetter=But you can do better.
bestMove=Best move!
keepGoing=Keep going…
puzzleFailed=Puzzle failed
butYouCanKeepTrying=But you can keep trying.
victory=Victory!
giveUp=Give up
puzzleSolvedInXSeconds=Puzzle solved in %s seconds.
wasThisPuzzleAnyGood=Was this puzzle any good?
pleaseVotePuzzle=Help lichess improve by voting, using the up or down arrow:
thankYou=Thank you!
ratingX=Rating: %s
playedXTimes=Played %s times
winRateX=Win rate: %s
fromGameLink=From game %s
startTraining=Start training
continueTraining=Continue training
retryThisPuzzle=Retry this puzzle
thisPuzzleIsCorrect=This puzzle is correct and interesting
thisPuzzleIsWrong=This puzzle is wrong or boring

File diff suppressed because one or more lines are too long