1import builtins 2 3from .const import ADJOURNED_LOST_CONNECTION_BLACK, UNKNOWN_REASON, WON_LESSMATERIAL, \ 4 KILLED, ADJOURNED_SERVER_SHUTDOWN, DRAW_EQUALMATERIAL, \ 5 ABORTED_ADJUDICATION, DISCONNECTED, BLACKWON, WHITEWON, DRAW_CALLFLAG, WON_RESIGN, DRAW, \ 6 WON_CALLFLAG, DRAW_WHITEINSUFFICIENTANDBLACKTIME, DRAW_LENGTH, WON_MATE, WON_KINGINEIGHTROW, \ 7 DRAW_BLACKINSUFFICIENTANDWHITETIME, ADJOURNED_COURTESY_WHITE, WON_THREECHECK, WON_WIPEOUT, \ 8 DRAW_AGREE, DRAW_INSUFFICIENT, DRAW_STALEMATE, DRAW_ADJUDICATION, UNKNOWN_STATE, \ 9 ADJOURNED_LOST_CONNECTION, WON_NOMATERIAL, ADJOURNED, WON_DISCONNECTION, ABORTED, \ 10 ADJOURNED_AGREEMENT, WON_KINGEXPLODE, WON_KINGINCENTER, ABORTED_SERVER_SHUTDOWN, \ 11 ABORTED_AGREEMENT, WHITE_ENGINE_DIED, BLACK_ENGINE_DIED, WON_ADJUDICATION, \ 12 ADJOURNED_COURTESY_BLACK, ADJOURNED_COURTESY, DRAW_REPETITION, ABORTED_COURTESY, \ 13 DRAW_50MOVES, ADJOURNED_LOST_CONNECTION_WHITE, ABORTED_EARLY, ABORTED_DISCONNECTION, \ 14 CANCELLED, PRACTICE_GOAL_REACHED, DRAW_KINGSINEIGHTROW 15 16 17if '_' not in builtins.__dict__: 18 builtins.__dict__['_'] = lambda s: s 19 builtins.__dict__[ 20 'ngettext'] = lambda singular, plural, n: singular if n == 1 else plural 21 22reprColor = [_("White"), _("Black")] 23 24reprPiece = ["Empty", _("Pawn"), _("Knight"), _("Bishop"), _("Rook"), 25 _("Queen"), _("King"), "BPawn"] 26 27localReprSign = ["", _("P"), _("N"), _("B"), _("R"), _("Q"), _("K")] 28 29reprResult_long = { 30 DRAW: _("The game ended in a draw"), 31 WHITEWON: _("%(white)s won the game"), 32 BLACKWON: _("%(black)s won the game"), 33 KILLED: _("The game has been killed"), 34 ADJOURNED: _("The game has been adjourned"), 35 ABORTED: _("The game has been aborted"), 36 UNKNOWN_STATE: _("Unknown game state"), 37 CANCELLED: _("Game cancelled"), 38} 39 40reprReason_long = { 41 DRAW_INSUFFICIENT: 42 _("Because neither player has sufficient material to mate"), 43 DRAW_REPETITION: 44 _("Because the same position was repeated three times in a row"), 45 DRAW_50MOVES: _("Because the last 50 moves brought nothing new"), 46 DRAW_CALLFLAG: _("Because both players ran out of time"), 47 DRAW_STALEMATE: _("Because %(mover)s stalemated"), 48 DRAW_AGREE: _("Because both players agreed to a draw"), 49 DRAW_ADJUDICATION: _("Because of adjudication by an admin"), 50 DRAW_LENGTH: _("Because the game exceed the max length"), 51 DRAW_BLACKINSUFFICIENTANDWHITETIME: 52 _("Because %(white)s ran out of time and %(black)s has insufficient material to mate"), 53 DRAW_WHITEINSUFFICIENTANDBLACKTIME: 54 _("Because %(black)s ran out of time and %(white)s has insufficient material to mate"), 55 DRAW_EQUALMATERIAL: 56 _("Because both players have the same amount of pieces"), 57 DRAW_KINGSINEIGHTROW: _("Because both king reached the eight row"), 58 WON_RESIGN: _("Because %(loser)s resigned"), 59 WON_CALLFLAG: _("Because %(loser)s ran out of time"), 60 WON_MATE: _("Because %(loser)s was checkmated"), 61 WON_DISCONNECTION: _("Because %(loser)s disconnected"), 62 WON_ADJUDICATION: _("Because of adjudication by an admin"), 63 WON_LESSMATERIAL: _("Because %(winner)s has fewer pieces"), 64 WON_NOMATERIAL: _("Because %(winner)s lost all pieces"), 65 WON_KINGEXPLODE: _("Because %(loser)s king exploded"), 66 WON_KINGINCENTER: _("Because %(winner)s king reached the center"), 67 WON_THREECHECK: _("Because %(winner)s was giving check 3 times"), 68 WON_KINGINEIGHTROW: _("Because %(winner)s king reached the eight row"), 69 WON_WIPEOUT: _("Because %(winner)s wiped out white horde"), 70 ADJOURNED_LOST_CONNECTION: _("Because a player lost connection"), 71 ADJOURNED_AGREEMENT: _("Because both players agreed to an adjournment"), 72 ADJOURNED_SERVER_SHUTDOWN: _("Because the server was shut down"), 73 ADJOURNED_COURTESY: 74 _("Because a player lost connection and the other player requested adjournment"), 75 ADJOURNED_COURTESY_WHITE: 76 _("Because %(black)s lost connection to the server and %(white)s requested adjournment"), 77 ADJOURNED_COURTESY_BLACK: 78 _("Because %(white)s lost connection to the server and %(black)s requested adjournment"), 79 ADJOURNED_LOST_CONNECTION_WHITE: 80 _("Because %(white)s lost connection to the server"), 81 ADJOURNED_LOST_CONNECTION_BLACK: 82 _("Because %(black)s lost connection to the server"), 83 ABORTED_ADJUDICATION: 84 _("Because of adjudication by an admin. No rating changes have occurred."), 85 ABORTED_AGREEMENT: 86 _("Because both players agreed to abort the game. No rating changes have occurred."), 87 ABORTED_COURTESY: 88 _("Because of courtesy by a player. No rating changes have occurred."), 89 ABORTED_EARLY: 90 _("Because a player aborted the game. Either player can abort the game without \ 91 the other's consent before the second move. No rating changes have occurred."), 92 ABORTED_DISCONNECTION: 93 _("Because a player disconnected and there are too few moves to warrant adjournment. No rating changes have occurred."), 94 ABORTED_SERVER_SHUTDOWN: 95 _("Because the server was shut down. No rating changes have occurred."), 96 WHITE_ENGINE_DIED: _("Because the %(white)s engine died"), 97 BLACK_ENGINE_DIED: _("Because the %(black)s engine died"), 98 DISCONNECTED: _("Because the connection to the server was lost"), 99 UNKNOWN_REASON: _("The reason is unknown"), 100 PRACTICE_GOAL_REACHED: _("Because practice goal reached"), 101} 102