Line data Source code
1 : /* 2 : * Famedly Matrix SDK 3 : * Copyright (C) 2020, 2021 Famedly GmbH 4 : * 5 : * This program is free software: you can redistribute it and/or modify 6 : * it under the terms of the GNU Affero General Public License as 7 : * published by the Free Software Foundation, either version 3 of the 8 : * License, or (at your option) any later version. 9 : * 10 : * This program is distributed in the hope that it will be useful, 11 : * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 : * GNU Affero General Public License for more details. 14 : * 15 : * You should have received a copy of the GNU Affero General Public License 16 : * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 : */ 18 : 19 : import 'package:matrix/matrix.dart'; 20 : 21 : abstract class MatrixLocalizations { 22 170 : const MatrixLocalizations(); 23 : String get emptyChat; 24 : 25 : String get invitedUsersOnly; 26 : 27 : String get fromTheInvitation; 28 : 29 : String get fromJoining; 30 : 31 : String get visibleForAllParticipants; 32 : 33 : String get visibleForEveryone; 34 : 35 : String get guestsCanJoin; 36 : 37 : String get guestsAreForbidden; 38 : 39 : String get anyoneCanJoin; 40 : 41 : String get needPantalaimonWarning; 42 : 43 : String get channelCorruptedDecryptError; 44 : 45 : String get encryptionNotEnabled; 46 : 47 : String get unknownEncryptionAlgorithm; 48 : 49 : String get noPermission; 50 : 51 : String get you; 52 : 53 : String get roomHasBeenUpgraded; 54 : 55 : String get youAcceptedTheInvitation; 56 : 57 : String get youRejectedTheInvitation; 58 : 59 : String get youJoinedTheChat; 60 : 61 : String get unknownUser; 62 : 63 : String get cancelledSend; 64 : 65 : String youInvitedBy(String senderName); 66 : 67 : String invitedBy(String senderName); 68 : 69 : String youInvitedUser(String targetName); 70 : 71 : String youUnbannedUser(String targetName); 72 : 73 : String youBannedUser(String targetName); 74 : 75 : String youKicked(String targetName); 76 : 77 : String youKickedAndBanned(String targetName); 78 : 79 : String youHaveWithdrawnTheInvitationFor(String targetName); 80 : 81 : String groupWith(String displayname); 82 : 83 : String removedBy(Event redactedEvent); 84 : 85 : String sentASticker(String senderName); 86 : 87 : String redactedAnEvent(Event redactedEvent); 88 : 89 : String changedTheRoomAliases(String senderName); 90 : 91 : String changedTheRoomInvitationLink(String senderName); 92 : 93 : String createdTheChat(String senderName); 94 : 95 : String changedTheJoinRules(String senderName); 96 : 97 : String changedTheJoinRulesTo(String senderName, String localizedString); 98 : 99 : String acceptedTheInvitation(String targetName); 100 : 101 : String rejectedTheInvitation(String targetName); 102 : 103 : String hasWithdrawnTheInvitationFor(String senderName, String targetName); 104 : 105 : String joinedTheChat(String targetName); 106 : 107 : String kickedAndBanned(String senderName, String targetName); 108 : 109 : String kicked(String senderName, String targetName); 110 : 111 : String userLeftTheChat(String targetName); 112 : 113 : String bannedUser(String senderName, String targetName); 114 : 115 : String unbannedUser(String senderName, String targetName); 116 : 117 : String invitedUser(String senderName, String targetName); 118 : 119 : String changedTheProfileAvatar(String targetName); 120 : 121 : String changedTheDisplaynameTo(String targetName, String newDisplayname); 122 : 123 : String changedTheChatPermissions(String senderName); 124 : 125 : String changedTheChatNameTo(String senderName, String content); 126 : 127 : String changedTheChatDescriptionTo(String senderName, String content); 128 : 129 : String changedTheChatAvatar(String senderName); 130 : 131 : String changedTheGuestAccessRules(String senderName); 132 : 133 : String changedTheGuestAccessRulesTo( 134 : String senderName, 135 : String localizedString, 136 : ); 137 : 138 : String changedTheHistoryVisibility(String senderName); 139 : 140 : String changedTheHistoryVisibilityTo( 141 : String senderName, 142 : String localizedString, 143 : ); 144 : 145 : String activatedEndToEndEncryption(String senderName); 146 : 147 : String sentAPicture(String senderName); 148 : 149 : String sentAFile(String senderName); 150 : 151 : String sentAnAudio(String senderName); 152 : 153 : String sentAVideo(String senderName); 154 : 155 : String sentReaction(String senderName, String reactionKey); 156 : 157 : String sharedTheLocation(String senderName); 158 : 159 : String couldNotDecryptMessage(String errorText); 160 : 161 : String unknownEvent(String typeKey); 162 : 163 : String startedACall(String senderName); 164 : 165 : String endedTheCall(String senderName); 166 : 167 : String answeredTheCall(String senderName); 168 : 169 : String sentCallInformations(String senderName); 170 : 171 : String wasDirectChatDisplayName(String oldDisplayName); 172 : 173 : String hasKnocked(String targetName); 174 : 175 : String requestedKeyVerification(String senderName); 176 : 177 : String startedKeyVerification(String senderName); 178 : 179 : String acceptedKeyVerification(String senderName); 180 : 181 : String isReadyForKeyVerification(String senderName); 182 : 183 : String completedKeyVerification(String senderName); 184 : 185 : String canceledKeyVerification(String senderName); 186 : } 187 : 188 : extension HistoryVisibilityDisplayString on HistoryVisibility { 189 4 : String getLocalizedString(MatrixLocalizations i18n) { 190 : switch (this) { 191 4 : case HistoryVisibility.invited: 192 2 : return i18n.fromTheInvitation; 193 4 : case HistoryVisibility.joined: 194 2 : return i18n.fromJoining; 195 4 : case HistoryVisibility.shared: 196 4 : return i18n.visibleForAllParticipants; 197 2 : case HistoryVisibility.worldReadable: 198 2 : return i18n.visibleForEveryone; 199 : } 200 : } 201 : } 202 : 203 : extension GuestAccessDisplayString on GuestAccess { 204 2 : String getLocalizedString(MatrixLocalizations i18n) { 205 : switch (this) { 206 2 : case GuestAccess.canJoin: 207 2 : return i18n.guestsCanJoin; 208 2 : case GuestAccess.forbidden: 209 2 : return i18n.guestsAreForbidden; 210 : } 211 : } 212 : } 213 : 214 : extension JoinRulesDisplayString on JoinRules { 215 4 : String getLocalizedString(MatrixLocalizations i18n) { 216 : switch (this) { 217 4 : case JoinRules.public: 218 4 : return i18n.anyoneCanJoin; 219 2 : case JoinRules.invite: 220 2 : return i18n.invitedUsersOnly; 221 : default: 222 4 : return toString().replaceAll('JoinRules.', ''); 223 : } 224 : } 225 : }