lila/app/views/round/jsI18n.scala

103 lines
2.5 KiB
Scala
Raw Normal View History

2018-12-03 02:39:00 -07:00
package views.html.round
import play.api.i18n.Lang
2018-12-03 02:39:00 -07:00
import lila.app.templating.Environment._
import lila.i18n.{ I18nKeys => trans }
object jsI18n {
2020-05-05 22:11:15 -06:00
def apply(g: lila.game.Game)(implicit lang: Lang) =
i18nJsObject {
baseTranslations ++ {
if (g.isCorrespondence) correspondenceTranslations
else realtimeTranslations
} ++ {
g.variant.exotic ?? variantTranslations
} ++ {
g.isTournament ?? tournamentTranslations
} ++ {
g.isSwiss ?? swissTranslations
}
2018-12-03 02:39:00 -07:00
}
private val correspondenceTranslations = Vector(
trans.oneDay,
trans.nbDays,
trans.nbHours
).map(_.key)
2018-12-03 02:39:00 -07:00
private val realtimeTranslations = Vector(trans.nbSecondsToPlayTheFirstMove).map(_.key)
2018-12-03 02:39:00 -07:00
private val variantTranslations = Vector(
trans.kingInTheCenter,
trans.threeChecks,
trans.variantEnding
).map(_.key)
2018-12-03 02:39:00 -07:00
private val tournamentTranslations = Vector(
trans.backToTournament,
trans.viewTournament,
trans.standing
).map(_.key)
2018-12-03 02:39:00 -07:00
2020-05-04 16:59:08 -06:00
private val swissTranslations = Vector(
trans.backToTournament,
trans.viewTournament
).map(_.key)
2018-12-03 02:39:00 -07:00
private val baseTranslations = Vector(
trans.flipBoard,
trans.aiNameLevelAiLevel,
trans.yourTurn,
trans.abortGame,
trans.proposeATakeback,
trans.offerDraw,
trans.resign,
2020-01-06 08:29:38 -07:00
trans.opponentLeftCounter,
2018-12-03 02:39:00 -07:00
trans.opponentLeftChoices,
trans.forceResignation,
trans.forceDraw,
trans.threefoldRepetition,
trans.claimADraw,
trans.drawOfferSent,
trans.cancel,
trans.yourOpponentOffersADraw,
trans.accept,
trans.decline,
trans.takebackPropositionSent,
trans.yourOpponentProposesATakeback,
trans.thisAccountViolatedTos,
2018-12-03 02:39:00 -07:00
trans.gameAborted,
trans.checkmate,
trans.whiteResigned,
trans.blackResigned,
trans.stalemate,
trans.whiteLeftTheGame,
trans.blackLeftTheGame,
trans.draw,
trans.timeOut,
trans.whiteIsVictorious,
trans.blackIsVictorious,
trans.withdraw,
trans.rematch,
trans.rematchOfferSent,
trans.rematchOfferAccepted,
trans.waitingForOpponent,
trans.cancelRematchOffer,
trans.newOpponent,
trans.confirmMove,
2018-12-03 02:39:00 -07:00
trans.viewRematch,
trans.whitePlays,
trans.blackPlays,
trans.giveNbSeconds,
2020-02-09 21:40:00 -07:00
trans.preferences.giveMoreTime,
2018-12-03 02:39:00 -07:00
trans.gameOver,
trans.analysis,
2020-02-06 23:01:11 -07:00
trans.yourOpponentWantsToPlayANewGameWithYou,
trans.youPlayTheWhitePieces,
trans.youPlayTheBlackPieces,
trans.itsYourTurn
).map(_.key)
2018-12-03 02:39:00 -07:00
}