π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Localize download skipped toast messages
ashilknb8d5a7ba1382
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arbindex e5493b2c40..af0502154f 100644--- a/mobile/apps/photos/lib/l10n/intl_en.arb+++ b/mobile/apps/photos/lib/l10n/intl_en.arb@@ -985,6 +985,39 @@"filesSavedToGallery": "Files saved to gallery","fileFailedToSaveToGallery": "Failed to save file to gallery","download": "Download",+ "downloadSkippedAlreadyAvailableOnDevice": "{fileName} is already available in the {albumName} album on your device",+ "@downloadSkippedAlreadyAvailableOnDevice": {+ "description": "Toast shown in single-file download flow when the file already exists locally",+ "placeholders": {+ "fileName": {+ "type": "String"+ },+ "albumName": {+ "type": "String"+ }+ }+ },+ "downloadSkippedInSelectionSingleFile": "Download of {fileName} skipped as it is already available in the {albumName} album on your device",+ "@downloadSkippedInSelectionSingleFile": {+ "description": "Toast shown after multi-selection download when exactly one selected file is skipped because it already exists locally",+ "placeholders": {+ "fileName": {+ "type": "String"+ },+ "albumName": {+ "type": "String"+ }+ }+ },+ "downloadSkippedInSelectionMultipleFiles": "Download of {fileCount} files skipped as they are already on your device",+ "@downloadSkippedInSelectionMultipleFiles": {+ "description": "Toast shown after multi-selection download when multiple selected files are skipped because they already exist locally",+ "placeholders": {+ "fileCount": {+ "type": "int"+ }+ }+ },"pressAndHoldToPlayVideo": "Press and hold to play video","pressAndHoldToPlayVideoDetailed": "Press and hold on the image to play video","downloadFailed": "Download failed",diff --git a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dartindex eb1aa48a8f..95efc97165 100644--- a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart@@ -1147,21 +1147,24 @@ class _FileSelectionActionsWidgetStateString finalMessage;if (skippedFilesCount > 0) {+ final l10n = AppLocalizations.of(context);if (skippedFilesCount == 1) {final skippedFile = skippedFiles.first;final folderName = await getLocalFolderNameForDownloadSkipToast(skippedFile,- fallbackFolderName: AppLocalizations.of(context).gallery,+ fallbackFolderName: l10n.gallery,);- finalMessage =- buildSingleFileDownloadSkippedInMultiSelectionToastMessage(- skippedFile,- folderName: folderName,- fallbackFileName: AppLocalizations.of(context).file,+ finalMessage = l10n.downloadSkippedInSelectionSingleFile(+ fileName: getDownloadSkipToastFileName(+ skippedFile,+ fallbackFileName: l10n.file,+ ),+ albumName: folderName,);} else {- finalMessage =- buildMultipleFilesDownloadSkippedToastMessage(skippedFilesCount);+ finalMessage = l10n.downloadSkippedInSelectionMultipleFiles(+ fileCount: skippedFilesCount,+ );}} else {finalMessage = AppLocalizations.of(context).filesSavedToGallery;diff --git a/mobile/apps/photos/lib/ui/viewer/file/file_app_bar.dart b/mobile/apps/photos/lib/ui/viewer/file/file_app_bar.dartindex e3c410d859..8c30ce2272 100644--- a/mobile/apps/photos/lib/ui/viewer/file/file_app_bar.dart+++ b/mobile/apps/photos/lib/ui/viewer/file/file_app_bar.dart@@ -625,12 +625,15 @@ class FileAppBarState extends State<FileAppBar> {fallbackFolderName: AppLocalizations.of(context).gallery,);if (mounted) {+ final l10n = AppLocalizations.of(context);showToast(context,- buildSingleFileDownloadSkippedToastMessage(- file,- folderName: folderName,- fallbackFileName: AppLocalizations.of(context).file,+ l10n.downloadSkippedAlreadyAvailableOnDevice(+ fileName: getDownloadSkipToastFileName(+ file,+ fallbackFileName: l10n.file,+ ),+ albumName: folderName,),iosLongToastLengthInSec: 4,);diff --git a/mobile/apps/photos/lib/utils/download_skip_toast_util.dart b/mobile/apps/photos/lib/utils/download_skip_toast_util.dartindex c24f655ef1..a513f5efa4 100644--- a/mobile/apps/photos/lib/utils/download_skip_toast_util.dart+++ b/mobile/apps/photos/lib/utils/download_skip_toast_util.dart@@ -1,39 +1,16 @@import "package:photos/models/file/file.dart";-String buildSingleFileDownloadSkippedToastMessage(+String getDownloadSkipToastFileName(EnteFile file, {- required String folderName,required String fallbackFileName,}) {final title = (file.title ?? "").trim();final displayName = file.displayName.trim();- final fileName = title.isNotEmpty+ return title.isNotEmpty? title: displayName.isNotEmpty? displayName: fallbackFileName;-- return "$fileName is already available in the $folderName album on your device";-}--String buildSingleFileDownloadSkippedInMultiSelectionToastMessage(- EnteFile file, {- required String folderName,- required String fallbackFileName,-}) {- final title = (file.title ?? "").trim();- final displayName = file.displayName.trim();- final fileName = title.isNotEmpty- ? title- : displayName.isNotEmpty- ? displayName- : fallbackFileName;-- return "Download of $fileName skipped as it is already available in the $folderName album on your device";-}--String buildMultipleFilesDownloadSkippedToastMessage(int fileCount) {- return "Download of $fileCount files skipped as they are already on your device";}Future<String> getLocalFolderNameForDownloadSkipToast(