Skip to content

Commit

Permalink
translate more messages, improve notification data flow
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed May 15, 2013
1 parent c9f9e31 commit abdb90e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
5 changes: 0 additions & 5 deletions app/views/analyse/notification.scala.html

This file was deleted.

4 changes: 2 additions & 2 deletions app/views/analyse/replay.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@
} else {
<div class="undergame_box game_analysis status">
@a.fail.map { f =>
Computer analysis has failed.<br />@f<br />
@trans.theComputerAnalysisHasFailed()<br />@f<br />
<form class="request_analysis" action="@routes.Analyse.computer(gameId, color.name)" method="post">
<a>Try it again</a>
</form>
}.getOrElse {
Computer analysis in progress. You will be notified when it completes.
@trans.computerAnalysisInProgress()
}
</div>
}
Expand Down
2 changes: 2 additions & 0 deletions conf/messages
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ blackLeftTheGame=Black left the game
shareThisUrlToLetSpectatorsSeeTheGame=Share this URL to let spectators see the game
youAreViewingThisGameAsASpectator=You are viewing this game as a spectator
replayAndAnalyse=Replay and analyse
computerAnalysisInProgress=Computer analysis in progress
theComputerAnalysisYouRequestedIsNowAvailable=The computer analysis you requested is now available
theComputerAnalysisHasFailed=The computer analysis has failed
viewTheComputerAnalysis=View the computer analysis
requestAComputerAnalysis=Request a computer analysis
viewGameStats=View game stats
Expand Down
4 changes: 3 additions & 1 deletion modules/i18n/src/main/I18nKeys.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ final class I18nKeys(translator: Translator) {
val shareThisUrlToLetSpectatorsSeeTheGame = new Key("shareThisUrlToLetSpectatorsSeeTheGame")
val youAreViewingThisGameAsASpectator = new Key("youAreViewingThisGameAsASpectator")
val replayAndAnalyse = new Key("replayAndAnalyse")
val computerAnalysisInProgress = new Key("computerAnalysisInProgress")
val theComputerAnalysisYouRequestedIsNowAvailable = new Key("theComputerAnalysisYouRequestedIsNowAvailable")
val theComputerAnalysisHasFailed = new Key("theComputerAnalysisHasFailed")
val viewTheComputerAnalysis = new Key("viewTheComputerAnalysis")
val requestAComputerAnalysis = new Key("requestAComputerAnalysis")
val viewGameStats = new Key("viewGameStats")
Expand Down Expand Up @@ -198,5 +200,5 @@ final class I18nKeys(translator: Translator) {
val importGame = new Key("importGame")
val nbImportedGames = new Key("nbImportedGames")

def keys = List(playWithAFriend, inviteAFriendToPlayWithYou, playWithTheMachine, challengeTheArtificialIntelligence, toInviteSomeoneToPlayGiveThisUrl, gameOver, waitingForOpponent, waiting, yourTurn, aiNameLevelAiLevel, level, toggleTheChat, toggleSound, chat, resign, checkmate, stalemate, white, black, createAGame, noGameAvailableRightNowCreateOne, whiteIsVictorious, blackIsVictorious, playWithTheSameOpponentAgain, newOpponent, playWithAnotherOpponent, yourOpponentWantsToPlayANewGameWithYou, joinTheGame, whitePlays, blackPlays, theOtherPlayerHasLeftTheGameYouCanForceResignationOrWaitForHim, makeYourOpponentResign, forceResignation, talkInChat, theFirstPersonToComeOnThisUrlWillPlayWithYou, whiteCreatesTheGame, blackCreatesTheGame, whiteJoinsTheGame, blackJoinsTheGame, whiteResigned, blackResigned, whiteLeftTheGame, blackLeftTheGame, shareThisUrlToLetSpectatorsSeeTheGame, youAreViewingThisGameAsASpectator, replayAndAnalyse, theComputerAnalysisYouRequestedIsNowAvailable, viewTheComputerAnalysis, requestAComputerAnalysis, viewGameStats, flipBoard, threefoldRepetition, claimADraw, offerDraw, draw, nbConnectedPlayers, talkAboutChessAndDiscussLichessFeaturesInTheForum, seeTheGamesBeingPlayedInRealTime, gamesBeingPlayedRightNow, viewAllNbGames, viewNbCheckmates, nbBookmarks, nbPopularGames, nbAnalysedGames, bookmarkedByNbPlayers, viewInFullSize, logOut, signIn, signUp, people, games, forum, searchInForum, chessPlayers, minutesPerSide, variant, timeControl, start, username, password, haveAnAccount, allYouNeedIsAUsernameAndAPassword, learnMoreAboutLichess, rank, gamesPlayed, declineInvitation, cancel, timeOut, drawOfferSent, drawOfferDeclined, drawOfferAccepted, drawOfferCanceled, yourOpponentOffersADraw, accept, decline, playingRightNow, abortGame, gameAborted, standard, unlimited, mode, casual, rated, thisGameIsRated, rematch, rematchOfferSent, rematchOfferAccepted, rematchOfferCanceled, rematchOfferDeclined, cancelRematchOffer, viewRematch, play, inbox, chatRoom, spectatorRoom, composeMessage, sentMessages, incrementInSeconds, freeOnlineChess, spectators, nbWins, nbLosses, nbDraws, exportGames, color, eloRange, giveNbSeconds, searchAPlayer, whoIsOnline, allPlayers, premoveEnabledClickAnywhereToCancel, thisPlayerUsesChessComputerAssistance, opening, takeback, proposeATakeback, takebackPropositionSent, takebackPropositionDeclined, takebackPropositionAccepted, takebackPropositionCanceled, yourOpponentProposesATakeback, bookmarkThisGame, toggleBackground, advancedSearch, tournament, tournamentPoints, viewTournament, freeOnlineChessGamePlayChessNowInACleanInterfaceNoRegistrationNoAdsNoPluginRequiredPlayChessWithComputerFriendsOrRandomOpponents, teams, nbMembers, allTeams, newTeam, myTeams, noTeamFound, joinTeam, quitTeam, anyoneCanJoin, aConfirmationIsRequiredToJoin, joiningPolicy, teamLeader, teamBestPlayers, teamRecentMembers, searchATeam, averageElo, location, settings, filterGames, reset, apply, leaderboard, pasteTheFenStringHere, pasteThePgnStringHere, fromPosition, continueFromHere, importGame, nbImportedGames)
def keys = List(playWithAFriend, inviteAFriendToPlayWithYou, playWithTheMachine, challengeTheArtificialIntelligence, toInviteSomeoneToPlayGiveThisUrl, gameOver, waitingForOpponent, waiting, yourTurn, aiNameLevelAiLevel, level, toggleTheChat, toggleSound, chat, resign, checkmate, stalemate, white, black, createAGame, noGameAvailableRightNowCreateOne, whiteIsVictorious, blackIsVictorious, playWithTheSameOpponentAgain, newOpponent, playWithAnotherOpponent, yourOpponentWantsToPlayANewGameWithYou, joinTheGame, whitePlays, blackPlays, theOtherPlayerHasLeftTheGameYouCanForceResignationOrWaitForHim, makeYourOpponentResign, forceResignation, talkInChat, theFirstPersonToComeOnThisUrlWillPlayWithYou, whiteCreatesTheGame, blackCreatesTheGame, whiteJoinsTheGame, blackJoinsTheGame, whiteResigned, blackResigned, whiteLeftTheGame, blackLeftTheGame, shareThisUrlToLetSpectatorsSeeTheGame, youAreViewingThisGameAsASpectator, replayAndAnalyse, computerAnalysisInProgress, theComputerAnalysisYouRequestedIsNowAvailable, theComputerAnalysisHasFailed, viewTheComputerAnalysis, requestAComputerAnalysis, viewGameStats, flipBoard, threefoldRepetition, claimADraw, offerDraw, draw, nbConnectedPlayers, talkAboutChessAndDiscussLichessFeaturesInTheForum, seeTheGamesBeingPlayedInRealTime, gamesBeingPlayedRightNow, viewAllNbGames, viewNbCheckmates, nbBookmarks, nbPopularGames, nbAnalysedGames, bookmarkedByNbPlayers, viewInFullSize, logOut, signIn, signUp, people, games, forum, searchInForum, chessPlayers, minutesPerSide, variant, timeControl, start, username, password, haveAnAccount, allYouNeedIsAUsernameAndAPassword, learnMoreAboutLichess, rank, gamesPlayed, declineInvitation, cancel, timeOut, drawOfferSent, drawOfferDeclined, drawOfferAccepted, drawOfferCanceled, yourOpponentOffersADraw, accept, decline, playingRightNow, abortGame, gameAborted, standard, unlimited, mode, casual, rated, thisGameIsRated, rematch, rematchOfferSent, rematchOfferAccepted, rematchOfferCanceled, rematchOfferDeclined, cancelRematchOffer, viewRematch, play, inbox, chatRoom, spectatorRoom, composeMessage, sentMessages, incrementInSeconds, freeOnlineChess, spectators, nbWins, nbLosses, nbDraws, exportGames, color, eloRange, giveNbSeconds, searchAPlayer, whoIsOnline, allPlayers, premoveEnabledClickAnywhereToCancel, thisPlayerUsesChessComputerAssistance, opening, takeback, proposeATakeback, takebackPropositionSent, takebackPropositionDeclined, takebackPropositionAccepted, takebackPropositionCanceled, yourOpponentProposesATakeback, bookmarkThisGame, toggleBackground, advancedSearch, tournament, tournamentPoints, viewTournament, freeOnlineChessGamePlayChessNowInACleanInterfaceNoRegistrationNoAdsNoPluginRequiredPlayChessWithComputerFriendsOrRandomOpponents, teams, nbMembers, allTeams, newTeam, myTeams, noTeamFound, joinTeam, quitTeam, anyoneCanJoin, aConfirmationIsRequiredToJoin, joiningPolicy, teamLeader, teamBestPlayers, teamRecentMembers, searchATeam, averageElo, location, settings, filterGames, reset, apply, leaderboard, pasteTheFenStringHere, pasteThePgnStringHere, fromPosition, continueFromHere, importGame, nbImportedGames)
}
8 changes: 4 additions & 4 deletions modules/notification/src/main/Api.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import lila.hub.actorApi.SendTo

import scala.collection.mutable
import play.api.templates.Html
import akka.pattern.ask
import akka.pattern.{ ask, pipe }

private[notification] final class Api(socketHub: lila.hub.ActorLazyRef, renderer: lila.hub.ActorLazyRef) {

Expand All @@ -16,9 +16,9 @@ private[notification] final class Api(socketHub: lila.hub.ActorLazyRef, renderer
val notif = Notification(userId, html, from)
repo.update(userId, notif :: get(userId))
val request = actorApi.RenderNotification(notif.id, notif.from, notif.html)
renderer ? request mapTo manifest[Html] onSuccess {
case rendered socketHub ! SendTo(userId, "notificationAdd", rendered.toString)
}
renderer ? request map {
case rendered: Html SendTo(userId, "notificationAdd", rendered.toString)
} logFailure "[notification] cannot render" pipeTo socketHub.ref
}

def get(userId: String): List[Notification] = ~(repo get userId)
Expand Down

0 comments on commit abdb90e

Please sign in to comment.