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 169 : 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, String localizedString); 135 : 136 : String changedTheHistoryVisibility(String senderName); 137 : 138 : String changedTheHistoryVisibilityTo( 139 : String senderName, String localizedString); 140 : 141 : String activatedEndToEndEncryption(String senderName); 142 : 143 : String sentAPicture(String senderName); 144 : 145 : String sentAFile(String senderName); 146 : 147 : String sentAnAudio(String senderName); 148 : 149 : String sentAVideo(String senderName); 150 : 151 : String sentReaction(String senderName, String reactionKey); 152 : 153 : String sharedTheLocation(String senderName); 154 : 155 : String couldNotDecryptMessage(String errorText); 156 : 157 : String unknownEvent(String typeKey); 158 : 159 : String startedACall(String senderName); 160 : 161 : String endedTheCall(String senderName); 162 : 163 : String answeredTheCall(String senderName); 164 : 165 : String sentCallInformations(String senderName); 166 : 167 : String wasDirectChatDisplayName(String oldDisplayName); 168 : 169 : String hasKnocked(String targetName); 170 : 171 : String requestedKeyVerification(String senderName); 172 : 173 : String startedKeyVerification(String senderName); 174 : 175 : String acceptedKeyVerification(String senderName); 176 : 177 : String isReadyForKeyVerification(String senderName); 178 : 179 : String completedKeyVerification(String senderName); 180 : 181 : String canceledKeyVerification(String senderName); 182 : } 183 : 184 : extension HistoryVisibilityDisplayString on HistoryVisibility { 185 3 : String getLocalizedString(MatrixLocalizations i18n) { 186 : switch (this) { 187 3 : case HistoryVisibility.invited: 188 2 : return i18n.fromTheInvitation; 189 3 : case HistoryVisibility.joined: 190 2 : return i18n.fromJoining; 191 3 : case HistoryVisibility.shared: 192 3 : return i18n.visibleForAllParticipants; 193 2 : case HistoryVisibility.worldReadable: 194 2 : return i18n.visibleForEveryone; 195 : } 196 : } 197 : } 198 : 199 : extension GuestAccessDisplayString on GuestAccess { 200 2 : String getLocalizedString(MatrixLocalizations i18n) { 201 : switch (this) { 202 2 : case GuestAccess.canJoin: 203 2 : return i18n.guestsCanJoin; 204 2 : case GuestAccess.forbidden: 205 2 : return i18n.guestsAreForbidden; 206 : } 207 : } 208 : } 209 : 210 : extension JoinRulesDisplayString on JoinRules { 211 3 : String getLocalizedString(MatrixLocalizations i18n) { 212 : switch (this) { 213 3 : case JoinRules.public: 214 3 : return i18n.anyoneCanJoin; 215 2 : case JoinRules.invite: 216 2 : return i18n.invitedUsersOnly; 217 : default: 218 4 : return toString().replaceAll('JoinRules.', ''); 219 : } 220 : } 221 : }