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 167 : 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 youInvitedBy(String senderName); 64 : 65 : String youInvitedUser(String targetName); 66 : 67 : String youUnbannedUser(String targetName); 68 : 69 : String youBannedUser(String targetName); 70 : 71 : String youKicked(String targetName); 72 : 73 : String youKickedAndBanned(String targetName); 74 : 75 : String youHaveWithdrawnTheInvitationFor(String targetName); 76 : 77 : String groupWith(String displayname); 78 : 79 : String removedBy(Event redactedEvent); 80 : 81 : String sentASticker(String senderName); 82 : 83 : String redactedAnEvent(Event redactedEvent); 84 : 85 : String changedTheRoomAliases(String senderName); 86 : 87 : String changedTheRoomInvitationLink(String senderName); 88 : 89 : String createdTheChat(String senderName); 90 : 91 : String changedTheJoinRules(String senderName); 92 : 93 : String changedTheJoinRulesTo(String senderName, String localizedString); 94 : 95 : String acceptedTheInvitation(String targetName); 96 : 97 : String rejectedTheInvitation(String targetName); 98 : 99 : String hasWithdrawnTheInvitationFor(String senderName, String targetName); 100 : 101 : String joinedTheChat(String targetName); 102 : 103 : String kickedAndBanned(String senderName, String targetName); 104 : 105 : String kicked(String senderName, String targetName); 106 : 107 : String userLeftTheChat(String targetName); 108 : 109 : String bannedUser(String senderName, String targetName); 110 : 111 : String unbannedUser(String senderName, String targetName); 112 : 113 : String invitedUser(String senderName, String targetName); 114 : 115 : String changedTheProfileAvatar(String targetName); 116 : 117 : String changedTheDisplaynameTo(String targetName, String newDisplayname); 118 : 119 : String changedTheChatPermissions(String senderName); 120 : 121 : String changedTheChatNameTo(String senderName, String content); 122 : 123 : String changedTheChatDescriptionTo(String senderName, String content); 124 : 125 : String changedTheChatAvatar(String senderName); 126 : 127 : String changedTheGuestAccessRules(String senderName); 128 : 129 : String changedTheGuestAccessRulesTo( 130 : String senderName, String localizedString); 131 : 132 : String changedTheHistoryVisibility(String senderName); 133 : 134 : String changedTheHistoryVisibilityTo( 135 : String senderName, String localizedString); 136 : 137 : String activatedEndToEndEncryption(String senderName); 138 : 139 : String sentAPicture(String senderName); 140 : 141 : String sentAFile(String senderName); 142 : 143 : String sentAnAudio(String senderName); 144 : 145 : String sentAVideo(String senderName); 146 : 147 : String sentReaction(String senderName, String reactionKey); 148 : 149 : String sharedTheLocation(String senderName); 150 : 151 : String couldNotDecryptMessage(String errorText); 152 : 153 : String unknownEvent(String typeKey); 154 : 155 : String startedACall(String senderName); 156 : 157 : String endedTheCall(String senderName); 158 : 159 : String answeredTheCall(String senderName); 160 : 161 : String sentCallInformations(String senderName); 162 : 163 : String wasDirectChatDisplayName(String oldDisplayName); 164 : 165 : String hasKnocked(String targetName); 166 : 167 : String requestedKeyVerification(String senderName); 168 : 169 : String startedKeyVerification(String senderName); 170 : 171 : String acceptedKeyVerification(String senderName); 172 : 173 : String isReadyForKeyVerification(String senderName); 174 : 175 : String completedKeyVerification(String senderName); 176 : 177 : String canceledKeyVerification(String senderName); 178 : } 179 : 180 : extension HistoryVisibilityDisplayString on HistoryVisibility { 181 3 : String getLocalizedString(MatrixLocalizations i18n) { 182 : switch (this) { 183 3 : case HistoryVisibility.invited: 184 2 : return i18n.fromTheInvitation; 185 3 : case HistoryVisibility.joined: 186 2 : return i18n.fromJoining; 187 3 : case HistoryVisibility.shared: 188 3 : return i18n.visibleForAllParticipants; 189 2 : case HistoryVisibility.worldReadable: 190 2 : return i18n.visibleForEveryone; 191 : } 192 : } 193 : } 194 : 195 : extension GuestAccessDisplayString on GuestAccess { 196 2 : String getLocalizedString(MatrixLocalizations i18n) { 197 : switch (this) { 198 2 : case GuestAccess.canJoin: 199 2 : return i18n.guestsCanJoin; 200 2 : case GuestAccess.forbidden: 201 2 : return i18n.guestsAreForbidden; 202 : } 203 : } 204 : } 205 : 206 : extension JoinRulesDisplayString on JoinRules { 207 3 : String getLocalizedString(MatrixLocalizations i18n) { 208 : switch (this) { 209 3 : case JoinRules.public: 210 3 : return i18n.anyoneCanJoin; 211 2 : case JoinRules.invite: 212 2 : return i18n.invitedUsersOnly; 213 : default: 214 4 : return toString().replaceAll('JoinRules.', ''); 215 : } 216 : } 217 : }