feat: Add missing localizations for key verification messages
This commit is contained in:
parent
a50946d775
commit
4906ae02cf
|
|
@ -50,6 +50,24 @@ abstract class EventLocalizations {
|
|||
event.senderFromMemoryOrFallback.calcDisplayname(i18n: i18n));
|
||||
case MessageTypes.Emote:
|
||||
return '* $body';
|
||||
case EventTypes.KeyVerificationRequest:
|
||||
return i18n.requestedKeyVerification(
|
||||
event.senderFromMemoryOrFallback.calcDisplayname(i18n: i18n));
|
||||
case EventTypes.KeyVerificationCancel:
|
||||
return i18n.canceledKeyVerification(
|
||||
event.senderFromMemoryOrFallback.calcDisplayname(i18n: i18n));
|
||||
case EventTypes.KeyVerificationDone:
|
||||
return i18n.completedKeyVerification(
|
||||
event.senderFromMemoryOrFallback.calcDisplayname(i18n: i18n));
|
||||
case EventTypes.KeyVerificationReady:
|
||||
return i18n.isReadyForKeyVerification(
|
||||
event.senderFromMemoryOrFallback.calcDisplayname(i18n: i18n));
|
||||
case EventTypes.KeyVerificationAccept:
|
||||
return i18n.acceptedKeyVerification(
|
||||
event.senderFromMemoryOrFallback.calcDisplayname(i18n: i18n));
|
||||
case EventTypes.KeyVerificationStart:
|
||||
return i18n.startedKeyVerification(
|
||||
event.senderFromMemoryOrFallback.calcDisplayname(i18n: i18n));
|
||||
case MessageTypes.BadEncrypted:
|
||||
String errorText;
|
||||
switch (event.body) {
|
||||
|
|
|
|||
|
|
@ -277,4 +277,28 @@ class MatrixDefaultLocalizations extends MatrixLocalizations {
|
|||
|
||||
@override
|
||||
String hasKnocked(String targetName) => '$targetName has knocked';
|
||||
|
||||
@override
|
||||
String acceptedKeyVerification(String senderName) =>
|
||||
'$senderName accepted key verification request';
|
||||
|
||||
@override
|
||||
String canceledKeyVerification(String senderName) =>
|
||||
'$senderName canceled key verification';
|
||||
|
||||
@override
|
||||
String completedKeyVerification(String senderName) =>
|
||||
'$senderName completed key verification';
|
||||
|
||||
@override
|
||||
String isReadyForKeyVerification(String senderName) =>
|
||||
'$senderName is ready for key verification';
|
||||
|
||||
@override
|
||||
String requestedKeyVerification(String senderName) =>
|
||||
'$senderName requested key verification';
|
||||
|
||||
@override
|
||||
String startedKeyVerification(String senderName) =>
|
||||
'$senderName started key verification';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,6 +163,18 @@ abstract class MatrixLocalizations {
|
|||
String wasDirectChatDisplayName(String oldDisplayName);
|
||||
|
||||
String hasKnocked(String targetName);
|
||||
|
||||
String requestedKeyVerification(String senderName);
|
||||
|
||||
String startedKeyVerification(String senderName);
|
||||
|
||||
String acceptedKeyVerification(String senderName);
|
||||
|
||||
String isReadyForKeyVerification(String senderName);
|
||||
|
||||
String completedKeyVerification(String senderName);
|
||||
|
||||
String canceledKeyVerification(String senderName);
|
||||
}
|
||||
|
||||
extension HistoryVisibilityDisplayString on HistoryVisibility {
|
||||
|
|
|
|||
|
|
@ -1089,6 +1089,57 @@ void main() {
|
|||
plaintextBody: true,
|
||||
withSenderNamePrefix: true),
|
||||
'Example: Title\nsome text and 🔗link\nokay and this is important');
|
||||
|
||||
event = Event.fromJson({
|
||||
'content': {
|
||||
'body':
|
||||
'Alice is requesting to verify your device, but your client does not support verification, so you may need to use a different verification method.',
|
||||
'from_device': 'AliceDevice2',
|
||||
'methods': ['m.sas.v1'],
|
||||
'msgtype': 'm.key.verification.request',
|
||||
'to': '@bob:example.org'
|
||||
},
|
||||
'event_id': '\$143273582443PhrSn:example.org',
|
||||
'origin_server_ts': 1432735824653,
|
||||
'room_id': '!jEsUZKDJdhlrceRyVU:example.org',
|
||||
'sender': '@example:example.org',
|
||||
'type': 'm.room.message',
|
||||
'unsigned': {'age': 1234}
|
||||
}, room);
|
||||
expect(
|
||||
await event.calcLocalizedBody(MatrixDefaultLocalizations()),
|
||||
'Example requested key verification',
|
||||
);
|
||||
|
||||
event.content['msgtype'] = 'm.key.verification.ready';
|
||||
expect(
|
||||
await event.calcLocalizedBody(MatrixDefaultLocalizations()),
|
||||
'Example is ready for key verification',
|
||||
);
|
||||
|
||||
event.content['msgtype'] = 'm.key.verification.start';
|
||||
expect(
|
||||
await event.calcLocalizedBody(MatrixDefaultLocalizations()),
|
||||
'Example started key verification',
|
||||
);
|
||||
|
||||
event.content['msgtype'] = 'm.key.verification.cancel';
|
||||
expect(
|
||||
await event.calcLocalizedBody(MatrixDefaultLocalizations()),
|
||||
'Example canceled key verification',
|
||||
);
|
||||
|
||||
event.content['msgtype'] = 'm.key.verification.done';
|
||||
expect(
|
||||
await event.calcLocalizedBody(MatrixDefaultLocalizations()),
|
||||
'Example completed key verification',
|
||||
);
|
||||
|
||||
event.content['msgtype'] = 'm.key.verification.accept';
|
||||
expect(
|
||||
await event.calcLocalizedBody(MatrixDefaultLocalizations()),
|
||||
'Example accepted key verification request',
|
||||
);
|
||||
});
|
||||
|
||||
test('aggregations', () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue