π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add localization for hardcoded strings and remove redundant ownership checks
AmanRajSinghMourya668ec9194be7
diff --git a/mobile/apps/locker/lib/l10n/app_en.arb b/mobile/apps/locker/lib/l10n/app_en.arbindex 09806a8f61..3072927d18 100644--- a/mobile/apps/locker/lib/l10n/app_en.arb+++ b/mobile/apps/locker/lib/l10n/app_en.arb@@ -911,5 +911,69 @@"clearAllFilters": "Clear all filters","selectLanguage": "Select language","general": "General",- "language": "Language"+ "language": "Language",+ "selectedCount": "{count, plural, =1{1 selected} other{{count} selected}}",+ "@selectedCount": {+ "description": "Number of items selected",+ "placeholders": {+ "count": {+ "type": "int",+ "example": "3"+ }+ }+ },+ "actionNotSupportedForSharedFiles": "{count, plural, =1{Action is not supported for 1 shared file} other{Action is not supported for {count} shared files}}",+ "@actionNotSupportedForSharedFiles": {+ "description": "Message when action is not supported for shared files",+ "placeholders": {+ "count": {+ "type": "int",+ "example": "3"+ }+ }+ },+ "addTo": "Add to",+ "shareNotSupportedForSharedFiles": "Share is not supported for shared files",+ "editNotSupportedForSharedFiles": "Edit is not supported for shared files",+ "deleteNotSupportedForSharedFiles": "Delete is not supported for shared files",+ "importantNotSupportedForSharedFiles": "Important is not supported for shared files",+ "sharingSection": "Sharing",+ "sharingEnabledToggle": "Sharing enabled",+ "publicLinkSection": "Public Link",+ "linkEnabledToggle": "Link enabled",+ "allowUploads": "Allow uploads",+ "collectionUpdated": "Collection updated",+ "actionNotSupportedOnFavouritesAlbum": "Action not supported on Favourites album",+ "leaveCollectionSuccessfully": "Left collection successfully",+ "leftCollectionsSuccessfully": "{count, plural, =1{Left 1 collection successfully} other{Left {count} collections successfully}}",+ "@leftCollectionsSuccessfully": {+ "description": "Success message when leaving collections",+ "placeholders": {+ "count": {+ "type": "int",+ "example": "3"+ }+ }+ },+ "removePublicLink": "Remove public link",+ "removePublicLinkConfirmation": "This will remove the public link for accessing \"{collectionName}\".",+ "@removePublicLinkConfirmation": {+ "description": "Confirmation message when removing public link",+ "placeholders": {+ "collectionName": {+ "type": "String",+ "example": "My Collection"+ }+ }+ },+ "collectionsDeletedSuccessfully": "{count, plural, =1{1 collection deleted successfully} other{{count} collections deleted successfully}}",+ "@collectionsDeletedSuccessfully": {+ "description": "Success message when collections are deleted",+ "placeholders": {+ "count": {+ "type": "int",+ "example": "3"+ }+ }+ }}diff --git a/mobile/apps/locker/lib/l10n/app_localizations.dart b/mobile/apps/locker/lib/l10n/app_localizations.dartindex cf09b9539b..32eedc146b 100644--- a/mobile/apps/locker/lib/l10n/app_localizations.dart+++ b/mobile/apps/locker/lib/l10n/app_localizations.dart@@ -2721,6 +2721,120 @@ abstract class AppLocalizations {/// In en, this message translates to:/// **'Language'**String get language;++ /// Number of items selected+ ///+ /// In en, this message translates to:+ /// **'{count, plural, =1{1 selected} other{{count} selected}}'**+ String selectedCount(int count);++ /// Message when action is not supported for shared files+ ///+ /// In en, this message translates to:+ /// **'{count, plural, =1{Action is not supported for 1 shared file} other{Action is not supported for {count} shared files}}'**+ String actionNotSupportedForSharedFiles(int count);++ /// No description provided for @addTo.+ ///+ /// In en, this message translates to:+ /// **'Add to'**+ String get addTo;++ /// No description provided for @shareNotSupportedForSharedFiles.+ ///+ /// In en, this message translates to:+ /// **'Share is not supported for shared files'**+ String get shareNotSupportedForSharedFiles;++ /// No description provided for @editNotSupportedForSharedFiles.+ ///+ /// In en, this message translates to:+ /// **'Edit is not supported for shared files'**+ String get editNotSupportedForSharedFiles;++ /// No description provided for @deleteNotSupportedForSharedFiles.+ ///+ /// In en, this message translates to:+ /// **'Delete is not supported for shared files'**+ String get deleteNotSupportedForSharedFiles;++ /// No description provided for @importantNotSupportedForSharedFiles.+ ///+ /// In en, this message translates to:+ /// **'Important is not supported for shared files'**+ String get importantNotSupportedForSharedFiles;++ /// No description provided for @sharingSection.+ ///+ /// In en, this message translates to:+ /// **'Sharing'**+ String get sharingSection;++ /// No description provided for @sharingEnabledToggle.+ ///+ /// In en, this message translates to:+ /// **'Sharing enabled'**+ String get sharingEnabledToggle;++ /// No description provided for @publicLinkSection.+ ///+ /// In en, this message translates to:+ /// **'Public Link'**+ String get publicLinkSection;++ /// No description provided for @linkEnabledToggle.+ ///+ /// In en, this message translates to:+ /// **'Link enabled'**+ String get linkEnabledToggle;++ /// No description provided for @allowUploads.+ ///+ /// In en, this message translates to:+ /// **'Allow uploads'**+ String get allowUploads;++ /// No description provided for @collectionUpdated.+ ///+ /// In en, this message translates to:+ /// **'Collection updated'**+ String get collectionUpdated;++ /// No description provided for @actionNotSupportedOnFavouritesAlbum.+ ///+ /// In en, this message translates to:+ /// **'Action not supported on Favourites album'**+ String get actionNotSupportedOnFavouritesAlbum;++ /// No description provided for @leaveCollectionSuccessfully.+ ///+ /// In en, this message translates to:+ /// **'Left collection successfully'**+ String get leaveCollectionSuccessfully;++ /// Success message when leaving collections+ ///+ /// In en, this message translates to:+ /// **'{count, plural, =1{Left 1 collection successfully} other{Left {count} collections successfully}}'**+ String leftCollectionsSuccessfully(int count);++ /// No description provided for @removePublicLink.+ ///+ /// In en, this message translates to:+ /// **'Remove public link'**+ String get removePublicLink;++ /// Confirmation message when removing public link+ ///+ /// In en, this message translates to:+ /// **'This will remove the public link for accessing \"{collectionName}\".'**+ String removePublicLinkConfirmation(String collectionName);++ /// Success message when collections are deleted+ ///+ /// In en, this message translates to:+ /// **'{count, plural, =1{1 collection deleted successfully} other{{count} collections deleted successfully}}'**+ String collectionsDeletedSuccessfully(int count);}class _AppLocalizationsDelegatediff --git a/mobile/apps/locker/lib/l10n/app_localizations_en.dart b/mobile/apps/locker/lib/l10n/app_localizations_en.dartindex c489ce0451..f47b23f6fe 100644--- a/mobile/apps/locker/lib/l10n/app_localizations_en.dart+++ b/mobile/apps/locker/lib/l10n/app_localizations_en.dart@@ -1581,4 +1581,100 @@ class AppLocalizationsEn extends AppLocalizations {@overrideString get language => 'Language';++ @override+ String selectedCount(int count) {+ String _temp0 = intl.Intl.pluralLogic(+ count,+ locale: localeName,+ other: '$count selected',+ one: '1 selected',+ );+ return '$_temp0';+ }++ @override+ String actionNotSupportedForSharedFiles(int count) {+ String _temp0 = intl.Intl.pluralLogic(+ count,+ locale: localeName,+ other: 'Action is not supported for $count shared files',+ one: 'Action is not supported for 1 shared file',+ );+ return '$_temp0';+ }++ @override+ String get addTo => 'Add to';++ @override+ String get shareNotSupportedForSharedFiles =>+ 'Share is not supported for shared files';++ @override+ String get editNotSupportedForSharedFiles =>+ 'Edit is not supported for shared files';++ @override+ String get deleteNotSupportedForSharedFiles =>+ 'Delete is not supported for shared files';++ @override+ String get importantNotSupportedForSharedFiles =>+ 'Important is not supported for shared files';++ @override+ String get sharingSection => 'Sharing';++ @override+ String get sharingEnabledToggle => 'Sharing enabled';++ @override+ String get publicLinkSection => 'Public Link';++ @override+ String get linkEnabledToggle => 'Link enabled';++ @override+ String get allowUploads => 'Allow uploads';++ @override+ String get collectionUpdated => 'Collection updated';++ @override+ String get actionNotSupportedOnFavouritesAlbum =>+ 'Action not supported on Favourites album';++ @override+ String get leaveCollectionSuccessfully => 'Left collection successfully';++ @override+ String leftCollectionsSuccessfully(int count) {+ String _temp0 = intl.Intl.pluralLogic(+ count,+ locale: localeName,+ other: 'Left $count collections successfully',+ one: 'Left 1 collection successfully',+ );+ return '$_temp0';+ }++ @override+ String get removePublicLink => 'Remove public link';++ @override+ String removePublicLinkConfirmation(String collectionName) {+ return 'This will remove the public link for accessing \"$collectionName\".';+ }++ @override+ String collectionsDeletedSuccessfully(int count) {+ String _temp0 = intl.Intl.pluralLogic(+ count,+ locale: localeName,+ other: '$count collections deleted successfully',+ one: '1 collection deleted successfully',+ );+ return '$_temp0';+ }}diff --git a/mobile/apps/locker/lib/ui/components/collection_list_widget.dart b/mobile/apps/locker/lib/ui/components/collection_list_widget.dartindex 3128c14568..c5821520a2 100644--- a/mobile/apps/locker/lib/ui/components/collection_list_widget.dart+++ b/mobile/apps/locker/lib/ui/components/collection_list_widget.dart@@ -262,5 +262,4 @@ class CollectionListWidget extends StatelessWidget {),);}-}diff --git a/mobile/apps/locker/lib/ui/pages/base_info_page.dart b/mobile/apps/locker/lib/ui/pages/base_info_page.dartindex e73c81d166..df363e2681 100644--- a/mobile/apps/locker/lib/ui/pages/base_info_page.dart+++ b/mobile/apps/locker/lib/ui/pages/base_info_page.dart@@ -147,7 +147,8 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>selectedCollectionIds: _selectedCollectionIds,onToggleCollection: _onToggleCollection,onCollectionsUpdated: _onCollectionsUpdated,- title: showCollectionSelectionTitle ? context.l10n.collections : '',+ title:+ showCollectionSelectionTitle ? context.l10n.collections : '',),],),diff --git a/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart b/mobile/apps/locker/lib/ui/pages/file_upload_screen.dartindex c2a34705e7..abf3ebf9b7 100644--- a/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart+++ b/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart@@ -143,8 +143,9 @@ class _FileUploadScreenState extends State<FileUploadScreen> {borderRadius: BorderRadius.circular(16),child: ConstrainedBox(constraints: BoxConstraints(- maxHeight:- _files.length > 5 ? 360 : _files.length * 84.0,+ maxHeight: _files.length > 5+ ? 360+ : _files.length * 84.0,),child: ListView.separated(shrinkWrap: true,diff --git a/mobile/apps/locker/lib/ui/sharing/advanced_sharing_bottom_sheet.dart b/mobile/apps/locker/lib/ui/sharing/advanced_sharing_bottom_sheet.dartindex 1006bec4d3..8f7837bb5a 100644--- a/mobile/apps/locker/lib/ui/sharing/advanced_sharing_bottom_sheet.dart+++ b/mobile/apps/locker/lib/ui/sharing/advanced_sharing_bottom_sheet.dart@@ -118,13 +118,13 @@ class _AdvancedSharingBottomSheetStatecrossAxisAlignment: CrossAxisAlignment.start,children: [Text(- "Sharing",+ context.l10n.sharingSection,style: textTheme.largeBold,),const SizedBox(height: 8),MenuItemWidget(- captionedTextWidget: const CaptionedTextWidget(- title: "Sharing enabled",+ captionedTextWidget: CaptionedTextWidget(+ title: context.l10n.sharingEnabledToggle,),menuItemColor: colorScheme.backgroundElevated2,trailingWidget: ToggleSwitchWidget(@@ -135,8 +135,8 @@ class _AdvancedSharingBottomSheetState),const SizedBox(height: 8),MenuItemWidget(- captionedTextWidget: const CaptionedTextWidget(- title: "Allow downloads",+ captionedTextWidget: CaptionedTextWidget(+ title: context.l10n.allowDownloads,),menuItemColor: colorScheme.backgroundElevated2,trailingWidget: ToggleSwitchWidget(@@ -151,8 +151,8 @@ class _AdvancedSharingBottomSheetState// ignore: unawaited_futuresshowErrorDialog(context,- "Please note",- "Viewers can still take screenshots or save a copy of your photos using external tools",+ context.l10n.disableDownloadWarningTitle,+ context.l10n.disableDownloadWarningBody,);}},@@ -161,15 +161,15 @@ class _AdvancedSharingBottomSheetState),const SizedBox(height: 24),Text(- "Public Link",+ context.l10n.publicLinkSection,style: textTheme.h3Bold.copyWith(fontSize: 18.0,),),const SizedBox(height: 8),MenuItemWidget(- captionedTextWidget: const CaptionedTextWidget(- title: "Link enabled",+ captionedTextWidget: CaptionedTextWidget(+ title: context.l10n.linkEnabledToggle,),menuItemColor: colorScheme.backgroundElevated2,trailingWidget: ToggleSwitchWidget(@@ -187,8 +187,8 @@ class _AdvancedSharingBottomSheetStateif (_hasPublicLink && _publicUrl != null) ...[const SizedBox(height: 8),MenuItemWidget(- captionedTextWidget: const CaptionedTextWidget(- title: "Allow uploads",+ captionedTextWidget: CaptionedTextWidget(+ title: context.l10n.allowUploads,),menuItemColor: colorScheme.backgroundElevated2,trailingWidget: ToggleSwitchWidget(@@ -203,8 +203,8 @@ class _AdvancedSharingBottomSheetState),const SizedBox(height: 8),MenuItemWidget(- captionedTextWidget: const CaptionedTextWidget(- title: "Password lock",+ captionedTextWidget: CaptionedTextWidget(+ title: context.l10n.passwordLock,),menuItemColor: colorScheme.backgroundElevated2,trailingWidget: ToggleSwitchWidget(@@ -224,9 +224,9 @@ class _AdvancedSharingBottomSheetStateconst SizedBox(height: 8),MenuItemWidget(captionedTextWidget: CaptionedTextWidget(- title: "Device limit",+ title: context.l10n.linkDeviceLimit,subTitle: _publicUrl!.deviceLimit == 0- ? "None"+ ? context.l10n.noDeviceLimit: "${_publicUrl!.deviceLimit}",),menuItemColor: colorScheme.backgroundElevated2,@@ -247,12 +247,12 @@ class _AdvancedSharingBottomSheetStateconst SizedBox(height: 8),MenuItemWidget(captionedTextWidget: CaptionedTextWidget(- title: "Link Expiry",+ title: context.l10n.linkExpiry,subTitle: _publicUrl!.hasExpiry? (_publicUrl!.isExpired- ? "Expired"- : "Enabled")- : "Never",+ ? context.l10n.linkExpired+ : context.l10n.linkEnabled)+ : context.l10n.never,),menuItemColor: colorScheme.backgroundElevated2,trailingWidget: Icon(@@ -313,7 +313,7 @@ class _AdvancedSharingBottomSheetStatebool showProgressDialog = true,}) async {final dialog = showProgressDialog- ? createProgressDialog(context, "Please wait...")+ ? createProgressDialog(context, context.l10n.pleaseWait): null;await dialog?.show();try {@@ -322,7 +322,7 @@ class _AdvancedSharingBottomSheetStateupdates,);await dialog?.hide();- showShortToast(context, "Collection updated");+ showShortToast(context, context.l10n.collectionUpdated);if (mounted) {setState(() {});}diff --git a/mobile/apps/locker/lib/ui/sharing/manage_links_widget.dart b/mobile/apps/locker/lib/ui/sharing/manage_links_widget.dartindex 539a41dc8d..f1a179a407 100644--- a/mobile/apps/locker/lib/ui/sharing/manage_links_widget.dart+++ b/mobile/apps/locker/lib/ui/sharing/manage_links_widget.dart@@ -341,7 +341,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {await CollectionApiClient.instance.updateShareUrl(widget.collection!, prop);await dialog?.hide();- showShortToast(context, "Collection updated");+ showShortToast(context, context.l10n.collectionUpdated);if (mounted) {setState(() {});}diff --git a/mobile/apps/locker/lib/ui/sharing/share_collection_page.dart b/mobile/apps/locker/lib/ui/sharing/share_collection_page.dartindex 8a5fd75567..4a2210382a 100644--- a/mobile/apps/locker/lib/ui/sharing/share_collection_page.dart+++ b/mobile/apps/locker/lib/ui/sharing/share_collection_page.dart@@ -185,7 +185,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {showOnlyLoadingState: true,onTap: () async {await Clipboard.setData(ClipboardData(text: url));- showShortToast(context, "Link copied to clipboard");+ showShortToast(context, context.l10n.linkCopiedToClipboard);},isBottomBorderRadiusRemoved: true,),@@ -293,7 +293,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {return Scaffold(appBar: AppBar(title: Text(- widget.collection.displayName ?? "Collection",+ widget.collection.displayName ?? context.l10n.collectionLabel,style:Theme.of(context).textTheme.headlineSmall?.copyWith(fontSize: 16),),diff --git a/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart b/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dartindex 03e606b162..69892cee72 100644--- a/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart+++ b/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart@@ -62,7 +62,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {if (sharedCount > 0 && mounted) {showToast(context,- "Action is not supported for $sharedCount shared file${sharedCount > 1 ? 's' : ''}",+ context.l10n.actionNotSupportedForSharedFiles(sharedCount),);}@@ -230,9 +230,8 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {listenable: widget.selectedFiles,builder: (context, child) {final count = widget.selectedFiles.count;- final countText = count == 1- ? '1 selected'- : '$count selected';+ final countText =+ context.l10n.selectedCount(count);return InkWell(onTap: () {@@ -460,7 +459,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {hugeIcon: const HugeIcon(icon: HugeIcons.strokeRoundedArrowRight03,),- label: "Add to",+ label: context.l10n.addTo,onTap: () => _showAddToDialog(context, files),),);@@ -513,7 +512,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {Future<void> _shareFileLink(BuildContext context, EnteFile file) async {final currentUserID = Configuration.instance.getUserID();if (file.ownerID != currentUserID) {- showToast(context, "Share is not supported for shared files");+ showToast(context, context.l10n.shareNotSupportedForSharedFiles);return;}await FileActions.shareFileLink(context, file);@@ -522,7 +521,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {Future<void> _editFile(BuildContext context, EnteFile file) async {final currentUserID = Configuration.instance.getUserID();if (file.ownerID != currentUserID) {- showToast(context, "Edit is not supported for shared files");+ showToast(context, context.l10n.editNotSupportedForSharedFiles);return;}await FileActions.editFile(context, file);@@ -649,7 +648,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {Future<void> _deleteFile(BuildContext context, EnteFile file) async {final currentUserID = Configuration.instance.getUserID();if (file.ownerID != currentUserID) {- showToast(context, "Delete is not supported for shared files");+ showToast(context, context.l10n.deleteNotSupportedForSharedFiles);return;}await FileActions.deleteFile(@@ -730,7 +729,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {Future<void> _markImportant(BuildContext context, EnteFile file) async {final currentUserID = Configuration.instance.getUserID();if (file.ownerID != currentUserID) {- showToast(context, "Important is not supported for shared files");+ showToast(context, context.l10n.importantNotSupportedForSharedFiles);return;}await FileActions.markImportant(diff --git a/mobile/apps/locker/lib/utils/collection_actions.dart b/mobile/apps/locker/lib/utils/collection_actions.dartindex 630b50e86e..b29906c14b 100644--- a/mobile/apps/locker/lib/utils/collection_actions.dart+++ b/mobile/apps/locker/lib/utils/collection_actions.dart@@ -211,13 +211,13 @@ class CollectionActions {showToast(context,- "${collections.length} collections deleted successfully",+ context.l10n.collectionsDeletedSuccessfully(collections.length),);if (isFavoriteCollection) {showToast(context,- "Action not supported on Favourites album",+ context.l10n.actionNotSupportedOnFavouritesAlbum,);}@@ -356,7 +356,7 @@ class CollectionActions {onSuccess?.call();showToast(context,- "Leave collection successfully",+ context.l10n.leaveCollectionSuccessfully,);}} catch (e) {@@ -399,7 +399,7 @@ class CollectionActions {onSuccess?.call();showToast(context,- "Left ${collections.length} collection${collections.length > 1 ? 's' : ''} successfully",+ context.l10n.leftCollectionsSuccessfully(collections.length),);}} catch (e) {@@ -449,7 +449,7 @@ class CollectionActions {shouldStickToDarkTheme: true,buttonAction: ButtonAction.first,shouldSurfaceExecutionStates: true,- labelText: "Yes, remove",+ labelText: context.l10n.yesRemove,onTap: () async {await CollectionApiClient.instance.disableShareUrl(collection);},@@ -462,9 +462,9 @@ class CollectionActions {labelText: context.l10n.cancel,),],- title: "Remove public link",- body:- "This will remove the public link for accessing \"${collection.name}\".",+ title: context.l10n.removePublicLink,+ body: context.l10n+ .removePublicLinkConfirmation(collection.name ?? "this collection"),);if (actionResult?.action != null) {if (actionResult!.action == ButtonAction.error) {diff --git a/mobile/apps/locker/lib/utils/file_actions.dart b/mobile/apps/locker/lib/utils/file_actions.dartindex 280118e74c..07bbf470a3 100644--- a/mobile/apps/locker/lib/utils/file_actions.dart+++ b/mobile/apps/locker/lib/utils/file_actions.dart@@ -6,7 +6,6 @@ import "package:locker/core/errors.dart";import "package:locker/l10n/l10n.dart";import "package:locker/models/info/info_item.dart";import "package:locker/services/collections/collections_service.dart";-import "package:locker/services/configuration.dart";import "package:locker/services/favorites_service.dart";import "package:locker/services/files/links/links_service.dart";import "package:locker/services/files/sync/metadata_updater_service.dart";@@ -43,12 +42,6 @@ class FileActions {'Opening edit dialog for file ${file.uploadedFileID}',);- final int currentUserID = Configuration.instance.getUserID()!;- if (file.ownerID != currentUserID) {- showToast(context, "Edit feature coming soon");- return;- }-final editableCollections =await CollectionService.instance.getCollectionsForUI();