extract strings

This commit is contained in:
Neeraj Gupta
2025-01-07 09:47:35 +05:30
parent de885e45ef
commit 1d803552da
4 changed files with 68 additions and 10 deletions

View File

@@ -1037,6 +1037,12 @@ class MessageLookup extends MessageLookupByLibrary {
"Items show the number of days remaining before permanent deletion"),
"itemsWillBeRemovedFromAlbum": MessageLookupByLibrary.simpleMessage(
"Selected items will be removed from this album"),
"join": MessageLookupByLibrary.simpleMessage("Join"),
"joinAlbum": MessageLookupByLibrary.simpleMessage("Join album"),
"joinAlbumSubtext":
MessageLookupByLibrary.simpleMessage("to view and add your photos"),
"joinAlbumSubtextViewer": MessageLookupByLibrary.simpleMessage(
"to add this to shared albums"),
"joinDiscord": MessageLookupByLibrary.simpleMessage("Join Discord"),
"keepPhotos": MessageLookupByLibrary.simpleMessage("Keep Photos"),
"kiloMeterUnit": MessageLookupByLibrary.simpleMessage("km"),

View File

@@ -10838,6 +10838,46 @@ class S {
args: [],
);
}
/// `Join album`
String get joinAlbum {
return Intl.message(
'Join album',
name: 'joinAlbum',
desc: '',
args: [],
);
}
/// `to view and add your photos`
String get joinAlbumSubtext {
return Intl.message(
'to view and add your photos',
name: 'joinAlbumSubtext',
desc: '',
args: [],
);
}
/// `to add this to shared albums`
String get joinAlbumSubtextViewer {
return Intl.message(
'to add this to shared albums',
name: 'joinAlbumSubtextViewer',
desc: '',
args: [],
);
}
/// `Join`
String get join {
return Intl.message(
'Join',
name: 'join',
desc: '',
args: [],
);
}
}
class AppLocalizationDelegate extends LocalizationsDelegate<S> {

View File

@@ -1580,5 +1580,10 @@
"authToManageLegacy": "Please authenticate to manage your trusted contacts",
"useDifferentPlayerInfo": "Having trouble playing this video? Long press here to try a different player.",
"hideSharedItemsFromHomeGallery": "Hide shared items from home gallery",
"gallery": "Gallery"
"gallery": "Gallery",
"joinAlbum": "Join album",
"joinAlbumSubtext": "to view and add your photos",
"joinAlbumSubtextViewer": "to add this to shared albums",
"join": "Join"
}

View File

@@ -5,6 +5,7 @@ import "package:photos/events/collection_meta_event.dart";
import "package:photos/events/collection_updated_event.dart";
import "package:photos/events/files_updated_event.dart";
import "package:photos/generated/l10n.dart";
import "package:photos/l10n/l10n.dart";
import "package:photos/models/collection/collection_items.dart";
import "package:photos/models/file/file.dart";
import "package:photos/models/file_load_result.dart";
@@ -15,7 +16,6 @@ import "package:photos/services/remote_sync_service.dart";
import "package:photos/ui/components/buttons/button_widget.dart";
import "package:photos/ui/components/models/button_type.dart";
import "package:photos/ui/components/notification_widget.dart";
import "package:photos/ui/sharing/share_collection_page.dart";
import "package:photos/ui/viewer/actions/file_selection_overlay_bar.dart";
import "package:photos/ui/viewer/gallery/collection_page.dart";
import "package:photos/ui/viewer/gallery/gallery.dart";
@@ -24,6 +24,7 @@ import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.da
import "package:photos/ui/viewer/gallery/state/selection_state.dart";
import "package:photos/utils/dialog_util.dart";
import "package:photos/utils/navigation_util.dart";
import "package:photos/utils/toast_util.dart";
class SharedPublicCollectionPage extends StatefulWidget {
final CollectionWithThumbnail c;
@@ -100,18 +101,19 @@ class _SharedPublicCollectionPageState
? Padding(
padding: const EdgeInsets.all(8.0),
child: NotificationWidget(
startIcon: Icons.people_alt_outlined,
startIcon: Icons.people_outline,
actionIcon: null,
actionWidget: ButtonWidget(
buttonType: ButtonType.primary,
labelText: "Join",
labelText: context.l10n.join,
buttonSize: ButtonSize.small,
shouldSurfaceExecutionStates: false,
onTap: _joinAlbum,
),
text: 'Join album',
text: context.l10n.joinAlbum,
subText: widget.c.collection.isCollectEnabledForPublicLink()
? "to view and add your photos"
: 'to add this to shared albums',
? context.l10n.joinAlbumSubtext
: context.l10n.joinAlbumSubtextViewer,
type: NotificationType.notice,
onTap: () async {},
),
@@ -151,7 +153,11 @@ class _SharedPublicCollectionPageState
}
Future<void> _joinAlbum() async {
final dialog = createProgressDialog(context, S.of(context).pleaseWait);
final dialog = createProgressDialog(
context,
S.of(context).pleaseWait,
isDismissible: true,
);
await dialog.show();
try {
logger.info("Joining collection ${widget.c.collection.id}");
@@ -171,9 +177,10 @@ class _SharedPublicCollectionPageState
);
} catch (e, s) {
logger.severe("Failed to join collection", e, s);
showGenericErrorDialog(context: context, error: e).ignore();
} finally {
await dialog.hide();
showToast(context, S.of(context).somethingWentWrong);
// wait for 400ms to show the error dialog
await Future.delayed(const Duration(milliseconds: 400));
}
}
}