l10n Fixes (#1087)
This commit is contained in:
commit
bdd63b0fa8
9 changed files with 54 additions and 115 deletions
4
lib/generated/intl/messages_en.dart
generated
4
lib/generated/intl/messages_en.dart
generated
|
@ -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
lib/generated/l10n.dart
generated
14
lib/generated/l10n.dart
generated
|
@ -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(
|
||||
|
|
|
@ -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,7 +6,7 @@ import "package:photos/generated/l10n.dart";
|
|||
import 'package:photos/models/sessions.dart';
|
||||
import 'package:photos/services/user_service.dart';
|
||||
import 'package:photos/ui/common/loading_widget.dart';
|
||||
import 'package:photos/utils/date_time_util.dart';
|
||||
import "package:photos/utils/date_time_util.dart";
|
||||
import 'package:photos/utils/dialog_util.dart';
|
||||
import 'package:photos/utils/toast_util.dart';
|
||||
|
||||
|
@ -90,7 +90,7 @@ class _SessionsPageState extends State<SessionsPage> {
|
|||
const Padding(padding: EdgeInsets.all(8)),
|
||||
Flexible(
|
||||
child: Text(
|
||||
getFormattedTime(lastUsedTime),
|
||||
getFormattedTime(context, lastUsedTime),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
|
|
|
@ -2,13 +2,13 @@ import "dart:io";
|
|||
|
||||
import "package:flutter/cupertino.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:intl/intl.dart";
|
||||
import "package:photos/models/memory.dart";
|
||||
import "package:photos/services/memories_service.dart";
|
||||
import "package:photos/theme/text_style.dart";
|
||||
import "package:photos/ui/actions/file/file_actions.dart";
|
||||
import "package:photos/ui/extents_page_view.dart";
|
||||
import "package:photos/ui/viewer/file/file_widget.dart";
|
||||
import "package:photos/utils/date_time_util.dart";
|
||||
import "package:photos/utils/file_util.dart";
|
||||
import "package:photos/utils/share_util.dart";
|
||||
import "package:step_progress_indicator/step_progress_indicator.dart";
|
||||
|
@ -89,8 +89,11 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
|
|||
),
|
||||
),
|
||||
Text(
|
||||
getFormattedDate(
|
||||
DateTime.fromMicrosecondsSinceEpoch(file.creationTime!),
|
||||
DateFormat.yMMMd(Localizations.localeOf(context).languageCode)
|
||||
.format(
|
||||
DateTime.fromMicrosecondsSinceEpoch(
|
||||
file.creationTime!,
|
||||
),
|
||||
),
|
||||
style: Theme.of(context).textTheme.subtitle1!.copyWith(
|
||||
fontSize: 14,
|
||||
|
|
|
@ -116,6 +116,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
|
|||
? S.of(context).expiredLinkInfo
|
||||
: S.of(context).linkExpiresOn(
|
||||
getFormattedTime(
|
||||
context,
|
||||
DateTime.fromMicrosecondsSinceEpoch(
|
||||
url.validTill,
|
||||
),
|
||||
|
|
|
@ -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!
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import "package:flutter/material.dart";
|
||||
import "package:intl/intl.dart";
|
||||
import "package:logging/logging.dart";
|
||||
import "package:photos/core/event_bus.dart";
|
||||
import "package:photos/ente_theme_data.dart";
|
||||
|
@ -9,7 +10,6 @@ import "package:photos/ui/common/loading_widget.dart";
|
|||
import "package:photos/ui/huge_listview/huge_listview.dart";
|
||||
import "package:photos/ui/viewer/gallery/component/lazy_loading_gallery.dart";
|
||||
import "package:photos/ui/viewer/gallery/gallery.dart";
|
||||
import "package:photos/utils/date_time_util.dart";
|
||||
import "package:photos/utils/local_settings.dart";
|
||||
import "package:scrollable_positioned_list/scrollable_positioned_list.dart";
|
||||
|
||||
|
@ -112,7 +112,8 @@ class GalleryListView extends StatelessWidget {
|
|||
},
|
||||
labelTextBuilder: (int index) {
|
||||
try {
|
||||
return getMonthAndYear(
|
||||
return DateFormat.yMMM(Localizations.localeOf(context).languageCode)
|
||||
.format(
|
||||
DateTime.fromMicrosecondsSinceEpoch(
|
||||
collatedFiles[index][0].creationTime!,
|
||||
),
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import "package:flutter/cupertino.dart";
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
|
@ -18,45 +19,9 @@ Map<int, String> _months = {
|
|||
12: "Dec",
|
||||
};
|
||||
|
||||
Map<int, String> _fullMonths = {
|
||||
1: "January",
|
||||
2: "February",
|
||||
3: "March",
|
||||
4: "April",
|
||||
5: "May",
|
||||
6: "June",
|
||||
7: "July",
|
||||
8: "August",
|
||||
9: "September",
|
||||
10: "October",
|
||||
11: "November",
|
||||
12: "December",
|
||||
};
|
||||
|
||||
Map<int, String> _days = {
|
||||
1: "Mon",
|
||||
2: "Tue",
|
||||
3: "Wed",
|
||||
4: "Thu",
|
||||
5: "Fri",
|
||||
6: "Sat",
|
||||
7: "Sun",
|
||||
};
|
||||
|
||||
final currentYear = DateTime.now().year;
|
||||
const searchStartYear = 1970;
|
||||
|
||||
//Jun 2022
|
||||
String getMonthAndYear(DateTime dateTime) {
|
||||
return _months[dateTime.month]! + " " + dateTime.year.toString();
|
||||
}
|
||||
|
||||
int daysBetween(DateTime from, DateTime to) {
|
||||
from = DateTime(from.year, from.month, from.day);
|
||||
to = DateTime(to.year, to.month, to.day);
|
||||
return (to.difference(from).inHours / 24).round();
|
||||
}
|
||||
|
||||
bool areFromSameDay(int firstCreationTime, int secondCreationTime) {
|
||||
final firstDate = DateTime.fromMicrosecondsSinceEpoch(firstCreationTime);
|
||||
final secondDate = DateTime.fromMicrosecondsSinceEpoch(secondCreationTime);
|
||||
|
@ -91,65 +56,19 @@ String getNameForDateRange(int firstCreationTime, int secondCreationTime) {
|
|||
return "${_months[endTime.month]!} ${endTime.day}, ${endTime.year}";
|
||||
}
|
||||
|
||||
String getDay(DateTime dateTime) {
|
||||
return _days[dateTime.weekday]!;
|
||||
}
|
||||
|
||||
String getMonth(DateTime dateTime) {
|
||||
return _months[dateTime.month]!;
|
||||
}
|
||||
|
||||
String getFullMonth(DateTime dateTime) {
|
||||
return _fullMonths[dateTime.month]!;
|
||||
}
|
||||
|
||||
String getAbbreviationOfYear(DateTime dateTime) {
|
||||
return (dateTime.year % 100).toString();
|
||||
}
|
||||
|
||||
//14:32
|
||||
String getTime(DateTime dateTime) {
|
||||
final hours = dateTime.hour > 9
|
||||
? dateTime.hour.toString()
|
||||
: "0" + dateTime.hour.toString();
|
||||
final minutes = dateTime.minute > 9
|
||||
? dateTime.minute.toString()
|
||||
: "0" + dateTime.minute.toString();
|
||||
return hours + ":" + minutes;
|
||||
}
|
||||
|
||||
//11:22 AM
|
||||
String getTimeIn12hrFormat(DateTime dateTime) {
|
||||
return DateFormat.jm().format(dateTime);
|
||||
}
|
||||
|
||||
//Thu, Jun 30, 2022 - 14:32
|
||||
String getFormattedTime(DateTime dateTime) {
|
||||
return getDay(dateTime) +
|
||||
", " +
|
||||
getMonth(dateTime) +
|
||||
" " +
|
||||
dateTime.day.toString() +
|
||||
", " +
|
||||
dateTime.year.toString() +
|
||||
" - " +
|
||||
getTime(dateTime);
|
||||
}
|
||||
|
||||
//30 Jun'22
|
||||
String getFormattedDate(DateTime dateTime) {
|
||||
return dateTime.day.toString() +
|
||||
" " +
|
||||
getMonth(dateTime) +
|
||||
"'" +
|
||||
getAbbreviationOfYear(dateTime);
|
||||
}
|
||||
|
||||
String daysLeft(int futureTime) {
|
||||
final int daysLeft = ((futureTime - DateTime.now().microsecondsSinceEpoch) /
|
||||
Duration.microsecondsPerDay)
|
||||
.ceil();
|
||||
return '$daysLeft day' + (daysLeft <= 1 ? "" : "s");
|
||||
String getFormattedTime(BuildContext context, DateTime dateTime) {
|
||||
return DateFormat(
|
||||
'E, MMM d, y - HH:mm',
|
||||
Localizations.localeOf(context).languageCode,
|
||||
).format(
|
||||
dateTime,
|
||||
);
|
||||
}
|
||||
|
||||
String formatDuration(Duration position) {
|
||||
|
@ -185,23 +104,6 @@ String formatDuration(Duration position) {
|
|||
return formattedTime;
|
||||
}
|
||||
|
||||
bool isLeapYear(DateTime dateTime) {
|
||||
final year = dateTime.year;
|
||||
if (year % 4 == 0) {
|
||||
if (year % 100 == 0) {
|
||||
if (year % 400 == 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
String secondsToHHMMSS(int value) {
|
||||
int h, m, s;
|
||||
h = value ~/ 3600;
|
||||
|
|
Loading…
Add table
Reference in a new issue