From 9f9b833c688405bf8df436365fee6323ac07afaf Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Thu, 18 Feb 2021 14:23:22 +0100 Subject: [PATCH] fix: Localize ok cancel alert dialogs --- lib/components/chat_settings_popup_menu.dart | 2 ++ lib/components/dialogs/bootstrap_dialog.dart | 2 ++ lib/components/encryption_button.dart | 1 + lib/components/list_items/chat_list_item.dart | 2 ++ lib/components/matrix.dart | 2 ++ lib/components/user_bottom_sheet.dart | 10 +++++++--- lib/views/chat.dart | 1 + lib/views/chat_encryption_settings.dart | 2 ++ lib/views/chat_list.dart | 2 ++ lib/views/discover.dart | 1 + lib/views/settings.dart | 12 +++++++++++- lib/views/settings_3pid.dart | 2 ++ lib/views/settings_devices.dart | 2 ++ 13 files changed, 37 insertions(+), 4 deletions(-) diff --git a/lib/components/chat_settings_popup_menu.dart b/lib/components/chat_settings_popup_menu.dart index bab4f026..188eea14 100644 --- a/lib/components/chat_settings_popup_menu.dart +++ b/lib/components/chat_settings_popup_menu.dart @@ -69,6 +69,8 @@ class _ChatSettingsPopupMenuState extends State { var confirmed = await showOkCancelAlertDialog( context: context, title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, ); if (confirmed == OkCancelResult.ok) { final success = await showFutureLoadingDialog( diff --git a/lib/components/dialogs/bootstrap_dialog.dart b/lib/components/dialogs/bootstrap_dialog.dart index c1afec9b..27678a82 100644 --- a/lib/components/dialogs/bootstrap_dialog.dart +++ b/lib/components/dialogs/bootstrap_dialog.dart @@ -151,6 +151,8 @@ class _BootstrapDialogState extends State { context: context, title: widget.l10n.securityKeyLost, message: widget.l10n.wipeChatBackup, + okLabel: widget.l10n.ok, + cancelLabel: widget.l10n.cancel, isDestructiveAction: true, )) { _createBootstrap(true); diff --git a/lib/components/encryption_button.dart b/lib/components/encryption_button.dart index 489d7e99..ee7efd85 100644 --- a/lib/components/encryption_button.dart +++ b/lib/components/encryption_button.dart @@ -39,6 +39,7 @@ class _EncryptionButtonState extends State { ? L10n.of(context).warningEncryptionInBeta : L10n.of(context).needPantalaimonWarning, okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).cancel, ) == OkCancelResult.ok) { await showFutureLoadingDialog( diff --git a/lib/components/list_items/chat_list_item.dart b/lib/components/list_items/chat_list_item.dart index 006acebf..bf552323 100644 --- a/lib/components/list_items/chat_list_item.dart +++ b/lib/components/list_items/chat_list_item.dart @@ -122,6 +122,8 @@ class ChatListItem extends StatelessWidget { final confirmed = await showOkCancelAlertDialog( context: context, title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).no, ); if (confirmed == OkCancelResult.cancel) return; await showFutureLoadingDialog( diff --git a/lib/components/matrix.dart b/lib/components/matrix.dart index d8863859..39fc3dd3 100644 --- a/lib/components/matrix.dart +++ b/lib/components/matrix.dart @@ -321,6 +321,8 @@ class MatrixState extends State { context: context, title: L10n.of(context).newVerificationRequest, message: L10n.of(context).askVerificationRequest(request.userId), + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, ) == OkCancelResult.ok) { request.onUpdate = null; diff --git a/lib/components/user_bottom_sheet.dart b/lib/components/user_bottom_sheet.dart index edbf184c..aa6d82c0 100644 --- a/lib/components/user_bottom_sheet.dart +++ b/lib/components/user_bottom_sheet.dart @@ -27,9 +27,13 @@ class UserBottomSheet extends StatelessWidget { }) : super(key: key); void participantAction(BuildContext context, String action) async { - final Function _askConfirmation = () async => - (await showOkCancelAlertDialog( - context: context, title: l10n.areYouSure) == + final Function _askConfirmation = + () async => (await showOkCancelAlertDialog( + context: context, + title: l10n.areYouSure, + okLabel: l10n.yes, + cancelLabel: l10n.no, + ) == OkCancelResult.ok); switch (action) { case 'mention': diff --git a/lib/views/chat.dart b/lib/views/chat.dart index fb225b81..80e94a08 100644 --- a/lib/views/chat.dart +++ b/lib/views/chat.dart @@ -347,6 +347,7 @@ class _ChatState extends State { context: context, title: L10n.of(context).messageWillBeRemovedWarning, okLabel: L10n.of(context).remove, + cancelLabel: L10n.of(context).cancel, ) == OkCancelResult.ok; if (!confirmed) return; diff --git a/lib/views/chat_encryption_settings.dart b/lib/views/chat_encryption_settings.dart index 0bb48a0f..f59bd742 100644 --- a/lib/views/chat_encryption_settings.dart +++ b/lib/views/chat_encryption_settings.dart @@ -46,6 +46,8 @@ class _ChatEncryptionSettingsState extends State { context: context, title: L10n.of(context).isDeviceKeyCorrect, message: key.ed25519Key.beautified, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, ) == OkCancelResult.ok) { await unblock(); diff --git a/lib/views/chat_list.dart b/lib/views/chat_list.dart index df9a5468..24e95795 100644 --- a/lib/views/chat_list.dart +++ b/lib/views/chat_list.dart @@ -185,6 +185,8 @@ class _ChatListState extends State { final confirmed = await showOkCancelAlertDialog( context: context, title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).cancel, ) == OkCancelResult.ok; if (!confirmed) return; diff --git a/lib/views/discover.dart b/lib/views/discover.dart index 4f8ed2c8..9890d26b 100644 --- a/lib/views/discover.dart +++ b/lib/views/discover.dart @@ -64,6 +64,7 @@ class _DiscoverState extends State { okLabel: L10n.of(context).joinRoom, title: '${room.name} (${room.numJoinedMembers ?? 0})', message: room.topic ?? L10n.of(context).noDescription, + cancelLabel: L10n.of(context).cancel, ) == OkCancelResult.cancel) { return; diff --git a/lib/views/settings.dart b/lib/views/settings.dart index ac87bda6..f5c06252 100644 --- a/lib/views/settings.dart +++ b/lib/views/settings.dart @@ -44,6 +44,8 @@ class _SettingsState extends State { if (await showOkCancelAlertDialog( context: context, title: L10n.of(context).areYouSureYouWantToLogout, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).cancel, ) == OkCancelResult.cancel) { return; @@ -91,12 +93,18 @@ class _SettingsState extends State { context: context, title: L10n.of(context).warning, message: L10n.of(context).deactivateAccountWarning, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, ) == OkCancelResult.cancel) { return; } if (await showOkCancelAlertDialog( - context: context, title: L10n.of(context).areYouSure) == + context: context, + title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).cancel, + ) == OkCancelResult.cancel) { return; } @@ -512,6 +520,8 @@ class _SettingsState extends State { title: L10n.of(context).keysCached, message: L10n.of(context).wipeChatBackup, isDestructiveAction: true, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, )) { await BootstrapDialog( l10n: L10n.of(context), diff --git a/lib/views/settings_3pid.dart b/lib/views/settings_3pid.dart index ea0f89cd..76b1c45a 100644 --- a/lib/views/settings_3pid.dart +++ b/lib/views/settings_3pid.dart @@ -76,6 +76,8 @@ class _Settings3PidState extends State { if (await showOkCancelAlertDialog( context: context, title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).cancel, ) != OkCancelResult.ok) { return; diff --git a/lib/views/settings_devices.dart b/lib/views/settings_devices.dart index 8f896635..0b3fdcfe 100644 --- a/lib/views/settings_devices.dart +++ b/lib/views/settings_devices.dart @@ -29,6 +29,8 @@ class DevicesSettingsState extends State { if (await showOkCancelAlertDialog( context: context, title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).cancel, ) == OkCancelResult.cancel) return; var matrix = Matrix.of(context);