Pārlūkot izejas kodu

l10n: extract string

Neeraj Gupta 2 gadi atpakaļ
vecāks
revīzija
fb01590fcf

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

@@ -180,6 +180,9 @@ class MessageLookup extends MessageLookupByLibrary {
 
   static String m37(email) => "This is ${email}\'s Verification ID";
 
+  static String m62(count) =>
+      "${Intl.plural(count, zero: '', one: '1 day', other: '${count} days')}";
+
   static String m38(email) => "Verify ${email}";
 
   static String m39(email) => "We have sent a mail to <green>${email}</green>";
@@ -1151,6 +1154,7 @@ class MessageLookup extends MessageLookupByLibrary {
         "total": MessageLookupByLibrary.simpleMessage("total"),
         "totalSize": MessageLookupByLibrary.simpleMessage("Total size"),
         "trash": MessageLookupByLibrary.simpleMessage("Trash"),
+        "trashDaysLeft": m62,
         "tryAgain": MessageLookupByLibrary.simpleMessage("Try again"),
         "turnOnBackupForAutoUpload": MessageLookupByLibrary.simpleMessage(
             "Turn on backup to automatically upload files added to this device folder to ente."),

+ 14 - 0
lib/generated/l10n.dart

@@ -5199,6 +5199,20 @@ class S {
     );
   }
 
+  /// `{count, plural, =0 {} =1 {1 day} other {{count} days}}`
+  String trashDaysLeft(int count) {
+    return Intl.plural(
+      count,
+      zero: '',
+      one: '1 day',
+      other: '$count days',
+      name: 'trashDaysLeft',
+      desc:
+          'Text to indicate number of days remaining before permanent deletion',
+      args: [count],
+    );
+  }
+
   /// `Delete All`
   String get deleteAll {
     return Intl.message(

+ 10 - 0
lib/l10n/intl_en.arb

@@ -736,6 +736,16 @@
   "referFriendsAnd2xYourPlan": "Refer friends and 2x your plan",
   "shareAlbumHint": "Open an album and tap the share button on the top right to share.",
   "itemsShowTheNumberOfDaysRemainingBeforePermanentDeletion": "Items show the number of days remaining before permanent deletion",
+  "trashDaysLeft": "{count, plural, =0 {} =1 {1 day} other {{count} days}}",
+  "@trashDaysLeft": {
+    "description": "Text to indicate number of days remaining before permanent deletion",
+    "placeholders": {
+      "count": {
+        "example": "1|2|3",
+        "type": "int"
+      }
+    }
+  },
   "deleteAll": "Delete All",
   "renameAlbum": "Rename album",
   "rename": "Rename",

+ 6 - 2
lib/ui/viewer/file/file_icons_widget.dart

@@ -1,10 +1,10 @@
 import 'package:flutter/material.dart';
 import 'package:photos/ente_theme_data.dart';
+import "package:photos/generated/l10n.dart";
 import 'package:photos/models/collection.dart';
 import 'package:photos/models/trash_file.dart';
 import 'package:photos/theme/colors.dart';
 import 'package:photos/ui/sharing/user_avator_widget.dart';
-import 'package:photos/utils/date_time_util.dart';
 
 class ThumbnailPlaceHolder extends StatelessWidget {
   const ThumbnailPlaceHolder({Key? key}) : super(key: key);
@@ -135,6 +135,10 @@ class TrashedFileOverlayText extends StatelessWidget {
 
   @override
   Widget build(BuildContext context) {
+    final int daysLeft =
+        ((file.deleteBy - DateTime.now().microsecondsSinceEpoch) /
+                Duration.microsecondsPerDay)
+            .ceil();
     return Container(
       decoration: BoxDecoration(
         gradient: LinearGradient(
@@ -146,7 +150,7 @@ class TrashedFileOverlayText extends StatelessWidget {
       alignment: Alignment.bottomCenter,
       padding: const EdgeInsets.only(bottom: 5),
       child: Text(
-        daysLeft(file.deleteBy),
+        S.of(context).trashDaysLeft(daysLeft),
         style: Theme.of(context)
             .textTheme
             .subtitle2!

+ 0 - 7
lib/utils/date_time_util.dart

@@ -71,13 +71,6 @@ String getFormattedTime(BuildContext context, DateTime dateTime) {
   );
 }
 
-String daysLeft(int futureTime) {
-  final int daysLeft = ((futureTime - DateTime.now().microsecondsSinceEpoch) /
-          Duration.microsecondsPerDay)
-      .ceil();
-  return '$daysLeft day' + (daysLeft <= 1 ? "" : "s");
-}
-
 String formatDuration(Duration position) {
   final ms = position.inMilliseconds;