Mention whose time is out, closes #6947

pull/7306/head
Greg Finley 2020-09-12 21:56:48 -07:00
parent 8460e67e51
commit d7d4889c5e
7 changed files with 21 additions and 8 deletions

View File

@ -1,7 +1,7 @@
package lila.app
package templating
import chess.{ Status => S, Color, Clock, Mode }
import chess.{ Status => S, Color, Black, White, Clock, Mode }
import controllers.routes
import play.api.i18n.Lang
@ -180,7 +180,10 @@ trait GameHelper { self: I18nHelper with UserHelper with AiHelper with StringHel
case None => trans.draw.txt()
}
case S.Draw => trans.draw.txt()
case S.Outoftime => trans.timeOut.txt()
case S.Outoftime => game.turnColor match {
case White => trans.whiteTimeOut.txt()
case Black => trans.blackTimeOut.txt()
}
case S.NoStart =>
val color = game.loser.fold(Color.white)(_.color).name.capitalize
s"$color didn't move"

View File

@ -19,7 +19,8 @@ private object jsI18n {
trans.whiteLeftTheGame,
trans.blackLeftTheGame,
trans.draw,
trans.timeOut,
trans.whiteTimeOut,
trans.blackTimeOut,
trans.playingRightNow,
trans.whiteIsVictorious,
trans.blackIsVictorious,

View File

@ -37,7 +37,8 @@ object userAnalysisI18n {
trans.whiteLeftTheGame,
trans.blackLeftTheGame,
trans.draw,
trans.timeOut,
trans.whiteTimeOut,
trans.blackTimeOut,
trans.playingRightNow,
trans.whiteIsVictorious,
trans.blackIsVictorious,

View File

@ -76,7 +76,8 @@ object jsI18n {
trans.whiteLeftTheGame,
trans.blackLeftTheGame,
trans.draw,
trans.timeOut,
trans.whiteTimeOut,
trans.blackTimeOut,
trans.whiteIsVictorious,
trans.blackIsVictorious,
trans.withdraw,

View File

@ -159,7 +159,8 @@ val `rank` = new I18nKey("rank")
val `rankX` = new I18nKey("rankX")
val `gamesPlayed` = new I18nKey("gamesPlayed")
val `cancel` = new I18nKey("cancel")
val `timeOut` = new I18nKey("timeOut")
val `whiteTimeOut` = new I18nKey("whiteTimeOut")
val `blackTimeOut` = new I18nKey("blackTimeOut")
val `drawOfferSent` = new I18nKey("drawOfferSent")
val `drawOfferDeclined` = new I18nKey("drawOfferDeclined")
val `drawOfferAccepted` = new I18nKey("drawOfferAccepted")

View File

@ -199,7 +199,8 @@
<item quantity="other">%s games with you</item>
</plurals>
<string name="cancel">Cancel</string>
<string name="timeOut">Time out</string>
<string name="whiteTimeOut">White time out</string>
<string name="blackTimeOut">Black time out</string>
<string name="drawOfferSent">Draw offer sent</string>
<string name="drawOfferDeclined">Draw offer declined</string>
<string name="drawOfferAccepted">Draw offer accepted</string>

View File

@ -24,7 +24,12 @@ export default function status(ctrl: Ctrl): string {
case 'draw':
return noarg('draw');
case 'outoftime':
return noarg('timeOut');
switch (d.game.turns % 2) {
case 0:
return noarg('whiteTimeOut');
case 1:
return noarg('blackTimeOut');
}
case 'noStart':
return (d.game.winner == 'white' ? 'Black' : 'White') + ' didn\'t move';
case 'cheat':