ソースを参照

l10n: extract strings

Neeraj Gupta 2 年 前
コミット
1880c1fe9d

+ 31 - 0
lib/generated/intl/messages_en.dart

@@ -376,6 +376,8 @@ class MessageLookup extends MessageLookupByLibrary {
                 "Copy-paste this code\nto your authenticator app"),
         "couldNotBackUpTryLater": MessageLookupByLibrary.simpleMessage(
             "We could not backup your data.\nWe will retry later."),
+        "couldNotFreeUpSpace":
+            MessageLookupByLibrary.simpleMessage("Could not free up space"),
         "couldNotUpdateSubscription": MessageLookupByLibrary.simpleMessage(
             "Could not update subscription"),
         "count": MessageLookupByLibrary.simpleMessage("Count"),
@@ -482,6 +484,8 @@ class MessageLookup extends MessageLookupByLibrary {
         "email": MessageLookupByLibrary.simpleMessage("Email"),
         "emailChangedTo": m12,
         "emailNoEnteAccount": m13,
+        "empty": MessageLookupByLibrary.simpleMessage("Empty"),
+        "emptyTrash": MessageLookupByLibrary.simpleMessage("Empty trash?"),
         "encryptingBackup":
             MessageLookupByLibrary.simpleMessage("Encrypting backup..."),
         "encryption": MessageLookupByLibrary.simpleMessage("Encryption"),
@@ -524,6 +528,7 @@ class MessageLookup extends MessageLookupByLibrary {
             MessageLookupByLibrary.simpleMessage("Enter your password"),
         "enterYourRecoveryKey":
             MessageLookupByLibrary.simpleMessage("Enter your recovery key"),
+        "error": MessageLookupByLibrary.simpleMessage("Error"),
         "everywhere": MessageLookupByLibrary.simpleMessage("everywhere"),
         "exif": MessageLookupByLibrary.simpleMessage("EXIF"),
         "existingUser": MessageLookupByLibrary.simpleMessage("Existing user"),
@@ -554,6 +559,7 @@ class MessageLookup extends MessageLookupByLibrary {
             MessageLookupByLibrary.simpleMessage("File saved to gallery"),
         "filesBackedUpFromDevice": m14,
         "filesBackedUpInAlbum": m15,
+        "filesDeleted": MessageLookupByLibrary.simpleMessage("Files deleted"),
         "forYourMemories":
             MessageLookupByLibrary.simpleMessage("for your memories"),
         "forgotPassword":
@@ -607,6 +613,9 @@ class MessageLookup extends MessageLookupByLibrary {
         "inviteToEnte": MessageLookupByLibrary.simpleMessage("Invite to ente"),
         "inviteYourFriends":
             MessageLookupByLibrary.simpleMessage("Invite your friends"),
+        "itLooksLikeSomethingWentWrongPleaseRetryAfterSome":
+            MessageLookupByLibrary.simpleMessage(
+                "It looks like something went wrong. Please retry after some time. If the error persists, please contact our support team."),
         "itemCount": m21,
         "itemSelectedCount": m22,
         "itemsShowTheNumberOfDaysRemainingBeforePermanentDeletion":
@@ -721,8 +730,12 @@ class MessageLookup extends MessageLookupByLibrary {
         "paymentFailedWithReason": m30,
         "peopleUsingYourCode":
             MessageLookupByLibrary.simpleMessage("People using your code"),
+        "permDeleteWarning": MessageLookupByLibrary.simpleMessage(
+            "All items in trash will be permanently deleted\n\nThis action cannot be undone"),
         "permanentlyDelete":
             MessageLookupByLibrary.simpleMessage("Permanently delete"),
+        "permanentlyDeleteFromDevice": MessageLookupByLibrary.simpleMessage(
+            "Permanently delete from device?"),
         "photoGridSize":
             MessageLookupByLibrary.simpleMessage("Photo grid size"),
         "photoSmallCase": MessageLookupByLibrary.simpleMessage("photo"),
@@ -876,9 +889,14 @@ class MessageLookup extends MessageLookupByLibrary {
         "selectReason": MessageLookupByLibrary.simpleMessage("Select reason"),
         "selectYourPlan":
             MessageLookupByLibrary.simpleMessage("Select your plan"),
+        "selectedFilesAreNotOnEnte": MessageLookupByLibrary.simpleMessage(
+            "Selected files are not on ente"),
         "selectedFoldersWillBeEncryptedAndBackedUp":
             MessageLookupByLibrary.simpleMessage(
                 "Selected folders will be encrypted and backed up"),
+        "selectedItemsWillBeDeletedFromAllAlbumsAndMoved":
+            MessageLookupByLibrary.simpleMessage(
+                "Selected items will be deleted from all albums and moved to trash."),
         "selectedPhotos": m35,
         "selectedPhotosWithYours": m36,
         "send": MessageLookupByLibrary.simpleMessage("Send"),
@@ -924,6 +942,12 @@ class MessageLookup extends MessageLookupByLibrary {
         "singleFileInRemoteOnly": m44,
         "skip": MessageLookupByLibrary.simpleMessage("Skip"),
         "social": MessageLookupByLibrary.simpleMessage("Social"),
+        "someItemsAreInBothEnteAndYourDevice":
+            MessageLookupByLibrary.simpleMessage(
+                "Some items are in both ente and your device."),
+        "someOfTheFilesYouAreTryingToDeleteAre":
+            MessageLookupByLibrary.simpleMessage(
+                "Some of the files you are trying to delete are only available on your device and cannot be recovered if deleted"),
         "someoneSharingAlbumsWithYouShouldSeeTheSameId":
             MessageLookupByLibrary.simpleMessage(
                 "Someone sharing albums with you should see the same ID on their device."),
@@ -989,7 +1013,14 @@ class MessageLookup extends MessageLookupByLibrary {
             MessageLookupByLibrary.simpleMessage(
                 "The recovery key you entered is incorrect"),
         "theme": MessageLookupByLibrary.simpleMessage("Theme"),
+        "theseItemsWillBeDeletedFromYourDevice":
+            MessageLookupByLibrary.simpleMessage(
+                "These items will be deleted from your device."),
         "theyAlsoGetXGb": m49,
+        "theyWillBeDeletedFromAllAlbums": MessageLookupByLibrary.simpleMessage(
+            "They will be deleted from all albums."),
+        "thisActionCannotBeUndone": MessageLookupByLibrary.simpleMessage(
+            "This action cannot be undone"),
         "thisAlbumAlreadyHDACollaborativeLink":
             MessageLookupByLibrary.simpleMessage(
                 "This album already has a collaborative link"),

+ 150 - 0
lib/generated/l10n.dart

@@ -6141,6 +6141,156 @@ class S {
       args: [],
     );
   }
+
+  /// `Files deleted`
+  String get filesDeleted {
+    return Intl.message(
+      'Files deleted',
+      name: 'filesDeleted',
+      desc: '',
+      args: [],
+    );
+  }
+
+  /// `Selected files are not on ente`
+  String get selectedFilesAreNotOnEnte {
+    return Intl.message(
+      'Selected files are not on ente',
+      name: 'selectedFilesAreNotOnEnte',
+      desc: '',
+      args: [],
+    );
+  }
+
+  /// `This action cannot be undone`
+  String get thisActionCannotBeUndone {
+    return Intl.message(
+      'This action cannot be undone',
+      name: 'thisActionCannotBeUndone',
+      desc: '',
+      args: [],
+    );
+  }
+
+  /// `Empty trash?`
+  String get emptyTrash {
+    return Intl.message(
+      'Empty trash?',
+      name: 'emptyTrash',
+      desc: '',
+      args: [],
+    );
+  }
+
+  /// `All items in trash will be permanently deleted\n\nThis action cannot be undone`
+  String get permDeleteWarning {
+    return Intl.message(
+      'All items in trash will be permanently deleted\n\nThis action cannot be undone',
+      name: 'permDeleteWarning',
+      desc: '',
+      args: [],
+    );
+  }
+
+  /// `Empty`
+  String get empty {
+    return Intl.message(
+      'Empty',
+      name: 'empty',
+      desc: '',
+      args: [],
+    );
+  }
+
+  /// `Could not free up space`
+  String get couldNotFreeUpSpace {
+    return Intl.message(
+      'Could not free up space',
+      name: 'couldNotFreeUpSpace',
+      desc: '',
+      args: [],
+    );
+  }
+
+  /// `Permanently delete from device?`
+  String get permanentlyDeleteFromDevice {
+    return Intl.message(
+      'Permanently delete from device?',
+      name: 'permanentlyDeleteFromDevice',
+      desc: '',
+      args: [],
+    );
+  }
+
+  /// `Some of the files you are trying to delete are only available on your device and cannot be recovered if deleted`
+  String get someOfTheFilesYouAreTryingToDeleteAre {
+    return Intl.message(
+      'Some of the files you are trying to delete are only available on your device and cannot be recovered if deleted',
+      name: 'someOfTheFilesYouAreTryingToDeleteAre',
+      desc: '',
+      args: [],
+    );
+  }
+
+  /// `They will be deleted from all albums.`
+  String get theyWillBeDeletedFromAllAlbums {
+    return Intl.message(
+      'They will be deleted from all albums.',
+      name: 'theyWillBeDeletedFromAllAlbums',
+      desc: '',
+      args: [],
+    );
+  }
+
+  /// `Some items are in both ente and your device.`
+  String get someItemsAreInBothEnteAndYourDevice {
+    return Intl.message(
+      'Some items are in both ente and your device.',
+      name: 'someItemsAreInBothEnteAndYourDevice',
+      desc: '',
+      args: [],
+    );
+  }
+
+  /// `Selected items will be deleted from all albums and moved to trash.`
+  String get selectedItemsWillBeDeletedFromAllAlbumsAndMoved {
+    return Intl.message(
+      'Selected items will be deleted from all albums and moved to trash.',
+      name: 'selectedItemsWillBeDeletedFromAllAlbumsAndMoved',
+      desc: '',
+      args: [],
+    );
+  }
+
+  /// `These items will be deleted from your device.`
+  String get theseItemsWillBeDeletedFromYourDevice {
+    return Intl.message(
+      'These items will be deleted from your device.',
+      name: 'theseItemsWillBeDeletedFromYourDevice',
+      desc: '',
+      args: [],
+    );
+  }
+
+  /// `It looks like something went wrong. Please retry after some time. If the error persists, please contact our support team.`
+  String get itLooksLikeSomethingWentWrongPleaseRetryAfterSome {
+    return Intl.message(
+      'It looks like something went wrong. Please retry after some time. If the error persists, please contact our support team.',
+      name: 'itLooksLikeSomethingWentWrongPleaseRetryAfterSome',
+      desc: '',
+      args: [],
+    );
+  }
+
+  /// `Error`
+  String get error {
+    return Intl.message(
+      'Error',
+      name: 'error',
+      desc: '',
+      args: [],
+    );
+  }
 }
 
 class AppLocalizationDelegate extends LocalizationsDelegate<S> {

+ 16 - 1
lib/l10n/intl_en.arb

@@ -883,5 +883,20 @@
   "successfullyArchived": "Successfully archived",
   "successfullyUnarchived": "Successfully unarchived",
   "renameFile": "Rename file",
-  "enterFileName": "Enter file name"
+  "enterFileName": "Enter file name",
+  "filesDeleted": "Files deleted",
+  "selectedFilesAreNotOnEnte": "Selected files are not on ente",
+  "thisActionCannotBeUndone": "This action cannot be undone",
+  "emptyTrash": "Empty trash?",
+  "permDeleteWarning": "All items in trash will be permanently deleted\n\nThis action cannot be undone",
+  "empty": "Empty",
+  "couldNotFreeUpSpace": "Could not free up space",
+  "permanentlyDeleteFromDevice": "Permanently delete from device?",
+  "someOfTheFilesYouAreTryingToDeleteAre": "Some of the files you are trying to delete are only available on your device and cannot be recovered if deleted",
+  "theyWillBeDeletedFromAllAlbums": "They will be deleted from all albums.",
+  "someItemsAreInBothEnteAndYourDevice": "Some items are in both ente and your device.",
+  "selectedItemsWillBeDeletedFromAllAlbumsAndMoved": "Selected items will be deleted from all albums and moved to trash.",
+  "theseItemsWillBeDeletedFromYourDevice": "These items will be deleted from your device.",
+  "itLooksLikeSomethingWentWrongPleaseRetryAfterSome": "It looks like something went wrong. Please retry after some time. If the error persists, please contact our support team.",
+  "error": "Error"
 }

+ 30 - 27
lib/utils/delete_file_util.dart

@@ -4,7 +4,6 @@ import 'dart:io';
 import 'dart:math';
 
 import 'package:device_info/device_info.dart';
-import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:logging/logging.dart';
 import 'package:photo_manager/photo_manager.dart';
@@ -15,6 +14,7 @@ import 'package:photos/events/collection_updated_event.dart';
 import 'package:photos/events/files_updated_event.dart';
 import "package:photos/events/force_reload_trash_page_event.dart";
 import 'package:photos/events/local_photos_updated_event.dart';
+import "package:photos/generated/l10n.dart";
 import 'package:photos/models/file.dart';
 import 'package:photos/models/selected_files.dart';
 import 'package:photos/models/trash_item_request.dart';
@@ -127,9 +127,9 @@ Future<void> deleteFilesFromEverywhere(
       ),
     );
     if (hasLocalOnlyFiles && Platform.isAndroid) {
-      showShortToast(context, "Files deleted");
+      showShortToast(context, S.of(context).filesDeleted);
     } else {
-      showShortToast(context, "Moved to trash");
+      showShortToast(context, S.of(context).movedToTrash);
     }
   }
   if (uploadedFilesToBeTrashed.isNotEmpty) {
@@ -143,7 +143,7 @@ Future<void> deleteFilesFromRemoteOnly(
 ) async {
   files.removeWhere((element) => element.uploadedFileID == null);
   if (files.isEmpty) {
-    showToast(context, "Selected files are not on ente");
+    showToast(context, S.of(context).selectedFilesAreNotOnEnte);
     return;
   }
   _logger.info(
@@ -250,9 +250,9 @@ Future<bool> deleteFromTrash(BuildContext context, List<File> files) async {
   bool didDeletionStart = false;
   final actionResult = await showChoiceActionSheet(
     context,
-    title: "Permanently delete?",
-    body: "This action cannot be undone",
-    firstButtonLabel: "Delete",
+    title: S.of(context).permanentlyDelete,
+    body: S.of(context).thisActionCannotBeUndone,
+    firstButtonLabel: S.of(context).delete,
     isCritical: true,
     firstButtonOnTap: () async {
       try {
@@ -289,10 +289,9 @@ Future<bool> deleteFromTrash(BuildContext context, List<File> files) async {
 Future<bool> emptyTrash(BuildContext context) async {
   final actionResult = await showChoiceActionSheet(
     context,
-    title: "Empty trash?",
-    body:
-        "All items in trash will be permanently deleted\n\nThis action cannot be undone",
-    firstButtonLabel: "Empty",
+    title: S.of(context).emptyTrash,
+    body: S.of(context).permDeleteWarning,
+    firstButtonLabel: S.of(context).empty,
     isCritical: true,
     firstButtonOnTap: () async {
       try {
@@ -352,7 +351,7 @@ Future<bool> deleteLocalFiles(
     );
     return true;
   } else {
-    showToast(context, "Could not free up space");
+    showToast(context, S.of(context).couldNotFreeUpSpace);
     return false;
   }
 }
@@ -474,10 +473,9 @@ Future<List<String>> _tryDeleteSharedMediaFiles(List<String> localIDs) {
 Future<bool> shouldProceedWithDeletion(BuildContext context) async {
   final actionResult = await showChoiceActionSheet(
     context,
-    title: "Permanently delete from device?",
-    body:
-        "Some of the files you are trying to delete are only available on your device and cannot be recovered if deleted",
-    firstButtonLabel: "Delete",
+    title: S.of(context).permanentlyDeleteFromDevice,
+    body: S.of(context).someOfTheFilesYouAreTryingToDeleteAre,
+    firstButtonLabel: S.of(context).delete,
     isCritical: true,
   );
   if (actionResult?.action == null) {
@@ -506,15 +504,16 @@ Future<void> showDeleteSheet(
   final bool isBothLocalAndRemote = containsUploadedFile && containsLocalFile;
   final bool isLocalOnly = !containsUploadedFile;
   final bool isRemoteOnly = !containsLocalFile;
-  final String? bodyHighlight =
-      isBothLocalAndRemote ? "They will be deleted from all albums." : null;
+  final String? bodyHighlight = isBothLocalAndRemote
+      ? S.of(context).theyWillBeDeletedFromAllAlbums
+      : null;
   String body = "";
   if (isBothLocalAndRemote) {
-    body = "Some items are in both ente and your device.";
+    body = S.of(context).someItemsAreInBothEnteAndYourDevice;
   } else if (isRemoteOnly) {
-    body = "Selected items will be deleted from all albums and moved to trash.";
+    body = S.of(context).selectedItemsWillBeDeletedFromAllAlbumsAndMoved;
   } else if (isLocalOnly) {
-    body = "These items will be deleted from your device.";
+    body = S.of(context).theseItemsWillBeDeletedFromYourDevice;
   } else {
     throw AssertionError("Unexpected state");
   }
@@ -522,7 +521,9 @@ Future<void> showDeleteSheet(
   if (isBothLocalAndRemote || isRemoteOnly) {
     buttons.add(
       ButtonWidget(
-        labelText: isBothLocalAndRemote ? "Delete from ente" : "Yes, delete",
+        labelText: isBothLocalAndRemote
+            ? S.of(context).deleteFromEnte
+            : S.of(context).yesDelete,
         buttonType: ButtonType.neutral,
         buttonSize: ButtonSize.large,
         shouldStickToDarkTheme: true,
@@ -535,7 +536,7 @@ Future<void> showDeleteSheet(
             selectedFiles.files.toList(),
           ).then(
             (value) {
-              showShortToast(context, "Moved to trash");
+              showShortToast(context, S.of(context).movedToTrash);
             },
             onError: (e, s) {
               showGenericErrorDialog(context: context);
@@ -549,7 +550,9 @@ Future<void> showDeleteSheet(
   if (isBothLocalAndRemote || isLocalOnly) {
     buttons.add(
       ButtonWidget(
-        labelText: isBothLocalAndRemote ? "Delete from device" : "Yes, delete",
+        labelText: isBothLocalAndRemote
+            ? S.of(context).deleteFromDevice
+            : S.of(context).yesDelete,
         buttonType: ButtonType.neutral,
         buttonSize: ButtonSize.large,
         shouldStickToDarkTheme: true,
@@ -566,7 +569,7 @@ Future<void> showDeleteSheet(
   if (isBothLocalAndRemote) {
     buttons.add(
       ButtonWidget(
-        labelText: "Delete from both",
+        labelText: S.of(context).deleteFromBoth,
         buttonType: ButtonType.neutral,
         buttonSize: ButtonSize.large,
         shouldStickToDarkTheme: true,
@@ -583,8 +586,8 @@ Future<void> showDeleteSheet(
     );
   }
   buttons.add(
-    const ButtonWidget(
-      labelText: "Cancel",
+    ButtonWidget(
+      labelText: S.of(context).cancel,
       buttonType: ButtonType.secondary,
       buttonSize: ButtonSize.large,
       shouldStickToDarkTheme: true,

+ 4 - 4
lib/utils/dialog_util.dart

@@ -4,6 +4,7 @@ import 'package:confetti/confetti.dart';
 import "package:dio/dio.dart";
 import 'package:flutter/material.dart';
 import 'package:photos/core/constants.dart';
+import "package:photos/generated/l10n.dart";
 import "package:photos/models/search/button_result.dart";
 import 'package:photos/models/typedefs.dart';
 import 'package:photos/theme/colors.dart';
@@ -55,7 +56,7 @@ Future<ButtonResult?> showErrorDialogForException({
   }
   return showDialogWidget(
     context: context,
-    title: "Error",
+    title: S.of(context).error,
     icon: Icons.error_outline_outlined,
     body: errorMessage,
     isDismissible: isDismissible,
@@ -76,10 +77,9 @@ Future<ButtonResult?> showGenericErrorDialog({
 }) async {
   return showDialogWidget(
     context: context,
-    title: "Error",
+    title: S.of(context).error,
     icon: Icons.error_outline_outlined,
-    body:
-        "It looks like something went wrong. Please retry after some time. If the error persists, please contact our support team.",
+    body: S.of(context).itLooksLikeSomethingWentWrongPleaseRetryAfterSome,
     isDismissible: isDismissible,
     buttons: const [
       ButtonWidget(