diff --git a/assets/l10n/app_en.arb b/assets/l10n/app_en.arb index 3fc24412fb..fadef524af 100644 --- a/assets/l10n/app_en.arb +++ b/assets/l10n/app_en.arb @@ -27,18 +27,22 @@ "@profileButtonSendDirectMessage": { "description": "Label for button in profile screen to navigate to DMs with the shown user." }, - "cameraAccessDeniedTitle": "Permissions needed", - "@cameraAccessDeniedTitle": { - "description": "Title for dialog when the user needs to grant permissions for camera access." + "permissionsNeededTitle": "Permissions needed", + "@permissionsNeededTitle": { + "description": "Title for dialog when the user needs to grant additional permissions." }, - "cameraAccessDeniedMessage": "To upload an image, please grant Zulip additional permissions in Settings.", - "@cameraAccessDeniedMessage": { - "description": "Message for dialog when the user needs to grant permissions for camera access." + "permissionsNeededOpenSettings": "Open settings", + "@permissionsNeededOpenSettings": { + "description": "Button label for permissions dialog button that opens the system settings screen." }, - "cameraAccessDeniedButtonText": "Open settings", - "@cameraAccessDeniedButtonText": { + "permissionsDeniedCameraAccess": "To upload an image, please grant Zulip additional permissions in Settings.", + "@permissionsDeniedCameraAccess": { "description": "Message for dialog when the user needs to grant permissions for camera access." }, + "permissionsDeniedReadExternalStorage": "To upload files, please grant Zulip additional permissions in Settings.", + "@permissionsDeniedReadExternalStorage": { + "description": "Message for dialog when the user needs to grant permissions for external storage read access." + }, "actionSheetOptionCopy": "Copy message text", "@actionSheetOptionCopy": { "description": "Label for copy message text button on action sheet." @@ -90,6 +94,10 @@ "@errorLoginFailedTitle": { "description": "Error title for login when signing into a Zulip server fails." }, + "errorMessageNotSent": "Message not sent", + "@errorMessageNotSent": { + "description": "Error message for compose box when a message could not be sent." + }, "errorLoginCouldNotConnect": "Failed to connect to server:\n{url}", "@errorLoginCouldNotConnect": { "description": "Error message when the app could not connect to the server.", @@ -159,6 +167,10 @@ "@errorDialogContinue": { "description": "Button label in error dialogs to acknowledge error." }, + "errorDialogTitle": "Error", + "@errorDialogTitle": { + "description": "Generic title for error dialog." + }, "lightboxCopyLinkTooltip": "Copy link", "@lightboxCopyLinkTooltip": { "description": "Tooltip in lightbox for the copy link action." diff --git a/lib/widgets/compose_box.dart b/lib/widgets/compose_box.dart index 488b9fdcdb..13ee962adc 100644 --- a/lib/widgets/compose_box.dart +++ b/lib/widgets/compose_box.dart @@ -539,6 +539,7 @@ Future> _getFilePickerFiles(BuildContext context, FileType type) .pickFiles(allowMultiple: true, withReadStream: true, type: type); } catch (e) { if (!context.mounted) return []; + final zulipLocalizations = ZulipLocalizations.of(context); if (e is PlatformException && e.code == 'read_external_storage_denied') { // Observed on Android. If Android's error message tells us whether the // user has checked "Don't ask again", it seems the library doesn't pass @@ -546,16 +547,17 @@ Future> _getFilePickerFiles(BuildContext context, FileType type) // If the user hasn't checked "Don't ask again", they can always dismiss // our prompt and retry, and the permissions request will reappear, // letting them grant permissions and complete the upload. - showSuggestedActionDialog(context: context, // TODO(i18n) - title: 'Permissions needed', - message: 'To upload files, please grant Zulip additional permissions in Settings.', - actionButtonText: 'Open settings', + showSuggestedActionDialog(context: context, + title: zulipLocalizations.permissionsNeededTitle, + message: zulipLocalizations.permissionsDeniedReadExternalStorage, + actionButtonText: zulipLocalizations.permissionsNeededOpenSettings, onActionButtonPress: () { AppSettings.openAppSettings(); }); } else { - // TODO(i18n) - showErrorDialog(context: context, title: 'Error', message: e.toString()); + showErrorDialog(context: context, + title: zulipLocalizations.errorDialogTitle, + message: e.toString()); } return []; } @@ -626,15 +628,16 @@ class _AttachFromCameraButton extends _AttachUploadsButton { // use a protected resource. After that, the only way the user can // grant it is in Settings. showSuggestedActionDialog(context: context, - title: zulipLocalizations.cameraAccessDeniedTitle, - message: zulipLocalizations.cameraAccessDeniedMessage, - actionButtonText: zulipLocalizations.cameraAccessDeniedButtonText, + title: zulipLocalizations.permissionsNeededTitle, + message: zulipLocalizations.permissionsDeniedCameraAccess, + actionButtonText: zulipLocalizations.permissionsNeededOpenSettings, onActionButtonPress: () { AppSettings.openAppSettings(); }); } else { - // TODO(i18n) - showErrorDialog(context: context, title: 'Error', message: e.toString()); + showErrorDialog(context: context, + title: zulipLocalizations.errorDialogTitle, + message: e.toString()); } return []; } @@ -712,7 +715,7 @@ class _SendButtonState extends State<_SendButton> { ]; showErrorDialog( context: context, - title: 'Message not sent', + title: zulipLocalizations.errorMessageNotSent, message: validationErrorMessages.join('\n\n')); return; }