fix: Localize ok cancel alert dialogs

This commit is contained in:
Christian Pauly 2021-02-18 14:23:22 +01:00
parent d5aa6e102c
commit 9f9b833c68
13 changed files with 37 additions and 4 deletions

View File

@ -69,6 +69,8 @@ class _ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
var confirmed = await showOkCancelAlertDialog( var confirmed = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context).areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context).cancel,
); );
if (confirmed == OkCancelResult.ok) { if (confirmed == OkCancelResult.ok) {
final success = await showFutureLoadingDialog( final success = await showFutureLoadingDialog(

View File

@ -151,6 +151,8 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
context: context, context: context,
title: widget.l10n.securityKeyLost, title: widget.l10n.securityKeyLost,
message: widget.l10n.wipeChatBackup, message: widget.l10n.wipeChatBackup,
okLabel: widget.l10n.ok,
cancelLabel: widget.l10n.cancel,
isDestructiveAction: true, isDestructiveAction: true,
)) { )) {
_createBootstrap(true); _createBootstrap(true);

View File

@ -39,6 +39,7 @@ class _EncryptionButtonState extends State<EncryptionButton> {
? L10n.of(context).warningEncryptionInBeta ? L10n.of(context).warningEncryptionInBeta
: L10n.of(context).needPantalaimonWarning, : L10n.of(context).needPantalaimonWarning,
okLabel: L10n.of(context).yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context).cancel,
) == ) ==
OkCancelResult.ok) { OkCancelResult.ok) {
await showFutureLoadingDialog( await showFutureLoadingDialog(

View File

@ -122,6 +122,8 @@ class ChatListItem extends StatelessWidget {
final confirmed = await showOkCancelAlertDialog( final confirmed = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context).areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context).no,
); );
if (confirmed == OkCancelResult.cancel) return; if (confirmed == OkCancelResult.cancel) return;
await showFutureLoadingDialog( await showFutureLoadingDialog(

View File

@ -321,6 +321,8 @@ class MatrixState extends State<Matrix> {
context: context, context: context,
title: L10n.of(context).newVerificationRequest, title: L10n.of(context).newVerificationRequest,
message: L10n.of(context).askVerificationRequest(request.userId), message: L10n.of(context).askVerificationRequest(request.userId),
okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context).cancel,
) == ) ==
OkCancelResult.ok) { OkCancelResult.ok) {
request.onUpdate = null; request.onUpdate = null;

View File

@ -27,9 +27,13 @@ class UserBottomSheet extends StatelessWidget {
}) : super(key: key); }) : super(key: key);
void participantAction(BuildContext context, String action) async { void participantAction(BuildContext context, String action) async {
final Function _askConfirmation = () async => final Function _askConfirmation =
(await showOkCancelAlertDialog( () async => (await showOkCancelAlertDialog(
context: context, title: l10n.areYouSure) == context: context,
title: l10n.areYouSure,
okLabel: l10n.yes,
cancelLabel: l10n.no,
) ==
OkCancelResult.ok); OkCancelResult.ok);
switch (action) { switch (action) {
case 'mention': case 'mention':

View File

@ -347,6 +347,7 @@ class _ChatState extends State<Chat> {
context: context, context: context,
title: L10n.of(context).messageWillBeRemovedWarning, title: L10n.of(context).messageWillBeRemovedWarning,
okLabel: L10n.of(context).remove, okLabel: L10n.of(context).remove,
cancelLabel: L10n.of(context).cancel,
) == ) ==
OkCancelResult.ok; OkCancelResult.ok;
if (!confirmed) return; if (!confirmed) return;

View File

@ -46,6 +46,8 @@ class _ChatEncryptionSettingsState extends State<ChatEncryptionSettings> {
context: context, context: context,
title: L10n.of(context).isDeviceKeyCorrect, title: L10n.of(context).isDeviceKeyCorrect,
message: key.ed25519Key.beautified, message: key.ed25519Key.beautified,
okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context).cancel,
) == ) ==
OkCancelResult.ok) { OkCancelResult.ok) {
await unblock(); await unblock();

View File

@ -185,6 +185,8 @@ class _ChatListState extends State<ChatList> {
final confirmed = await showOkCancelAlertDialog( final confirmed = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context).areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context).cancel,
) == ) ==
OkCancelResult.ok; OkCancelResult.ok;
if (!confirmed) return; if (!confirmed) return;

View File

@ -64,6 +64,7 @@ class _DiscoverState extends State<Discover> {
okLabel: L10n.of(context).joinRoom, okLabel: L10n.of(context).joinRoom,
title: '${room.name} (${room.numJoinedMembers ?? 0})', title: '${room.name} (${room.numJoinedMembers ?? 0})',
message: room.topic ?? L10n.of(context).noDescription, message: room.topic ?? L10n.of(context).noDescription,
cancelLabel: L10n.of(context).cancel,
) == ) ==
OkCancelResult.cancel) { OkCancelResult.cancel) {
return; return;

View File

@ -44,6 +44,8 @@ class _SettingsState extends State<Settings> {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context).areYouSureYouWantToLogout, title: L10n.of(context).areYouSureYouWantToLogout,
okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context).cancel,
) == ) ==
OkCancelResult.cancel) { OkCancelResult.cancel) {
return; return;
@ -91,12 +93,18 @@ class _SettingsState extends State<Settings> {
context: context, context: context,
title: L10n.of(context).warning, title: L10n.of(context).warning,
message: L10n.of(context).deactivateAccountWarning, message: L10n.of(context).deactivateAccountWarning,
okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context).cancel,
) == ) ==
OkCancelResult.cancel) { OkCancelResult.cancel) {
return; return;
} }
if (await showOkCancelAlertDialog( 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) { OkCancelResult.cancel) {
return; return;
} }
@ -512,6 +520,8 @@ class _SettingsState extends State<Settings> {
title: L10n.of(context).keysCached, title: L10n.of(context).keysCached,
message: L10n.of(context).wipeChatBackup, message: L10n.of(context).wipeChatBackup,
isDestructiveAction: true, isDestructiveAction: true,
okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context).cancel,
)) { )) {
await BootstrapDialog( await BootstrapDialog(
l10n: L10n.of(context), l10n: L10n.of(context),

View File

@ -76,6 +76,8 @@ class _Settings3PidState extends State<Settings3Pid> {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context).areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context).cancel,
) != ) !=
OkCancelResult.ok) { OkCancelResult.ok) {
return; return;

View File

@ -29,6 +29,8 @@ class DevicesSettingsState extends State<DevicesSettings> {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context).areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context).cancel,
) == ) ==
OkCancelResult.cancel) return; OkCancelResult.cancel) return;
var matrix = Matrix.of(context); var matrix = Matrix.of(context);