Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Use context strings in photos

Manav Rathi0395e18c4d7a
diff --git a/mobile/apps/photos/lib/emergency/components/trusted_contact_sheet.dart b/mobile/apps/photos/lib/emergency/components/trusted_contact_sheet.dart
index 4daa1473da..dc89979a6d 100644
--- a/mobile/apps/photos/lib/emergency/components/trusted_contact_sheet.dart
+++ b/mobile/apps/photos/lib/emergency/components/trusted_contact_sheet.dart
@@ -55,7 +55,7 @@ class _TrustedContactSheetState extends State<TrustedContactSheet> {
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final isPending = widget.contact.isPendingInvite();
final email = widget.contact.emergencyContact.email;
diff --git a/mobile/apps/photos/lib/emergency/emergency_page.dart b/mobile/apps/photos/lib/emergency/emergency_page.dart
index 15a644f08a..0a5b760ae0 100644
--- a/mobile/apps/photos/lib/emergency/emergency_page.dart
+++ b/mobile/apps/photos/lib/emergency/emergency_page.dart
@@ -52,10 +52,7 @@ class _EmergencyPageState extends State<EmergencyPage> {
}
} catch (e) {
if (!mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
}
}
@@ -443,10 +440,7 @@ class _EmergencyPageState extends State<EmergencyPage> {
} catch (e) {
if (mounted) {
if (!context.mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
}
}
}
@@ -458,19 +452,17 @@ class _EmergencyPageState extends State<EmergencyPage> {
final result = await showEmailActionSheet<String>(
context,
email: contact.user.email,
- message: StringsLocalizations.of(
- context,
- ).legacyInvite(email: contact.user.email),
+ message: context.strings.legacyInvite(email: contact.user.email),
buttons: [
ButtonWidgetV2(
buttonType: ButtonTypeV2.primary,
- labelText: StringsLocalizations.of(context).acceptTrustInvite,
+ labelText: context.strings.acceptTrustInvite,
shouldSurfaceExecutionStates: false,
onTap: () async => Navigator.of(context).pop("accept"),
),
ButtonWidgetV2(
buttonType: ButtonTypeV2.tertiaryCritical,
- labelText: StringsLocalizations.of(context).declineTrustInvite,
+ labelText: context.strings.declineTrustInvite,
shouldSurfaceExecutionStates: false,
onTap: () async => Navigator.of(context).pop("decline"),
),
diff --git a/mobile/apps/photos/lib/emergency/emergency_service.dart b/mobile/apps/photos/lib/emergency/emergency_service.dart
index 322c14dc12..b29dfc274f 100644
--- a/mobile/apps/photos/lib/emergency/emergency_service.dart
+++ b/mobile/apps/photos/lib/emergency/emergency_service.dart
@@ -50,8 +50,8 @@ class EmergencyContactService {
if (context == null || !context.mounted) return false;
await showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).letsTryThatAgain,
- message: StringsLocalizations.of(context).enterValidEmail,
+ title: context.strings.letsTryThatAgain,
+ message: context.strings.enterValidEmail,
assetPath: "assets/warning-grey.png",
);
return false;
@@ -59,8 +59,8 @@ class EmergencyContactService {
if (context == null || !context.mounted) return false;
await showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).oops,
- message: StringsLocalizations.of(context).youCannotShareWithYourself,
+ title: context.strings.oops,
+ message: context.strings.youCannotShareWithYourself,
assetPath: "assets/warning-grey.png",
);
return false;
diff --git a/mobile/apps/photos/lib/emergency/recover_others_account.dart b/mobile/apps/photos/lib/emergency/recover_others_account.dart
index 88003402a0..a67cae0d81 100644
--- a/mobile/apps/photos/lib/emergency/recover_others_account.dart
+++ b/mobile/apps/photos/lib/emergency/recover_others_account.dart
@@ -64,7 +64,7 @@ class _RecoverOthersAccountState extends State<RecoverOthersAccount> {
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final title = StringsLocalizations.of(context).resetPasswordTitle;
+ final title = context.strings.resetPasswordTitle;
final isFormValid = _passwordsMatch && _isPasswordValid;
return Scaffold(
@@ -111,10 +111,10 @@ class _RecoverOthersAccountState extends State<RecoverOthersAccount> {
if (_passwordInInputBox.isNotEmpty && _showPasswordStrength) {
if (_passwordStrength > kStrongPasswordStrengthThreshold) {
- passwordMessage = StringsLocalizations.of(context).strongPassword;
+ passwordMessage = context.strings.strongPassword;
passwordMessageType = TextInputMessageType.success;
} else if (_passwordStrength <= kMildPasswordStrengthThreshold) {
- passwordMessage = StringsLocalizations.of(context).weakStrength;
+ passwordMessage = context.strings.weakStrength;
passwordMessageType = TextInputMessageType.alert;
}
}
@@ -126,14 +126,10 @@ class _RecoverOthersAccountState extends State<RecoverOthersAccount> {
if (_passwordInInputConfirmationBox.isNotEmpty &&
_passwordInInputBox.isNotEmpty) {
if (_passwordsMatch) {
- confirmPasswordMessage = StringsLocalizations.of(
- context,
- ).passwordsMatch;
+ confirmPasswordMessage = context.strings.passwordsMatch;
confirmPasswordMessageType = TextInputMessageType.success;
} else {
- confirmPasswordMessage = StringsLocalizations.of(
- context,
- ).passwordsDontMatch;
+ confirmPasswordMessage = context.strings.passwordsDontMatch;
confirmPasswordMessageType = TextInputMessageType.error;
}
}
@@ -162,8 +158,8 @@ class _RecoverOthersAccountState extends State<RecoverOthersAccount> {
),
),
TextInputWidgetV2(
- label: StringsLocalizations.of(context).password,
- hintText: StringsLocalizations.of(context).password,
+ label: context.strings.password,
+ hintText: context.strings.password,
textEditingController: _passwordController1,
isPasswordInput: true,
isRequired: true,
@@ -199,8 +195,8 @@ class _RecoverOthersAccountState extends State<RecoverOthersAccount> {
),
const SizedBox(height: 16),
TextInputWidgetV2(
- label: StringsLocalizations.of(context).confirmPassword,
- hintText: StringsLocalizations.of(context).confirmPassword,
+ label: context.strings.confirmPassword,
+ hintText: context.strings.confirmPassword,
textEditingController: _passwordController2,
isPasswordInput: true,
isRequired: true,
@@ -231,7 +227,7 @@ class _RecoverOthersAccountState extends State<RecoverOthersAccount> {
Future<void> _updatePassword() async {
final dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).generatingEncryptionKeys,
+ context.strings.generatingEncryptionKeys,
);
await dialog.show();
try {
@@ -285,10 +281,7 @@ class _RecoverOthersAccountState extends State<RecoverOthersAccount> {
);
await dialog.hide();
if (!mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).passwordChangedSuccessfully,
- );
+ showShortToast(context, context.strings.passwordChangedSuccessfully);
if (!mounted) return;
Navigator.of(context).pop();
} catch (e, s) {
diff --git a/mobile/apps/photos/lib/emergency/select_contact_page.dart b/mobile/apps/photos/lib/emergency/select_contact_page.dart
index 61635099a3..d1f0c1a552 100644
--- a/mobile/apps/photos/lib/emergency/select_contact_page.dart
+++ b/mobile/apps/photos/lib/emergency/select_contact_page.dart
@@ -78,7 +78,7 @@ class _AddContactSheetState extends State<AddContactSheet> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextInputWidgetV2(
- hintText: StringsLocalizations.of(context).enterEmail,
+ hintText: context.strings.enterEmail,
textEditingController: _textController,
focusNode: textFieldFocusNode,
keyboardType: TextInputType.emailAddress,
@@ -177,7 +177,7 @@ class _AddContactSheetState extends State<AddContactSheet> {
child: ButtonWidgetV2(
buttonType: ButtonTypeV2.link,
buttonSize: ButtonSizeV2.small,
- labelText: StringsLocalizations.of(context).verifyIDLabel,
+ labelText: context.strings.verifyIDLabel,
isDisabled: emailForVerification == null,
shouldSurfaceExecutionStates: false,
onTap: emailForVerification == null
@@ -240,8 +240,8 @@ class _AddContactSheetState extends State<AddContactSheet> {
} else if (failures.isNotEmpty && mounted) {
await showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).error,
- message: StringsLocalizations.of(context).somethingWentWrong,
+ title: context.strings.error,
+ message: context.strings.somethingWentWrong,
assetPath: "assets/warning-grey.png",
);
}
@@ -251,7 +251,7 @@ class _AddContactSheetState extends State<AddContactSheet> {
List<String> emails,
int recoveryDays,
) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final message = emails.length == 1
? l10n.confirmAddingTrustedContact(
email: emails.first,
@@ -282,8 +282,8 @@ class _AddContactSheetState extends State<AddContactSheet> {
if (!_emailsToAdd.contains(emailToAdd)) {
await showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).invalidEmailAddress,
- message: StringsLocalizations.of(context).enterValidEmail,
+ title: context.strings.invalidEmailAddress,
+ message: context.strings.enterValidEmail,
assetPath: "assets/warning-grey.png",
);
return;
diff --git a/mobile/apps/photos/lib/main.dart b/mobile/apps/photos/lib/main.dart
index 4b0d5f60aa..8cd7eb71dd 100644
--- a/mobile/apps/photos/lib/main.dart
+++ b/mobile/apps/photos/lib/main.dart
@@ -155,7 +155,7 @@ Future<void> _runInForeground(
lockScreen: LockScreen(
Configuration.instance,
authReasonBuilder: (context) =>
- StringsLocalizations.of(context).authToViewYourMemories,
+ context.strings.authToViewYourMemories,
onLogout: (context) => UserService.instance.logout(context),
),
enabled:
diff --git a/mobile/apps/photos/lib/models/search/search_types.dart b/mobile/apps/photos/lib/models/search/search_types.dart
index 49920ace39..a639769f10 100644
--- a/mobile/apps/photos/lib/models/search/search_types.dart
+++ b/mobile/apps/photos/lib/models/search/search_types.dart
@@ -64,44 +64,42 @@ extension SectionTypeExtensions on SectionType {
String sectionTitle(BuildContext context) {
switch (this) {
case SectionType.face:
- return StringsLocalizations.of(context).people;
+ return context.strings.people;
case SectionType.magic:
- return StringsLocalizations.of(context).discover;
+ return context.strings.discover;
case SectionType.wrapped:
return "Ente Rewind";
case SectionType.location:
- return StringsLocalizations.of(context).locations;
+ return context.strings.locations;
case SectionType.ritual:
- return StringsLocalizations.of(context).ritualsTitle;
+ return context.strings.ritualsTitle;
case SectionType.contacts:
- return StringsLocalizations.of(context).contacts;
+ return context.strings.contacts;
case SectionType.album:
- return StringsLocalizations.of(context).albums;
+ return context.strings.albums;
case SectionType.fileTypesAndExtension:
- return StringsLocalizations.of(context).fileTypes;
+ return context.strings.fileTypes;
}
}
String getEmptyStateText(BuildContext context) {
switch (this) {
case SectionType.face:
- return StringsLocalizations.of(context).searchPersonsEmptySection;
+ return context.strings.searchPersonsEmptySection;
case SectionType.magic:
- return StringsLocalizations.of(context).searchDiscoverEmptySection;
+ return context.strings.searchDiscoverEmptySection;
case SectionType.wrapped:
return "Check back soon for your 2025 highlights.";
case SectionType.location:
- return StringsLocalizations.of(context).searchLocationEmptySection;
+ return context.strings.searchLocationEmptySection;
case SectionType.ritual:
- return StringsLocalizations.of(context).ritualSearchEmpty;
+ return context.strings.ritualSearchEmpty;
case SectionType.contacts:
- return StringsLocalizations.of(context).searchPeopleEmptySection;
+ return context.strings.searchPeopleEmptySection;
case SectionType.album:
- return StringsLocalizations.of(context).searchAlbumsEmptySection;
+ return context.strings.searchAlbumsEmptySection;
case SectionType.fileTypesAndExtension:
- return StringsLocalizations.of(
- context,
- ).searchFileTypesAndNamesEmptySection;
+ return context.strings.searchFileTypesAndNamesEmptySection;
}
}
@@ -155,13 +153,13 @@ extension SectionTypeExtensions on SectionType {
case SectionType.wrapped:
return "";
case SectionType.location:
- return StringsLocalizations.of(context).addNew;
+ return context.strings.addNew;
case SectionType.ritual:
return "";
case SectionType.contacts:
- return StringsLocalizations.of(context).invite;
+ return context.strings.invite;
case SectionType.album:
- return StringsLocalizations.of(context).addNew;
+ return context.strings.addNew;
case SectionType.fileTypesAndExtension:
return "";
}
@@ -192,11 +190,7 @@ extension SectionTypeExtensions on SectionType {
switch (this) {
case SectionType.contacts:
return () async {
- await shareText(
- StringsLocalizations.of(
- context,
- ).shareTextRecommendUsingEnteForPhotos,
- );
+ await shareText(context.strings.shareTextRecommendUsingEnteForPhotos);
};
case SectionType.location:
return () async {
@@ -212,9 +206,9 @@ extension SectionTypeExtensions on SectionType {
return () async {
final result = await showTextInputDialog(
context,
- title: StringsLocalizations.of(context).newAlbum,
- submitButtonLabel: StringsLocalizations.of(context).create,
- hintText: StringsLocalizations.of(context).enterAlbumName,
+ title: context.strings.newAlbum,
+ submitButtonLabel: context.strings.create,
+ hintText: context.strings.enterAlbumName,
alwaysShowSuccessState: false,
initialValue: "",
textCapitalization: TextCapitalization.words,
diff --git a/mobile/apps/photos/lib/services/account/user_service.dart b/mobile/apps/photos/lib/services/account/user_service.dart
index 4a22aebf07..ca32c12c6a 100644
--- a/mobile/apps/photos/lib/services/account/user_service.dart
+++ b/mobile/apps/photos/lib/services/account/user_service.dart
@@ -114,10 +114,7 @@ class UserService {
bool isResetPasswordScreen = false,
String? purpose,
}) async {
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).pleaseWait,
- );
+ final dialog = createProgressDialog(context, context.strings.pleaseWait);
await dialog.show();
try {
await _gateway.sendOtt(
@@ -184,8 +181,8 @@ class UserService {
unawaited(
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).oops,
- message: StringsLocalizations.of(context).thisEmailIsAlreadyInUse,
+ title: context.strings.oops,
+ message: context.strings.thisEmailIsAlreadyInUse,
assetPath: 'assets/warning-grey.png',
),
);
@@ -383,10 +380,7 @@ class UserService {
String ott, {
bool isResettingPasswordScreen = false,
}) async {
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).pleaseWait,
- );
+ final dialog = createProgressDialog(context, context.strings.pleaseWait);
await dialog.show();
try {
final responseData = await _gateway.verifyEmail(
@@ -440,10 +434,8 @@ class UserService {
if (!context.mounted) return;
await showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).oops,
- message: StringsLocalizations.of(
- context,
- ).yourVerificationCodeHasExpired,
+ title: context.strings.oops,
+ message: context.strings.yourVerificationCodeHasExpired,
assetPath: 'assets/warning-grey.png',
);
if (!context.mounted) return;
@@ -453,10 +445,8 @@ class UserService {
// ignore: unawaited_futures
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).incorrectCode,
- message: StringsLocalizations.of(
- context,
- ).sorryTheCodeYouveEnteredIsIncorrect,
+ title: context.strings.incorrectCode,
+ message: context.strings.sorryTheCodeYouveEnteredIsIncorrect,
assetPath: 'assets/warning-grey.png',
);
}
@@ -467,10 +457,8 @@ class UserService {
// ignore: unawaited_futures
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).oops,
- message: StringsLocalizations.of(
- context,
- ).verificationFailedPleaseTryAgain,
+ title: context.strings.oops,
+ message: context.strings.verificationFailedPleaseTryAgain,
assetPath: 'assets/warning-grey.png',
);
}
@@ -494,10 +482,7 @@ class UserService {
String email,
String ott,
) async {
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).pleaseWait,
- );
+ final dialog = createProgressDialog(context, context.strings.pleaseWait);
await dialog.show();
try {
await _gateway.changeEmail(email: email, ott: ott);
@@ -506,7 +491,7 @@ class UserService {
if (context.mounted) {
showShortToast(
context,
- StringsLocalizations.of(context).emailChangedTo(newEmail: email),
+ context.strings.emailChangedTo(newEmail: email),
);
Navigator.of(context).popUntil((route) => route.isFirst);
}
@@ -518,8 +503,8 @@ class UserService {
// ignore: unawaited_futures
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).oops,
- message: StringsLocalizations.of(context).thisEmailIsAlreadyInUse,
+ title: context.strings.oops,
+ message: context.strings.thisEmailIsAlreadyInUse,
assetPath: 'assets/warning-grey.png',
);
} else {
@@ -527,10 +512,8 @@ class UserService {
// ignore: unawaited_futures
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).incorrectCode,
- message: StringsLocalizations.of(
- context,
- ).authenticationFailedPleaseTryAgain,
+ title: context.strings.incorrectCode,
+ message: context.strings.authenticationFailedPleaseTryAgain,
assetPath: 'assets/warning-grey.png',
);
}
@@ -541,10 +524,8 @@ class UserService {
// ignore: unawaited_futures
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).oops,
- message: StringsLocalizations.of(
- context,
- ).verificationFailedPleaseTryAgain,
+ title: context.strings.oops,
+ message: context.strings.verificationFailedPleaseTryAgain,
assetPath: 'assets/warning-grey.png',
);
}
@@ -785,7 +766,7 @@ class UserService {
) async {
final dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).authenticating,
+ context.strings.authenticating,
);
await dialog.show();
try {
@@ -796,10 +777,7 @@ class UserService {
await _saveConfiguration(responseData);
await dialog.hide();
if (context.mounted) {
- showShortToast(
- context,
- StringsLocalizations.of(context).authenticationSuccessful,
- );
+ showShortToast(context, context.strings.authenticationSuccessful);
await Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@@ -814,7 +792,7 @@ class UserService {
_logger.severe(e);
if (e.response != null && e.response!.statusCode == 404) {
if (!context.mounted) return;
- showToast(context, StringsLocalizations.of(context).sessionExpired);
+ showToast(context, context.strings.sessionExpired);
if (!context.mounted) return;
await Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
@@ -829,10 +807,8 @@ class UserService {
// ignore: unawaited_futures
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).incorrectCode,
- message: StringsLocalizations.of(
- context,
- ).authenticationFailedPleaseTryAgain,
+ title: context.strings.incorrectCode,
+ message: context.strings.authenticationFailedPleaseTryAgain,
assetPath: 'assets/warning-grey.png',
);
}
@@ -843,10 +819,8 @@ class UserService {
// ignore: unawaited_futures
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).oops,
- message: StringsLocalizations.of(
- context,
- ).authenticationFailedPleaseTryAgain,
+ title: context.strings.oops,
+ message: context.strings.authenticationFailedPleaseTryAgain,
assetPath: 'assets/warning-grey.png',
);
}
@@ -857,10 +831,7 @@ class UserService {
String sessionID,
TwoFactorType type,
) async {
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).pleaseWait,
- );
+ final dialog = createProgressDialog(context, context.strings.pleaseWait);
await dialog.show();
try {
_logger.info("recovering two factor");
@@ -890,7 +861,7 @@ class UserService {
_logger.severe('error while recovery 2fa', e);
if (e.response != null && e.response!.statusCode == 404) {
if (!context.mounted) return;
- showToast(context, StringsLocalizations.of(context).sessionExpired);
+ showToast(context, context.strings.sessionExpired);
if (!context.mounted) return;
// ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
@@ -906,10 +877,8 @@ class UserService {
// ignore: unawaited_futures
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).oops,
- message: StringsLocalizations.of(
- context,
- ).somethingWentWrongPleaseTryAgain,
+ title: context.strings.oops,
+ message: context.strings.somethingWentWrongPleaseTryAgain,
assetPath: 'assets/warning-grey.png',
);
}
@@ -921,10 +890,8 @@ class UserService {
// ignore: unawaited_futures
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).oops,
- message: StringsLocalizations.of(
- context,
- ).somethingWentWrongPleaseTryAgain,
+ title: context.strings.oops,
+ message: context.strings.somethingWentWrongPleaseTryAgain,
assetPath: 'assets/warning-grey.png',
);
} finally {
@@ -940,10 +907,7 @@ class UserService {
String encryptedSecret,
String secretDecryptionNonce,
) async {
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).pleaseWait,
- );
+ final dialog = createProgressDialog(context, context.strings.pleaseWait);
await dialog.show();
String secret;
try {
@@ -967,10 +931,8 @@ class UserService {
if (!context.mounted) return;
await showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).incorrectRecoveryKey,
- message: StringsLocalizations.of(
- context,
- ).theRecoveryKeyYouEnteredIsIncorrect,
+ title: context.strings.incorrectRecoveryKey,
+ message: context.strings.theRecoveryKeyYouEnteredIsIncorrect,
assetPath: 'assets/warning-grey.png',
);
return;
@@ -986,9 +948,7 @@ class UserService {
if (context.mounted) {
showShortToast(
context,
- StringsLocalizations.of(
- context,
- ).twofactorAuthenticationSuccessfullyReset,
+ context.strings.twofactorAuthenticationSuccessfullyReset,
);
// ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
@@ -1005,7 +965,7 @@ class UserService {
_logger.severe("error during recovery", e);
if (e.response != null && e.response!.statusCode == 404) {
if (!context.mounted) return;
- showToast(context, StringsLocalizations.of(context).sessionExpired);
+ showToast(context, context.strings.sessionExpired);
if (!context.mounted) return;
// ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
@@ -1021,10 +981,8 @@ class UserService {
// ignore: unawaited_futures
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).oops,
- message: StringsLocalizations.of(
- context,
- ).somethingWentWrongPleaseTryAgain,
+ title: context.strings.oops,
+ message: context.strings.somethingWentWrongPleaseTryAgain,
assetPath: 'assets/warning-grey.png',
);
}
@@ -1036,10 +994,8 @@ class UserService {
// ignore: unawaited_futures
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).oops,
- message: StringsLocalizations.of(
- context,
- ).somethingWentWrongPleaseTryAgain,
+ title: context.strings.oops,
+ message: context.strings.somethingWentWrongPleaseTryAgain,
assetPath: 'assets/warning-grey.png',
);
} finally {
@@ -1048,10 +1004,7 @@ class UserService {
}
Future<void> setupTwoFactor(BuildContext context, Completer completer) async {
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).pleaseWait,
- );
+ final dialog = createProgressDialog(context, context.strings.pleaseWait);
await dialog.show();
try {
final responseData = await _gateway.setupTwoFactor();
@@ -1089,10 +1042,7 @@ class UserService {
return false;
}
if (!context.mounted) return false;
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).verifying,
- );
+ final dialog = createProgressDialog(context, context.strings.verifying);
await dialog.show();
final encryptionResult = CryptoUtil.encryptSync(
CryptoUtil.base642bin(secret),
@@ -1124,10 +1074,8 @@ class UserService {
// ignore: unawaited_futures
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).incorrectCode,
- message: StringsLocalizations.of(
- context,
- ).pleaseVerifyTheCodeYouHaveEntered,
+ title: context.strings.incorrectCode,
+ message: context.strings.pleaseVerifyTheCodeYouHaveEntered,
assetPath: 'assets/warning-grey.png',
);
return false;
@@ -1137,10 +1085,8 @@ class UserService {
// ignore: unawaited_futures
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).somethingWentWrong,
- message: StringsLocalizations.of(
- context,
- ).pleaseContactSupportIfTheProblemPersists,
+ title: context.strings.somethingWentWrong,
+ message: context.strings.pleaseContactSupportIfTheProblemPersists,
assetPath: 'assets/warning-grey.png',
);
}
@@ -1150,7 +1096,7 @@ class UserService {
Future<void> disableTwoFactor(BuildContext context) async {
final dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).disablingTwofactorAuthentication,
+ context.strings.disablingTwofactorAuthentication,
);
await dialog.show();
try {
@@ -1161,7 +1107,7 @@ class UserService {
if (!context.mounted) return;
showShortToast(
context,
- StringsLocalizations.of(context).twofactorAuthenticationHasBeenDisabled,
+ context.strings.twofactorAuthenticationHasBeenDisabled,
);
} catch (e) {
await dialog.hide();
@@ -1169,10 +1115,8 @@ class UserService {
if (!context.mounted) return;
await showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).somethingWentWrong,
- message: StringsLocalizations.of(
- context,
- ).pleaseContactSupportIfTheProblemPersists,
+ title: context.strings.somethingWentWrong,
+ message: context.strings.pleaseContactSupportIfTheProblemPersists,
assetPath: 'assets/warning-grey.png',
);
}
@@ -1198,10 +1142,7 @@ class UserService {
.getKeyAttributes()!
.recoveryKeyEncryptedWithMasterKey;
if (encryptedRecoveryKey == null || encryptedRecoveryKey.isEmpty) {
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).pleaseWait,
- );
+ final dialog = createProgressDialog(context, context.strings.pleaseWait);
await dialog.show();
try {
final keyAttributes = await _config.createNewRecoveryKey();
diff --git a/mobile/apps/photos/lib/services/collections_service.dart b/mobile/apps/photos/lib/services/collections_service.dart
index ec72c6b0b7..bc5e552ad5 100644
--- a/mobile/apps/photos/lib/services/collections_service.dart
+++ b/mobile/apps/photos/lib/services/collections_service.dart
@@ -1593,10 +1593,8 @@ class CollectionsService {
if (!context.mounted) return null;
await showInfoDialog(
context,
- title: StringsLocalizations.of(context).linkExpired,
- body: StringsLocalizations.of(
- context,
- ).theLinkYouAreTryingToAccessHasExpired,
+ title: context.strings.linkExpired,
+ body: context.strings.theLinkYouAreTryingToAccessHasExpired,
);
return null;
} on PublicCollectionDeviceLimitExceededException catch (e, s) {
@@ -1604,8 +1602,8 @@ class CollectionsService {
if (!context.mounted) return null;
await showErrorDialog(
context,
- StringsLocalizations.of(context).canNotOpenTitle,
- StringsLocalizations.of(context).linkRequestLimitExceeded,
+ context.strings.canNotOpenTitle,
+ context.strings.linkRequestLimitExceeded,
);
return null;
} on PublicCollectionRateLimitedException catch (e, s) {
@@ -1613,8 +1611,8 @@ class CollectionsService {
if (!context.mounted) return null;
await showErrorDialog(
context,
- StringsLocalizations.of(context).canNotOpenTitle,
- StringsLocalizations.of(context).linkRequestLimitExceeded,
+ context.strings.canNotOpenTitle,
+ context.strings.linkRequestLimitExceeded,
);
return null;
} on PublicCollectionInfoUnauthorizedException catch (e, s) {
@@ -1622,8 +1620,8 @@ class CollectionsService {
if (!context.mounted) return null;
await showErrorDialog(
context,
- StringsLocalizations.of(context).canNotOpenTitle,
- StringsLocalizations.of(context).canNotOpenBody,
+ context.strings.canNotOpenTitle,
+ context.strings.canNotOpenBody,
);
return null;
} catch (e, s) {
@@ -1658,8 +1656,8 @@ class CollectionsService {
if (!context.mounted) return false;
await showErrorDialog(
context,
- StringsLocalizations.of(context).incorrectPasswordTitle,
- StringsLocalizations.of(context).pleaseTryAgain,
+ context.strings.incorrectPasswordTitle,
+ context.strings.pleaseTryAgain,
);
return false;
}
diff --git a/mobile/apps/photos/lib/services/files_service.dart b/mobile/apps/photos/lib/services/files_service.dart
index a8bc7e73ee..3fd6817250 100644
--- a/mobile/apps/photos/lib/services/files_service.dart
+++ b/mobile/apps/photos/lib/services/files_service.dart
@@ -165,10 +165,10 @@ class FilesService {
final Map<int, Map<String, dynamic>> fileIDToUpdateMetadata = {};
await showActionSheet(
context: context,
- body: StringsLocalizations.of(context).changeLocationOfSelectedItems,
+ body: context.strings.changeLocationOfSelectedItems,
buttons: [
ButtonWidget(
- labelText: StringsLocalizations.of(context).yes,
+ labelText: context.strings.yes,
buttonType: ButtonType.neutral,
buttonSize: ButtonSize.large,
shouldStickToDarkTheme: true,
@@ -185,7 +185,7 @@ class FilesService {
},
),
ButtonWidget(
- labelText: StringsLocalizations.of(context).cancel,
+ labelText: context.strings.cancel,
buttonType: ButtonType.secondary,
buttonSize: ButtonSize.large,
shouldStickToDarkTheme: true,
diff --git a/mobile/apps/photos/lib/services/hidden_service.dart b/mobile/apps/photos/lib/services/hidden_service.dart
index c0bf2fd16c..2ee19374dd 100644
--- a/mobile/apps/photos/lib/services/hidden_service.dart
+++ b/mobile/apps/photos/lib/services/hidden_service.dart
@@ -285,11 +285,7 @@ extension HiddenService on CollectionsService {
await dialog.hide();
if (!context.mounted) return false;
unawaited(
- showErrorDialog(
- context,
- StringsLocalizations.of(context).oops,
- e.message as String,
- ),
+ showErrorDialog(context, context.strings.oops, e.message as String),
);
return false;
} catch (e, s) {
@@ -549,10 +545,7 @@ extension HiddenService on CollectionsService {
/// For files whose hidden collection is not owned by the user,
/// they are moved to the user's default hidden collection.
Future<void> cleanupHiddenFiles(BuildContext context) async {
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).pleaseWait,
- );
+ final dialog = createProgressDialog(context, context.strings.pleaseWait);
await dialog.show();
try {
@@ -606,7 +599,7 @@ extension HiddenService on CollectionsService {
await dialog.hide();
if (!context.mounted) return;
- showShortToast(context, StringsLocalizations.of(context).cleanupComplete);
+ showShortToast(context, context.strings.cleanupComplete);
} catch (e, s) {
_logger.severe("Failed to cleanup hidden files", e, s);
await dialog.hide();
diff --git a/mobile/apps/photos/lib/services/search_service.dart b/mobile/apps/photos/lib/services/search_service.dart
index 56f4ad8d79..1fc38d52be 100644
--- a/mobile/apps/photos/lib/services/search_service.dart
+++ b/mobile/apps/photos/lib/services/search_service.dart
@@ -928,9 +928,9 @@ class SearchService {
final Map<LocalEntity<LocationTag>, List<EnteFile>> result = {};
final normalizedQuery = query.toLowerCase();
if (!context.mounted) return const [];
- final noLocationName = StringsLocalizations.of(context).noLocation;
+ final noLocationName = context.strings.noLocation;
if (!context.mounted) return const [];
- final noLocationTagName = StringsLocalizations.of(context).noLocationTag;
+ final noLocationTagName = context.strings.noLocationTag;
final normalizedNoLocationName = noLocationName.toLowerCase();
final normalizedNoLocationTagName = noLocationTagName.toLowerCase();
final disambiguationPrefixLength = min(
diff --git a/mobile/apps/photos/lib/services/sync/diff_fetcher.dart b/mobile/apps/photos/lib/services/sync/diff_fetcher.dart
index 5987cfe4e8..79a0173340 100644
--- a/mobile/apps/photos/lib/services/sync/diff_fetcher.dart
+++ b/mobile/apps/photos/lib/services/sync/diff_fetcher.dart
@@ -106,7 +106,7 @@ class DiffFetcher {
if (context.mounted) {
await showErrorDialog(
context,
- StringsLocalizations.of(context).somethingWentWrong,
+ context.strings.somethingWentWrong,
e.toString(),
);
}
diff --git a/mobile/apps/photos/lib/services/video_memory_service.dart b/mobile/apps/photos/lib/services/video_memory_service.dart
index 6024868fc5..17e641edb6 100644
--- a/mobile/apps/photos/lib/services/video_memory_service.dart
+++ b/mobile/apps/photos/lib/services/video_memory_service.dart
@@ -121,9 +121,7 @@ Future<void> _executeFFmpegProcess({
if (!context.mounted) return;
showToast(
context,
- StringsLocalizations.of(
- context,
- ).videoExportSuccess(path: _generateOutputPath()),
+ context.strings.videoExportSuccess(path: _generateOutputPath()),
);
} else {
_logger.warning(
@@ -132,10 +130,7 @@ Future<void> _executeFFmpegProcess({
_completeOperation(completer, onComplete);
await FFmpegKit.cancel();
if (!context.mounted) return;
- showToast(
- context,
- StringsLocalizations.of(context).videoExportFailed,
- );
+ showToast(context, context.strings.videoExportFailed);
}
},
(log) {
diff --git a/mobile/apps/photos/lib/services/video_preview_service.dart b/mobile/apps/photos/lib/services/video_preview_service.dart
index 0efa358f92..cbb4b75e89 100644
--- a/mobile/apps/photos/lib/services/video_preview_service.dart
+++ b/mobile/apps/photos/lib/services/video_preview_service.dart
@@ -413,10 +413,7 @@ class VideoPreviewService {
final isRecreateOperation = await _isRecreateOperation(enteFile);
if (!isRecreateOperation && await getPlaylist(enteFile) != null) {
if (ctx != null && ctx.mounted) {
- showShortToast(
- ctx,
- StringsLocalizations.of(ctx).videoPreviewAlreadyExists,
- );
+ showShortToast(ctx, ctx.strings.videoPreviewAlreadyExists);
}
removeFile = true;
return;
diff --git a/mobile/apps/photos/lib/ui/account/email_entry_page.dart b/mobile/apps/photos/lib/ui/account/email_entry_page.dart
index edcb18d0c4..2303e3f8fd 100644
--- a/mobile/apps/photos/lib/ui/account/email_entry_page.dart
+++ b/mobile/apps/photos/lib/ui/account/email_entry_page.dart
@@ -100,7 +100,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
title: DeveloperSettingsTapArea(
behavior: HitTestBehavior.translucent,
child: Text(
- StringsLocalizations.of(context).createAccountTitle,
+ context.strings.createAccountTitle,
style: TextStyles.large.copyWith(color: colors.textBase),
),
),
@@ -111,7 +111,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ButtonComponent(
key: const ValueKey("createAccountButton"),
- label: StringsLocalizations.of(context).createAccountTitle,
+ label: context.strings.createAccountTitle,
isDisabled: !_isFormValid(),
onTap: _isFormValid() ? _submitCreateAccount : null,
),
@@ -128,10 +128,10 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
if (_password != null && _password!.isNotEmpty && _showPasswordStrength) {
if (_passwordStrength > kStrongPasswordStrengthThreshold) {
- passwordMessage = StringsLocalizations.of(context).strongPassword;
+ passwordMessage = context.strings.strongPassword;
passwordMessageType = TextInputComponentMessageType.success;
} else if (_passwordStrength <= kMildPasswordStrengthThreshold) {
- passwordMessage = StringsLocalizations.of(context).weakStrength;
+ passwordMessage = context.strings.weakStrength;
passwordMessageType = TextInputComponentMessageType.alert;
}
}
@@ -145,14 +145,10 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
_password!.isNotEmpty &&
_showConfirmPasswordValidation) {
if (_passwordsMatch) {
- confirmPasswordMessage = StringsLocalizations.of(
- context,
- ).passwordsMatch;
+ confirmPasswordMessage = context.strings.passwordsMatch;
confirmPasswordMessageType = TextInputComponentMessageType.success;
} else {
- confirmPasswordMessage = StringsLocalizations.of(
- context,
- ).passwordsDontMatch;
+ confirmPasswordMessage = context.strings.passwordsDontMatch;
confirmPasswordMessageType = TextInputComponentMessageType.error;
}
}
@@ -168,8 +164,8 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
children: [
const SizedBox(height: 24),
TextInputComponent(
- label: StringsLocalizations.of(context).email,
- hintText: StringsLocalizations.of(context).email,
+ label: context.strings.email,
+ hintText: context.strings.email,
controller: _emailController,
keyboardType: TextInputType.emailAddress,
autofillHints: const [AutofillHints.email],
@@ -177,7 +173,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
isRequired: true,
onChanged: _onEmailChanged,
message: _showEmailValidation && !_emailIsValid
- ? StringsLocalizations.of(context).invalidEmailAddress
+ ? context.strings.invalidEmailAddress
: null,
messageType: _showEmailValidation && !_emailIsValid
? TextInputComponentMessageType.alert
@@ -185,8 +181,8 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
),
const SizedBox(height: 24),
TextInputComponent(
- label: StringsLocalizations.of(context).password,
- hintText: StringsLocalizations.of(context).password,
+ label: context.strings.password,
+ hintText: context.strings.password,
controller: _passwordController1,
isPasswordInput: true,
isRequired: true,
@@ -223,8 +219,8 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
),
const SizedBox(height: 24),
TextInputComponent(
- label: StringsLocalizations.of(context).confirmPassword,
- hintText: StringsLocalizations.of(context).confirmPassword,
+ label: context.strings.confirmPassword,
+ hintText: context.strings.confirmPassword,
controller: _passwordController2,
isPasswordInput: true,
isRequired: true,
@@ -261,7 +257,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
if (_showReferralSourceField) ...[
const SizedBox(height: 24),
TextInputComponent(
- label: StringsLocalizations.of(context).hearUsWhereTitle,
+ label: context.strings.hearUsWhereTitle,
autocorrect: false,
shouldUnfocusOnClearOrSubmit: true,
onSubmit: _isFormValid()
@@ -355,12 +351,12 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
- StringsLocalizations.of(context).alreadyHaveAnAccount,
+ context.strings.alreadyHaveAnAccount,
style: TextStyles.body.copyWith(color: colors.textLight),
),
const SizedBox(width: 4),
ButtonComponent(
- label: StringsLocalizations.of(context).logInLabel,
+ label: context.strings.logInLabel,
variant: ButtonComponentVariant.link,
size: ButtonComponentSize.small,
shouldSurfaceExecutionStates: false,
@@ -428,7 +424,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
const SizedBox(width: 8),
Expanded(
child: StyledText(
- text: StringsLocalizations.of(context).signUpTerms,
+ text: context.strings.signUpTerms,
style: TextStyles.mini.copyWith(color: colors.textLight),
tags: {
'u-terms': StyledTextActionTag(
@@ -437,9 +433,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
MaterialPageRoute(
builder: (BuildContext context) {
return WebPage(
- StringsLocalizations.of(
- context,
- ).termsOfServicesTitle,
+ context.strings.termsOfServicesTitle,
"https://ente.com/terms",
);
},
@@ -456,9 +450,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
MaterialPageRoute(
builder: (BuildContext context) {
return WebPage(
- StringsLocalizations.of(
- context,
- ).privacyPolicyTitle,
+ context.strings.privacyPolicyTitle,
"https://ente.com/privacy",
);
},
diff --git a/mobile/apps/photos/lib/ui/account/login_page.dart b/mobile/apps/photos/lib/ui/account/login_page.dart
index 3bf6dd3685..4d59e464d9 100644
--- a/mobile/apps/photos/lib/ui/account/login_page.dart
+++ b/mobile/apps/photos/lib/ui/account/login_page.dart
@@ -75,7 +75,7 @@ class _LoginPageState extends State<LoginPage> {
title: DeveloperSettingsTapArea(
behavior: HitTestBehavior.translucent,
child: Text(
- StringsLocalizations.of(context).loginToEnte,
+ context.strings.loginToEnte,
style: TextStyles.large.copyWith(color: colors.textBase),
),
),
@@ -86,7 +86,7 @@ class _LoginPageState extends State<LoginPage> {
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ButtonComponent(
key: const ValueKey("logInButton"),
- label: StringsLocalizations.of(context).continueLabel,
+ label: context.strings.continueLabel,
isDisabled: !_emailIsValid,
onTap: _emailIsValid ? _submitLoginEmail : null,
),
@@ -106,8 +106,8 @@ class _LoginPageState extends State<LoginPage> {
const SizedBox(height: 20),
TextInputComponent(
key: const ValueKey("emailInputField"),
- label: StringsLocalizations.of(context).email,
- hintText: StringsLocalizations.of(context).emailHint,
+ label: context.strings.email,
+ hintText: context.strings.emailHint,
controller: _emailController,
keyboardType: TextInputType.emailAddress,
autofillHints: const [AutofillHints.email],
@@ -118,7 +118,7 @@ class _LoginPageState extends State<LoginPage> {
onSubmit: (_) => _submitLoginEmail(),
onChanged: _onEmailChanged,
message: _showValidationMessage && !_emailIsValid
- ? StringsLocalizations.of(context).invalidEmailAddress
+ ? context.strings.invalidEmailAddress
: null,
messageType: _showValidationMessage && !_emailIsValid
? TextInputComponentMessageType.alert
@@ -142,13 +142,13 @@ class _LoginPageState extends State<LoginPage> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
- StringsLocalizations.of(context).dontHaveAnAccount,
+ context.strings.dontHaveAnAccount,
style: TextStyles.body.copyWith(color: colors.textLight),
),
const SizedBox(width: 4),
ButtonComponent(
- label: StringsLocalizations.of(context).signUp,
+ label: context.strings.signUp,
variant: ButtonComponentVariant.link,
size: ButtonComponentSize.small,
shouldSurfaceExecutionStates: false,
diff --git a/mobile/apps/photos/lib/ui/account/login_pwd_verification_page.dart b/mobile/apps/photos/lib/ui/account/login_pwd_verification_page.dart
index 631cd97d42..6ea440d0a5 100644
--- a/mobile/apps/photos/lib/ui/account/login_pwd_verification_page.dart
+++ b/mobile/apps/photos/lib/ui/account/login_pwd_verification_page.dart
@@ -70,7 +70,7 @@ class _LoginPasswordVerificationPageState
},
),
title: Text(
- StringsLocalizations.of(context).logInLabel,
+ context.strings.logInLabel,
style: TextStyles.large.copyWith(color: colors.textBase),
),
centerTitle: true,
@@ -80,7 +80,7 @@ class _LoginPasswordVerificationPageState
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ButtonComponent(
key: const ValueKey("verifyPasswordButton"),
- label: StringsLocalizations.of(context).logInLabel,
+ label: context.strings.logInLabel,
isDisabled: !_hasPassword,
onTap: _verifyEnteredPassword,
),
@@ -115,8 +115,8 @@ class _LoginPasswordVerificationPageState
),
TextInputComponent(
key: const ValueKey("passwordInputField"),
- label: StringsLocalizations.of(context).password,
- hintText: StringsLocalizations.of(context).enterYourPassword,
+ label: context.strings.password,
+ hintText: context.strings.enterYourPassword,
controller: _passwordController,
isPasswordInput: true,
isRequired: true,
@@ -138,7 +138,7 @@ class _LoginPasswordVerificationPageState
alignment: Alignment.centerRight,
child: ButtonComponent(
variant: ButtonComponentVariant.link,
- label: StringsLocalizations.of(context).forgotPassword,
+ label: context.strings.forgotPassword,
size: ButtonComponentSize.small,
onTap: () async {
await UserService.instance.sendOtt(
@@ -157,7 +157,7 @@ class _LoginPasswordVerificationPageState
Future<void> verifyPassword(BuildContext context, String password) async {
final dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).pleaseWait,
+ context.strings.pleaseWait,
isDismissible: true,
);
await dialog.show();
@@ -176,8 +176,8 @@ class _LoginPasswordVerificationPageState
if (!context.mounted) return;
await _showContactSupportDialog(
context,
- StringsLocalizations.of(context).incorrectPasswordTitle,
- StringsLocalizations.of(context).pleaseTryAgain,
+ context.strings.incorrectPasswordTitle,
+ context.strings.pleaseTryAgain,
);
} else {
_logger.severe('API failure during SRP login ${e.type}', e, s);
@@ -187,17 +187,15 @@ class _LoginPasswordVerificationPageState
if (!context.mounted) return;
await _showContactSupportDialog(
context,
- StringsLocalizations.of(context).noInternetConnection,
- StringsLocalizations.of(
- context,
- ).pleaseCheckYourInternetConnectionAndTryAgain,
+ context.strings.noInternetConnection,
+ context.strings.pleaseCheckYourInternetConnectionAndTryAgain,
);
} else {
if (!context.mounted) return;
await _showContactSupportDialog(
context,
- StringsLocalizations.of(context).somethingWentWrong,
- StringsLocalizations.of(context).verificationFailedPleaseTryAgain,
+ context.strings.somethingWentWrong,
+ context.strings.verificationFailedPleaseTryAgain,
);
}
}
@@ -219,9 +217,9 @@ class _LoginPasswordVerificationPageState
if (!context.mounted) return;
final dialogChoice = await showChoiceDialog(
context,
- title: StringsLocalizations.of(context).recreatePasswordTitle,
- body: StringsLocalizations.of(context).recreatePasswordBody,
- firstButtonLabel: StringsLocalizations.of(context).useRecoveryKey,
+ title: context.strings.recreatePasswordTitle,
+ body: context.strings.recreatePasswordBody,
+ firstButtonLabel: context.strings.useRecoveryKey,
);
if (dialogChoice?.action == ButtonAction.first && context.mounted) {
await UserService.instance.sendOtt(
@@ -236,8 +234,8 @@ class _LoginPasswordVerificationPageState
if (!context.mounted) return;
await _showContactSupportDialog(
context,
- StringsLocalizations.of(context).oops,
- StringsLocalizations.of(context).verificationFailedPleaseTryAgain,
+ context.strings.oops,
+ context.strings.verificationFailedPleaseTryAgain,
);
}
}
@@ -252,13 +250,13 @@ class _LoginPasswordVerificationPageState
context,
title: title,
body: message,
- firstButtonLabel: StringsLocalizations.of(context).contactSupport,
- secondButtonLabel: StringsLocalizations.of(context).ok,
+ firstButtonLabel: context.strings.contactSupport,
+ secondButtonLabel: context.strings.ok,
);
if (dialogChoice?.action == ButtonAction.first && context.mounted) {
await sendLogs(
context,
- StringsLocalizations.of(context).contactSupport,
+ context.strings.contactSupport,
postShare: () {},
);
diff --git a/mobile/apps/photos/lib/ui/account/ott_verification_page.dart b/mobile/apps/photos/lib/ui/account/ott_verification_page.dart
index 7530d1a01c..bdfde2b7ff 100644
--- a/mobile/apps/photos/lib/ui/account/ott_verification_page.dart
+++ b/mobile/apps/photos/lib/ui/account/ott_verification_page.dart
@@ -87,7 +87,7 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
},
),
title: Text(
- StringsLocalizations.of(context).verifyEmail,
+ context.strings.verifyEmail,
style: TextStyles.large.copyWith(color: colors.textBase),
),
centerTitle: true,
@@ -97,7 +97,7 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ButtonComponent(
key: const ValueKey("verifyOttButton"),
- label: StringsLocalizations.of(context).verify,
+ label: context.strings.verify,
isDisabled: !isFormValid,
onTap: isFormValid ? _onVerifyPressed : null,
),
@@ -142,17 +142,15 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
Center(child: Image.asset('assets/ott.png', height: 96)),
const SizedBox(height: 24),
Text(
- StringsLocalizations.of(
- context,
- ).weHaveSentCodeTo(email: widget.email),
+ context.strings.weHaveSentCodeTo(email: widget.email),
style: TextStyles.body.copyWith(color: colors.textBase),
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
Text(
widget.isResetPasswordScreen
- ? StringsLocalizations.of(context).toResetVerifyEmail
- : StringsLocalizations.of(context).checkInboxAndSpamFolder,
+ ? context.strings.toResetVerifyEmail
+ : context.strings.checkInboxAndSpamFolder,
style: TextStyles.body.copyWith(color: colors.textLight),
textAlign: TextAlign.center,
),
@@ -183,7 +181,7 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
Align(
alignment: Alignment.centerRight,
child: ButtonComponent(
- label: StringsLocalizations.of(context).resendCode,
+ label: context.strings.resendCode,
variant: ButtonComponentVariant.link,
size: ButtonComponentSize.small,
onTap: () async {
diff --git a/mobile/apps/photos/lib/ui/account/passkey_page.dart b/mobile/apps/photos/lib/ui/account/passkey_page.dart
index bd8fc672e8..99c5ff5481 100644
--- a/mobile/apps/photos/lib/ui/account/passkey_page.dart
+++ b/mobile/apps/photos/lib/ui/account/passkey_page.dart
@@ -105,19 +105,13 @@ class _PasskeyPageState extends State<PasskeyPage> {
if (mounted && link.toLowerCase().startsWith("ente://passkey")) {
if (Configuration.instance.isLoggedIn()) {
_logger.info('ignored deeplink: already configured');
- showToast(
- context,
- StringsLocalizations.of(context).accountIsAlreadyConfigured,
- );
+ showToast(context, context.strings.accountIsAlreadyConfigured);
return;
}
final parsedUri = Uri.parse(link);
final sessionID = parsedUri.queryParameters['passkeySessionID'];
if (sessionID != widget.sessionID) {
- showToast(
- context,
- StringsLocalizations.of(context).sessionIdMismatch,
- );
+ showToast(context, context.strings.sessionIdMismatch);
_logger.warning('ignored deeplink: sessionID mismatch');
return;
}
@@ -169,7 +163,7 @@ class _PasskeyPageState extends State<PasskeyPage> {
},
),
title: Text(
- StringsLocalizations.of(context).passkey,
+ context.strings.passkey,
style: TextStyles.large.copyWith(color: colors.textBase),
),
centerTitle: true,
diff --git a/mobile/apps/photos/lib/ui/account/password_entry_page.dart b/mobile/apps/photos/lib/ui/account/password_entry_page.dart
index eeb12df4ab..cc1394c980 100644
--- a/mobile/apps/photos/lib/ui/account/password_entry_page.dart
+++ b/mobile/apps/photos/lib/ui/account/password_entry_page.dart
@@ -76,13 +76,13 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
Widget build(BuildContext context) {
final colors = context.componentColors;
- String title = StringsLocalizations.of(context).setPasswordTitle;
+ String title = context.strings.setPasswordTitle;
if (widget.mode == PasswordEntryMode.update) {
- title = StringsLocalizations.of(context).changePasswordTitle;
+ title = context.strings.changePasswordTitle;
} else if (widget.mode == PasswordEntryMode.reset) {
- title = StringsLocalizations.of(context).resetPasswordTitle;
+ title = context.strings.resetPasswordTitle;
} else if (_volatilePassword != null) {
- title = StringsLocalizations.of(context).encryptionKeys;
+ title = context.strings.encryptionKeys;
}
final isFormValid = _passwordsMatch && _isPasswordValid;
@@ -138,13 +138,13 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
if (_passwordInInputBox.isNotEmpty && _showPasswordStrength) {
if (_passwordStrength > kStrongPasswordStrengthThreshold) {
- passwordMessage = StringsLocalizations.of(context).strongPassword;
+ passwordMessage = context.strings.strongPassword;
passwordMessageType = TextInputComponentMessageType.success;
} else if (_passwordStrength > kMildPasswordStrengthThreshold) {
- passwordMessage = StringsLocalizations.of(context).moderateStrength;
+ passwordMessage = context.strings.moderateStrength;
passwordMessageType = TextInputComponentMessageType.alert;
} else {
- passwordMessage = StringsLocalizations.of(context).weakStrength;
+ passwordMessage = context.strings.weakStrength;
passwordMessageType = TextInputComponentMessageType.alert;
}
}
@@ -157,14 +157,10 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
_passwordInInputBox.isNotEmpty &&
_showConfirmPasswordValidation) {
if (_passwordsMatch) {
- confirmPasswordMessage = StringsLocalizations.of(
- context,
- ).passwordsMatch;
+ confirmPasswordMessage = context.strings.passwordsMatch;
confirmPasswordMessageType = TextInputComponentMessageType.success;
} else {
- confirmPasswordMessage = StringsLocalizations.of(
- context,
- ).passwordsDontMatch;
+ confirmPasswordMessage = context.strings.passwordsDontMatch;
confirmPasswordMessageType = TextInputComponentMessageType.error;
}
}
@@ -180,15 +176,13 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
const SizedBox(height: 16),
Text(
widget.mode == PasswordEntryMode.set
- ? StringsLocalizations.of(context).enterPasswordToEncrypt
- : StringsLocalizations.of(
- context,
- ).enterNewPasswordToEncrypt,
+ ? context.strings.enterPasswordToEncrypt
+ : context.strings.enterNewPasswordToEncrypt,
style: TextStyles.body.copyWith(color: colors.textLight),
),
const SizedBox(height: 8),
StyledText(
- text: StringsLocalizations.of(context).passwordWarning,
+ text: context.strings.passwordWarning,
style: TextStyles.body.copyWith(color: colors.textLight),
tags: {
'underline': StyledTextTag(
@@ -211,8 +205,8 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
),
),
TextInputComponent(
- label: StringsLocalizations.of(context).password,
- hintText: StringsLocalizations.of(context).password,
+ label: context.strings.password,
+ hintText: context.strings.password,
controller: _passwordController1,
isPasswordInput: true,
isRequired: true,
@@ -246,8 +240,8 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
),
const SizedBox(height: 16),
TextInputComponent(
- label: StringsLocalizations.of(context).confirmPassword,
- hintText: StringsLocalizations.of(context).confirmPassword,
+ label: context.strings.confirmPassword,
+ hintText: context.strings.confirmPassword,
controller: _passwordController2,
isPasswordInput: true,
isRequired: true,
@@ -288,14 +282,14 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
alignment: Alignment.centerRight,
child: ButtonComponent(
variant: ButtonComponentVariant.link,
- label: StringsLocalizations.of(context).howItWorks,
+ label: context.strings.howItWorks,
size: ButtonComponentSize.small,
onTap: () async {
await Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return WebPage(
- StringsLocalizations.of(context).howItWorks,
+ context.strings.howItWorks,
"https://ente.com/architecture",
);
},
@@ -324,7 +318,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
if (!mounted) return;
final dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).generatingEncryptionKeys,
+ context.strings.generatingEncryptionKeys,
);
await dialog.show();
try {
@@ -341,10 +335,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
Bus.instance.fire(SubscriptionPurchasedEvent());
}
if (!mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).passwordChangedSuccessfully,
- );
+ showShortToast(context, context.strings.passwordChangedSuccessfully);
if (!mounted) return;
Navigator.of(context).pop();
if (widget.mode == PasswordEntryMode.reset) {
@@ -382,7 +373,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
Future<void> _showRecoveryCodeDialog(String password) async {
final dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).generatingEncryptionKeys,
+ context.strings.generatingEncryptionKeys,
);
await dialog.show();
try {
@@ -394,7 +385,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
Future<void> onDone() async {
final dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).pleaseWait,
+ context.strings.pleaseWait,
);
await dialog.show();
try {
@@ -426,7 +417,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
context,
RecoveryKeyPage(
result.privateKeyAttributes.recoveryKey,
- StringsLocalizations.of(context).continueLabel,
+ context.strings.continueLabel,
onDone: onDone,
isOnboarding: true,
),
@@ -439,10 +430,10 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
// ignore: unawaited_futures
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).insecureDevice,
- message: StringsLocalizations.of(
- context,
- ).sorryWeCouldNotGenerateSecureKeysOnThisDevicennplease,
+ title: context.strings.insecureDevice,
+ message: context
+ .strings
+ .sorryWeCouldNotGenerateSecureKeysOnThisDevicennplease,
assetPath: 'assets/warning-grey.png',
);
} else {
diff --git a/mobile/apps/photos/lib/ui/account/password_reentry_page.dart b/mobile/apps/photos/lib/ui/account/password_reentry_page.dart
index 1f448d3ecd..6c28292bc6 100644
--- a/mobile/apps/photos/lib/ui/account/password_reentry_page.dart
+++ b/mobile/apps/photos/lib/ui/account/password_reentry_page.dart
@@ -69,7 +69,7 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
},
),
title: Text(
- StringsLocalizations.of(context).enterPassword,
+ context.strings.enterPassword,
style: TextStyles.large.copyWith(color: colors.textBase),
),
centerTitle: true,
@@ -79,7 +79,7 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ButtonComponent(
key: const ValueKey("verifyPasswordButton"),
- label: StringsLocalizations.of(context).logInLabel,
+ label: context.strings.logInLabel,
isDisabled: !isFormValid,
onTap: isFormValid ? _onVerifyPasswordPressed : null,
),
@@ -98,10 +98,7 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
Future<void> verifyPassword(String password) async {
FocusScope.of(context).unfocus();
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).pleaseWait,
- );
+ final dialog = createProgressDialog(context, context.strings.pleaseWait);
await dialog.show();
try {
final kek = await Configuration.instance.decryptSecretsAndGetKeyEncKey(
@@ -116,9 +113,9 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
if (!mounted) return;
final dialogChoice = await showChoiceDialog(
context,
- title: StringsLocalizations.of(context).recreatePasswordTitle,
- body: StringsLocalizations.of(context).recreatePasswordBody,
- firstButtonLabel: StringsLocalizations.of(context).useRecoveryKey,
+ title: context.strings.recreatePasswordTitle,
+ body: context.strings.recreatePasswordBody,
+ firstButtonLabel: context.strings.useRecoveryKey,
);
if (dialogChoice!.action == ButtonAction.first) {
if (!mounted) return;
@@ -138,16 +135,16 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
if (!mounted) return;
final dialogChoice = await showChoiceDialog(
context,
- title: StringsLocalizations.of(context).incorrectPasswordTitle,
- body: StringsLocalizations.of(context).pleaseTryAgain,
- firstButtonLabel: StringsLocalizations.of(context).contactSupport,
- secondButtonLabel: StringsLocalizations.of(context).ok,
+ title: context.strings.incorrectPasswordTitle,
+ body: context.strings.pleaseTryAgain,
+ firstButtonLabel: context.strings.contactSupport,
+ secondButtonLabel: context.strings.ok,
);
if (dialogChoice!.action == ButtonAction.first) {
if (!mounted) return;
await sendLogs(
context,
- StringsLocalizations.of(context).contactSupport,
+ context.strings.contactSupport,
postShare: () {},
);
@@ -214,9 +211,9 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
),
TextInputComponent(
key: const ValueKey("passwordInputField"),
- label: StringsLocalizations.of(context).password,
+ label: context.strings.password,
isRequired: true,
- hintText: StringsLocalizations.of(context).enterYourPassword,
+ hintText: context.strings.enterYourPassword,
controller: _passwordController,
isPasswordInput: true,
autocorrect: false,
@@ -234,12 +231,12 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
children: [
ButtonComponent(
variant: ButtonComponentVariant.link,
- label: StringsLocalizations.of(context).changeEmail,
+ label: context.strings.changeEmail,
size: ButtonComponentSize.small,
onTap: () async {
final dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).pleaseWait,
+ context.strings.pleaseWait,
);
await dialog.show();
await Configuration.instance.logout();
@@ -250,7 +247,7 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
),
ButtonComponent(
variant: ButtonComponentVariant.link,
- label: StringsLocalizations.of(context).forgotPassword,
+ label: context.strings.forgotPassword,
size: ButtonComponentSize.small,
onTap: () async {
// ignore: unawaited_futures
diff --git a/mobile/apps/photos/lib/ui/account/recovery_key_page.dart b/mobile/apps/photos/lib/ui/account/recovery_key_page.dart
index 695d61266e..1969d7d128 100644
--- a/mobile/apps/photos/lib/ui/account/recovery_key_page.dart
+++ b/mobile/apps/photos/lib/ui/account/recovery_key_page.dart
@@ -59,7 +59,7 @@ class _RecoveryKeyPageState extends State<RecoveryKeyPage> {
elevation: 0,
scrolledUnderElevation: 0,
title: Text(
- widget.title ?? StringsLocalizations.of(context).recoveryKey,
+ widget.title ?? context.strings.recoveryKey,
style: TextStyles.large.copyWith(color: colors.textBase),
),
centerTitle: true,
@@ -100,19 +100,14 @@ class _RecoveryKeyPageState extends State<RecoveryKeyPage> {
),
const SizedBox(height: 24),
Text(
- widget.text ??
- StringsLocalizations.of(
- context,
- ).recoveryKeyOnForgotPassword,
+ widget.text ?? context.strings.recoveryKeyOnForgotPassword,
textAlign: TextAlign.center,
style: TextStyles.body.copyWith(color: colors.textBase),
),
const SizedBox(height: 20),
Text(
widget.subText ??
- StringsLocalizations.of(
- context,
- ).recoveryKeySaveShortDescription,
+ context.strings.recoveryKeySaveShortDescription,
textAlign: TextAlign.center,
style: TextStyles.body.copyWith(color: colors.textLight),
),
@@ -147,9 +142,7 @@ class _RecoveryKeyPageState extends State<RecoveryKeyPage> {
if (!mounted) return;
showShortToast(
context,
- StringsLocalizations.of(
- context,
- ).recoveryKeyCopiedToClipboard,
+ context.strings.recoveryKeyCopiedToClipboard,
);
},
child: HugeIcon(
@@ -166,7 +159,7 @@ class _RecoveryKeyPageState extends State<RecoveryKeyPage> {
child: ButtonComponent(
variant: ButtonComponentVariant.secondary,
shouldSurfaceExecutionStates: false,
- label: StringsLocalizations.of(context).shareKey,
+ label: context.strings.shareKey,
onTap: () async {
unawaited(_shareRecoveryKey(recoveryKey));
},
diff --git a/mobile/apps/photos/lib/ui/account/recovery_page.dart b/mobile/apps/photos/lib/ui/account/recovery_page.dart
index c299d8181a..8cfc12fc47 100644
--- a/mobile/apps/photos/lib/ui/account/recovery_page.dart
+++ b/mobile/apps/photos/lib/ui/account/recovery_page.dart
@@ -43,7 +43,7 @@ class _RecoveryPageState extends State<RecoveryPage> {
},
),
title: Text(
- StringsLocalizations.of(context).recoverAccount,
+ context.strings.recoverAccount,
style: TextStyles.large.copyWith(color: colors.textBase),
),
centerTitle: true,
@@ -53,7 +53,7 @@ class _RecoveryPageState extends State<RecoveryPage> {
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ButtonComponent(
key: const ValueKey("recoveryButton"),
- label: StringsLocalizations.of(context).logInLabel,
+ label: context.strings.logInLabel,
isDisabled: !isFormValid,
onTap: isFormValid ? _onRecoverPressed : null,
),
@@ -69,8 +69,8 @@ class _RecoveryPageState extends State<RecoveryPage> {
children: [
const SizedBox(height: 12),
TextInputComponent(
- label: StringsLocalizations.of(context).recoveryKey,
- hintText: StringsLocalizations.of(context).enterYourRecoveryKey,
+ label: context.strings.recoveryKey,
+ hintText: context.strings.enterYourRecoveryKey,
controller: _recoveryKeyController,
keyboardType: TextInputType.multiline,
maxLines: null,
@@ -84,7 +84,7 @@ class _RecoveryPageState extends State<RecoveryPage> {
Align(
alignment: Alignment.centerRight,
child: ButtonComponent(
- label: StringsLocalizations.of(context).forgotRecoveryKey,
+ label: context.strings.forgotRecoveryKey,
variant: ButtonComponentVariant.link,
size: ButtonComponentSize.small,
shouldSurfaceExecutionStates: false,
@@ -92,10 +92,8 @@ class _RecoveryPageState extends State<RecoveryPage> {
// ignore: unawaited_futures
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).sorry,
- message: StringsLocalizations.of(
- context,
- ).noRecoveryKeyNoDecryption,
+ title: context.strings.sorry,
+ message: context.strings.noRecoveryKeyNoDecryption,
assetPath: 'assets/warning-grey.png',
);
},
@@ -108,19 +106,13 @@ class _RecoveryPageState extends State<RecoveryPage> {
Future<void> _onRecoverPressed() async {
FocusScope.of(context).unfocus();
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).decrypting,
- );
+ final dialog = createProgressDialog(context, context.strings.decrypting);
await dialog.show();
try {
await Configuration.instance.recover(_recoveryKeyController.text.trim());
await dialog.hide();
if (!mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).recoverySuccessful,
- );
+ showShortToast(context, context.strings.recoverySuccessful);
if (!mounted) return;
// ignore: unawaited_futures
Navigator.of(context).pushReplacement(
@@ -136,9 +128,7 @@ class _RecoveryPageState extends State<RecoveryPage> {
} catch (e) {
await dialog.hide();
if (!mounted) return;
- String errMessage = StringsLocalizations.of(
- context,
- ).incorrectRecoveryKeyBody;
+ String errMessage = context.strings.incorrectRecoveryKeyBody;
if (e is AssertionError) {
errMessage = '$errMessage : ${e.message}';
}
@@ -146,7 +136,7 @@ class _RecoveryPageState extends State<RecoveryPage> {
// ignore: unawaited_futures
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).incorrectRecoveryKeyTitle,
+ title: context.strings.incorrectRecoveryKeyTitle,
message: errMessage,
assetPath: 'assets/warning-grey.png',
);
diff --git a/mobile/apps/photos/lib/ui/account/sessions_page.dart b/mobile/apps/photos/lib/ui/account/sessions_page.dart
index 9454f682d6..78bf11d4ce 100644
--- a/mobile/apps/photos/lib/ui/account/sessions_page.dart
+++ b/mobile/apps/photos/lib/ui/account/sessions_page.dart
@@ -26,10 +26,7 @@ class _SessionsPageState extends State<SessionsPage> {
void initState() {
_fetchActiveSessions().onError((error, stackTrace) {
if (!mounted) return;
- showToast(
- context,
- StringsLocalizations.of(context).failedToFetchActiveSessions,
- );
+ showToast(context, context.strings.failedToFetchActiveSessions);
});
super.initState();
}
@@ -37,7 +34,7 @@ class _SessionsPageState extends State<SessionsPage> {
@override
Widget build(BuildContext context) {
return SettingsPageScaffold(
- title: StringsLocalizations.of(context).activeSessions,
+ title: context.strings.activeSessions,
padding: EdgeInsets.zero,
children: _getBodyChildren(context),
);
@@ -109,10 +106,7 @@ class _SessionsPageState extends State<SessionsPage> {
}
Future<void> _terminateSession(Session session) async {
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).pleaseWait,
- );
+ final dialog = createProgressDialog(context, context.strings.pleaseWait);
await dialog.show();
try {
await UserService.instance.terminateSession(session.token);
@@ -125,10 +119,8 @@ class _SessionsPageState extends State<SessionsPage> {
// ignore: unawaited_futures
showErrorBottomSheetComponent<void>(
context: context,
- title: StringsLocalizations.of(context).oops,
- message: StringsLocalizations.of(
- context,
- ).somethingWentWrongPleaseTryAgain,
+ title: context.strings.oops,
+ message: context.strings.somethingWentWrongPleaseTryAgain,
illustration: Image.asset("assets/warning-grey.png"),
);
}
@@ -150,7 +142,7 @@ class _SessionsPageState extends State<SessionsPage> {
}
void _showSessionTerminationDialog(Session session) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final isLoggingOutFromThisDevice =
session.token == Configuration.instance.getToken();
final displayedUserAgent = session.ua.length > 256
@@ -191,7 +183,7 @@ class _SessionsPageState extends State<SessionsPage> {
final colors = context.componentColors;
if (session.token == Configuration.instance.getToken()) {
return Text(
- StringsLocalizations.of(context).thisDevice,
+ context.strings.thisDevice,
style: TextStyles.bodyBold.copyWith(color: colors.primary),
);
}
diff --git a/mobile/apps/photos/lib/ui/account/two_factor_authentication_page.dart b/mobile/apps/photos/lib/ui/account/two_factor_authentication_page.dart
index f88dcb3f98..90279ff516 100644
--- a/mobile/apps/photos/lib/ui/account/two_factor_authentication_page.dart
+++ b/mobile/apps/photos/lib/ui/account/two_factor_authentication_page.dart
@@ -64,7 +64,7 @@ class _TwoFactorAuthenticationPageState
},
),
title: Text(
- StringsLocalizations.of(context).twoFAVerification,
+ context.strings.twoFAVerification,
style: TextStyles.large.copyWith(color: colors.textBase),
),
centerTitle: true,
@@ -108,15 +108,13 @@ class _TwoFactorAuthenticationPageState
children: [
const SizedBox(height: 24),
Text(
- StringsLocalizations.of(context).twoFAVerification,
+ context.strings.twoFAVerification,
style: TextStyles.body.copyWith(color: colors.textBase),
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
Text(
- StringsLocalizations.of(
- context,
- ).enterThe6digitCodeFromnyourAuthenticatorApp,
+ context.strings.enterThe6digitCodeFromnyourAuthenticatorApp,
style: TextStyles.body.copyWith(color: colors.textLight),
textAlign: TextAlign.center,
),
@@ -142,7 +140,7 @@ class _TwoFactorAuthenticationPageState
),
const Spacer(),
ButtonComponent(
- label: StringsLocalizations.of(context).verify,
+ label: context.strings.verify,
isDisabled: _code.length != 6,
onTap: _code.length == 6
? () => _verifyTwoFactorCode(_code)
@@ -151,7 +149,7 @@ class _TwoFactorAuthenticationPageState
const SizedBox(height: 16),
Center(
child: ButtonComponent(
- label: StringsLocalizations.of(context).lostDevice,
+ label: context.strings.lostDevice,
variant: ButtonComponentVariant.link,
size: ButtonComponentSize.small,
onTap: () async {
diff --git a/mobile/apps/photos/lib/ui/account/two_factor_recovery_page.dart b/mobile/apps/photos/lib/ui/account/two_factor_recovery_page.dart
index 03008fd3ae..9c674871e4 100644
--- a/mobile/apps/photos/lib/ui/account/two_factor_recovery_page.dart
+++ b/mobile/apps/photos/lib/ui/account/two_factor_recovery_page.dart
@@ -53,7 +53,7 @@ class _TwoFactorRecoveryPageState extends State<TwoFactorRecoveryPage> {
},
),
title: Text(
- StringsLocalizations.of(context).recoverAccount,
+ context.strings.recoverAccount,
style: TextStyles.large.copyWith(color: colors.textBase),
),
centerTitle: true,
@@ -63,7 +63,7 @@ class _TwoFactorRecoveryPageState extends State<TwoFactorRecoveryPage> {
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ButtonComponent(
key: const ValueKey("recover2FAButton"),
- label: StringsLocalizations.of(context).recover,
+ label: context.strings.recover,
isDisabled: !isFormValid,
onTap: isFormValid
? () async {
@@ -92,8 +92,8 @@ class _TwoFactorRecoveryPageState extends State<TwoFactorRecoveryPage> {
children: [
const SizedBox(height: 24),
TextInputComponent(
- label: StringsLocalizations.of(context).recoveryKey,
- hintText: StringsLocalizations.of(context).enterYourRecoveryKey,
+ label: context.strings.recoveryKey,
+ hintText: context.strings.enterYourRecoveryKey,
controller: _recoveryKeyController,
autocorrect: false,
keyboardType: TextInputType.multiline,
@@ -114,7 +114,7 @@ class _TwoFactorRecoveryPageState extends State<TwoFactorRecoveryPage> {
Align(
alignment: Alignment.centerRight,
child: ButtonComponent(
- label: StringsLocalizations.of(context).forgotRecoveryKey,
+ label: context.strings.forgotRecoveryKey,
variant: ButtonComponentVariant.link,
size: ButtonComponentSize.small,
shouldSurfaceExecutionStates: false,
@@ -122,10 +122,10 @@ class _TwoFactorRecoveryPageState extends State<TwoFactorRecoveryPage> {
// ignore: unawaited_futures
showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).contactSupport,
- message: StringsLocalizations.of(
- context,
- ).dropSupportEmail(supportEmail: "[email protected]"),
+ title: context.strings.contactSupport,
+ message: context.strings.dropSupportEmail(
+ supportEmail: "[email protected]",
+ ),
assetPath: 'assets/warning-grey.png',
);
},
diff --git a/mobile/apps/photos/lib/ui/account/two_factor_setup_page.dart b/mobile/apps/photos/lib/ui/account/two_factor_setup_page.dart
index 4d0f06703a..7d8b95ebb9 100644
--- a/mobile/apps/photos/lib/ui/account/two_factor_setup_page.dart
+++ b/mobile/apps/photos/lib/ui/account/two_factor_setup_page.dart
@@ -77,10 +77,7 @@ class _TwoFactorSetupPageState extends State<TwoFactorSetupPage>
@override
Widget build(BuildContext context) {
return Scaffold(
- appBar: AppBar(
- elevation: 0,
- title: Text(StringsLocalizations.of(context).twofactorSetup),
- ),
+ appBar: AppBar(elevation: 0, title: Text(context.strings.twofactorSetup)),
body: _getBody(),
);
}
@@ -100,8 +97,8 @@ class _TwoFactorSetupPageState extends State<TwoFactorSetupPage>
labelColor: Theme.of(context).colorScheme.greenAlternative,
unselectedLabelColor: Colors.grey,
tabs: [
- Tab(text: StringsLocalizations.of(context).enterCode),
- Tab(text: StringsLocalizations.of(context).scanCode),
+ Tab(text: context.strings.enterCode),
+ Tab(text: context.strings.scanCode),
],
controller: _tabController,
indicatorSize: TabBarIndicatorSize.tab,
@@ -133,19 +130,14 @@ class _TwoFactorSetupPageState extends State<TwoFactorSetupPage>
onTap: () async {
await Clipboard.setData(ClipboardData(text: widget.secretCode));
if (!mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).codeCopiedToClipboard,
- );
+ showShortToast(context, context.strings.codeCopiedToClipboard);
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Padding(padding: EdgeInsets.all(12)),
Text(
- StringsLocalizations.of(
- context,
- ).copypasteThisCodentoYourAuthenticatorApp,
+ context.strings.copypasteThisCodentoYourAuthenticatorApp,
style: const TextStyle(height: 1.4, fontSize: 16),
textAlign: TextAlign.center,
),
@@ -169,7 +161,7 @@ class _TwoFactorSetupPageState extends State<TwoFactorSetupPage>
),
const Padding(padding: EdgeInsets.all(6)),
Text(
- StringsLocalizations.of(context).tapToCopy,
+ context.strings.tapToCopy,
style: TextStyle(color: textColor.withValues(alpha: 0.5)),
),
],
@@ -183,9 +175,7 @@ class _TwoFactorSetupPageState extends State<TwoFactorSetupPage>
children: [
const Padding(padding: EdgeInsets.all(12)),
Text(
- StringsLocalizations.of(
- context,
- ).scanThisBarcodeWithnyourAuthenticatorApp,
+ context.strings.scanThisBarcodeWithnyourAuthenticatorApp,
style: const TextStyle(height: 1.4, fontSize: 16),
textAlign: TextAlign.center,
),
@@ -201,9 +191,7 @@ class _TwoFactorSetupPageState extends State<TwoFactorSetupPage>
children: [
const Padding(padding: EdgeInsets.all(12)),
Text(
- StringsLocalizations.of(
- context,
- ).enterThe6digitCodeFromnyourAuthenticatorApp,
+ context.strings.enterThe6digitCodeFromnyourAuthenticatorApp,
style: const TextStyle(height: 1.4, fontSize: 16),
textAlign: TextAlign.center,
),
@@ -247,7 +235,7 @@ class _TwoFactorSetupPageState extends State<TwoFactorSetupPage>
await _enableTwoFactor(_code);
}
: null,
- child: Text(StringsLocalizations.of(context).confirm),
+ child: Text(context.strings.confirm),
),
const Padding(padding: EdgeInsets.only(bottom: 24)),
],
@@ -273,16 +261,12 @@ class _TwoFactorSetupPageState extends State<TwoFactorSetupPage>
context,
RecoveryKeyPage(
recoveryKey,
- StringsLocalizations.of(context).ok,
+ context.strings.ok,
isOnboarding: false,
onDone: () {},
- title: StringsLocalizations.of(context).setupComplete,
- text: StringsLocalizations.of(
- context,
- ).saveYourRecoveryKeyIfYouHaventAlready,
- subText: StringsLocalizations.of(
- context,
- ).thisCanBeUsedToRecoverYourAccountIfYou,
+ title: context.strings.setupComplete,
+ text: context.strings.saveYourRecoveryKeyIfYouHaventAlready,
+ subText: context.strings.thisCanBeUsedToRecoverYourAccountIfYou,
),
);
}
diff --git a/mobile/apps/photos/lib/ui/account/verify_recovery_page.dart b/mobile/apps/photos/lib/ui/account/verify_recovery_page.dart
index 8deb6ae156..f885d18150 100644
--- a/mobile/apps/photos/lib/ui/account/verify_recovery_page.dart
+++ b/mobile/apps/photos/lib/ui/account/verify_recovery_page.dart
@@ -36,7 +36,7 @@ class _VerifyRecoveryPageState extends State<VerifyRecoveryPage> {
void _verifyRecoveryKey() async {
final dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).verifyingRecoveryKey,
+ context.strings.verifyingRecoveryKey,
);
await dialog.show();
try {
@@ -55,10 +55,9 @@ class _VerifyRecoveryPageState extends State<VerifyRecoveryPage> {
if (!mounted) return;
await showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).noInternetConnection,
- message: StringsLocalizations.of(
- context,
- ).pleaseCheckYourInternetConnectionAndTryAgain,
+ title: context.strings.noInternetConnection,
+ message:
+ context.strings.pleaseCheckYourInternetConnectionAndTryAgain,
assetPath: 'assets/warning-grey.png',
);
} else {
@@ -72,8 +71,8 @@ class _VerifyRecoveryPageState extends State<VerifyRecoveryPage> {
if (!mounted) return;
await showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).recoveryKeyVerified,
- message: StringsLocalizations.of(context).recoveryKeySuccessBody,
+ title: context.strings.recoveryKeyVerified,
+ message: context.strings.recoveryKeySuccessBody,
assetPath: 'assets/warning-grey.png',
);
if (!mounted) return;
@@ -85,16 +84,14 @@ class _VerifyRecoveryPageState extends State<VerifyRecoveryPage> {
_logger.severe("failed to verify recovery key", e, s);
await dialog.hide();
if (!mounted) return;
- final String errMessage = StringsLocalizations.of(
- context,
- ).invalidRecoveryKey;
+ final String errMessage = context.strings.invalidRecoveryKey;
if (!mounted) return;
final result = await showChoiceDialog(
context,
- title: StringsLocalizations.of(context).invalidKey,
+ title: context.strings.invalidKey,
body: errMessage,
- firstButtonLabel: StringsLocalizations.of(context).tryAgain,
- secondButtonLabel: StringsLocalizations.of(context).viewRecoveryKey,
+ firstButtonLabel: context.strings.tryAgain,
+ secondButtonLabel: context.strings.viewRecoveryKey,
secondButtonAction: ButtonAction.second,
);
if (result?.action == ButtonAction.second) {
@@ -122,7 +119,7 @@ class _VerifyRecoveryPageState extends State<VerifyRecoveryPage> {
context,
RecoveryKeyPage(
recoveryKey,
- StringsLocalizations.of(context).ok,
+ context.strings.ok,
isOnboarding: false,
onDone: () {
Navigator.of(context).pop();
@@ -170,16 +167,14 @@ class _VerifyRecoveryPageState extends State<VerifyRecoveryPage> {
SizedBox(
width: double.infinity,
child: Text(
- StringsLocalizations.of(context).confirmRecoveryKey,
+ context.strings.confirmRecoveryKey,
style: TextStyles.h1.copyWith(color: colors.textBase),
textAlign: TextAlign.left,
),
),
const SizedBox(height: 18),
Text(
- StringsLocalizations.of(
- context,
- ).recoveryKeyVerifyReason,
+ context.strings.recoveryKeyVerifyReason,
style: TextStyles.mini.copyWith(
color: colors.textLight,
),
@@ -187,9 +182,7 @@ class _VerifyRecoveryPageState extends State<VerifyRecoveryPage> {
const SizedBox(height: 12),
TextInputComponent(
controller: _recoveryKey,
- hintText: StringsLocalizations.of(
- context,
- ).enterYourRecoveryKey,
+ hintText: context.strings.enterYourRecoveryKey,
autocorrect: false,
keyboardType: TextInputType.multiline,
minLines: 4,
@@ -209,7 +202,7 @@ class _VerifyRecoveryPageState extends State<VerifyRecoveryPage> {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ButtonComponent(
- label: StringsLocalizations.of(context).confirm,
+ label: context.strings.confirm,
onTap: _verifyRecoveryKey,
),
const SizedBox(height: 8),
diff --git a/mobile/apps/photos/lib/ui/actions/collection/collection_file_actions.dart b/mobile/apps/photos/lib/ui/actions/collection/collection_file_actions.dart
index ad74b7f88d..35c19f4ea5 100644
--- a/mobile/apps/photos/lib/ui/actions/collection/collection_file_actions.dart
+++ b/mobile/apps/photos/lib/ui/actions/collection/collection_file_actions.dart
@@ -38,7 +38,7 @@ extension CollectionFileActions on CollectionActions {
context: context,
buttons: [
ButtonWidget(
- labelText: StringsLocalizations.of(context).remove,
+ labelText: context.strings.remove,
buttonType: removingOthersFile
? ButtonType.critical
: ButtonType.neutral,
@@ -60,7 +60,7 @@ extension CollectionFileActions on CollectionActions {
},
),
ButtonWidget(
- labelText: StringsLocalizations.of(context).cancel,
+ labelText: context.strings.cancel,
buttonType: ButtonType.secondary,
buttonSize: ButtonSize.large,
buttonAction: ButtonAction.second,
@@ -68,10 +68,10 @@ extension CollectionFileActions on CollectionActions {
isInAlert: true,
),
],
- title: StringsLocalizations.of(context).removeFromAlbumTitle,
+ title: context.strings.removeFromAlbumTitle,
body: removingOthersFile
- ? StringsLocalizations.of(context).removeShareItemsWarning
- : StringsLocalizations.of(context).itemsWillBeRemovedFromAlbum,
+ ? context.strings.removeShareItemsWarning
+ : context.strings.itemsWillBeRemovedFromAlbum,
actionSheetType: ActionSheetType.defaultActionSheet,
);
if (actionResult?.action != null &&
@@ -95,7 +95,7 @@ extension CollectionFileActions on CollectionActions {
final ProgressDialog? dialog = showProgressDialog
? createProgressDialog(
context,
- StringsLocalizations.of(context).uploadingFilesToAlbum,
+ context.strings.uploadingFilesToAlbum,
isDismissible: true,
)
: null;
@@ -202,7 +202,7 @@ extension CollectionFileActions on CollectionActions {
ProgressDialog? dialog = showProgressDialog
? createProgressDialog(
context,
- StringsLocalizations.of(context).uploadingFilesToAlbum,
+ context.strings.uploadingFilesToAlbum,
isDismissible: true,
)
: null;
@@ -254,7 +254,7 @@ extension CollectionFileActions on CollectionActions {
if (!context.mounted) return false;
dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).uploadingFilesToAlbum,
+ context.strings.uploadingFilesToAlbum,
isDismissible: true,
);
await dialog.show();
@@ -314,8 +314,8 @@ extension CollectionFileActions on CollectionActions {
final ProgressDialog dialog = createProgressDialog(
context,
markAsFavorite
- ? StringsLocalizations.of(context).addingToFavorites
- : StringsLocalizations.of(context).removingFromFavorites,
+ ? context.strings.addingToFavorites
+ : context.strings.removingFromFavorites,
);
await dialog.show();
@@ -333,8 +333,8 @@ extension CollectionFileActions on CollectionActions {
showShortToast(
context,
markAsFavorite
- ? StringsLocalizations.of(context).sorryCouldNotAddToFavorites
- : StringsLocalizations.of(context).sorryCouldNotRemoveFromFavorites,
+ ? context.strings.sorryCouldNotAddToFavorites
+ : context.strings.sorryCouldNotRemoveFromFavorites,
);
} finally {
await dialog.hide();
diff --git a/mobile/apps/photos/lib/ui/actions/collection/collection_sharing_actions.dart b/mobile/apps/photos/lib/ui/actions/collection/collection_sharing_actions.dart
index d1fd18eaa8..400328b6fe 100644
--- a/mobile/apps/photos/lib/ui/actions/collection/collection_sharing_actions.dart
+++ b/mobile/apps/photos/lib/ui/actions/collection/collection_sharing_actions.dart
@@ -73,7 +73,7 @@ class CollectionActions {
shouldStickToDarkTheme: true,
buttonAction: ButtonAction.first,
shouldSurfaceExecutionStates: true,
- labelText: StringsLocalizations.of(context).yesRemove,
+ labelText: context.strings.yesRemove,
onTap: () async {
// for quickLink collection, we need to trash the collection
if (collection.isQuickLinkCollection() && !collection.hasSharees) {
@@ -88,15 +88,13 @@ class CollectionActions {
buttonAction: ButtonAction.cancel,
isInAlert: true,
shouldStickToDarkTheme: true,
- labelText: StringsLocalizations.of(context).cancel,
+ labelText: context.strings.cancel,
),
],
- title: StringsLocalizations.of(context).removePublicLink,
+ title: context.strings.removePublicLink,
body:
//'This will remove the public link for accessing "${collection.name}".',
- StringsLocalizations.of(
- context,
- ).disableLinkMessage(albumName: collection.displayName),
+ context.strings.disableLinkMessage(albumName: collection.displayName),
);
if (actionResult?.action != null) {
if (actionResult!.action == ButtonAction.error) {
@@ -182,7 +180,7 @@ class CollectionActions {
shouldStickToDarkTheme: true,
buttonAction: ButtonAction.first,
shouldSurfaceExecutionStates: true,
- labelText: StringsLocalizations.of(context).yesRemove,
+ labelText: context.strings.yesRemove,
onTap: () async {
final newSharees = await CollectionsService.instance.unshare(
collection.id,
@@ -196,13 +194,13 @@ class CollectionActions {
buttonAction: ButtonAction.cancel,
isInAlert: true,
shouldStickToDarkTheme: true,
- labelText: StringsLocalizations.of(context).cancel,
+ labelText: context.strings.cancel,
),
],
- title: StringsLocalizations.of(context).removeWithQuestionMark,
- body: StringsLocalizations.of(
- context,
- ).removeAlbumParticipantBody(userEmail: resolveDisplayName(user)),
+ title: context.strings.removeWithQuestionMark,
+ body: context.strings.removeAlbumParticipantBody(
+ userEmail: resolveDisplayName(user),
+ ),
);
if (actionResult?.action != null) {
if (actionResult!.action == ButtonAction.error) {
@@ -227,7 +225,7 @@ class CollectionActions {
if (showProgress) {
dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).sharing,
+ context.strings.sharing,
isDismissible: true,
);
await dialog.show();
@@ -265,15 +263,15 @@ class CollectionActions {
if (!isValidEmail(email)) {
await showErrorDialog(
context,
- StringsLocalizations.of(context).invalidEmailAddress,
- StringsLocalizations.of(context).enterValidEmail,
+ context.strings.invalidEmailAddress,
+ context.strings.enterValidEmail,
);
return false;
} else if (email.trim() == Configuration.instance.getEmail()) {
await showErrorDialog(
context,
- StringsLocalizations.of(context).oops,
- StringsLocalizations.of(context).youCannotShareWithYourself,
+ context.strings.oops,
+ context.strings.youCannotShareWithYourself,
);
return false;
}
@@ -283,7 +281,7 @@ class CollectionActions {
if (showProgress) {
dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).sharing,
+ context.strings.sharing,
isDismissible: true,
);
await dialog.show();
@@ -306,25 +304,19 @@ class CollectionActions {
if (!context.mounted) return false;
await showDialogWidget(
context: context,
- title: StringsLocalizations.of(context).inviteToEnte,
+ title: context.strings.inviteToEnte,
icon: Icons.info_outline,
- body: StringsLocalizations.of(
- context,
- ).emailNoEnteAccountPhotos(email: email),
+ body: context.strings.emailNoEnteAccountPhotos(email: email),
isDismissible: true,
buttons: [
ButtonWidget(
buttonType: ButtonType.neutral,
icon: Icons.adaptive.share,
- labelText: StringsLocalizations.of(context).sendInvite,
+ labelText: context.strings.sendInvite,
isInAlert: true,
onTap: () async {
unawaited(
- shareText(
- StringsLocalizations.of(
- context,
- ).shareTextRecommendUsingEnteForPhotos,
- ),
+ shareText(context.strings.shareTextRecommendUsingEnteForPhotos),
);
},
),
@@ -363,10 +355,10 @@ class CollectionActions {
) async {
return _showDeleteCollectionConfirmationSheet(
context: context,
- title: StringsLocalizations.of(context).deleteMultipleAlbumsQuestion,
- message: StringsLocalizations.of(
- context,
- ).deleteMultipleAlbumDialog(count: collections.length),
+ title: context.strings.deleteMultipleAlbumsQuestion,
+ message: context.strings.deleteMultipleAlbumDialog(
+ count: collections.length,
+ ),
keepPhotos: () async {
for (final collection in collections) {
try {
@@ -411,8 +403,8 @@ class CollectionActions {
if (!bContext.mounted) return false;
return _showDeleteCollectionConfirmationSheet(
context: bContext,
- title: StringsLocalizations.of(bContext).deleteAlbumQuestion,
- message: StringsLocalizations.of(bContext).deleteAlbumDialog,
+ title: bContext.strings.deleteAlbumQuestion,
+ message: bContext.strings.deleteAlbumDialog,
keepPhotos: () async {
try {
await trashCollectionKeepingPhotos(collection);
@@ -439,7 +431,7 @@ class CollectionActions {
required Future<void> Function() keepPhotos,
required Future<void> Function() deletePhotos,
}) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final actionResult = await showBottomSheetComponent<ButtonResult>(
context: context,
builder: (sheetContext) {
@@ -566,9 +558,9 @@ class CollectionActions {
final actionResult = await showChoiceActionSheet(
context,
isCritical: true,
- title: StringsLocalizations.of(context).deleteSharedAlbum,
- firstButtonLabel: StringsLocalizations.of(context).deleteAlbum,
- body: StringsLocalizations.of(context).deleteSharedAlbumDialogBody,
+ title: context.strings.deleteSharedAlbum,
+ firstButtonLabel: context.strings.deleteAlbum,
+ body: context.strings.deleteSharedAlbumDialogBody,
);
return actionResult?.action != null &&
actionResult!.action == ButtonAction.first;
@@ -637,10 +629,7 @@ class CollectionActions {
if (!isCollectionOwner && split.ownedByOtherUsers.isNotEmpty) {
if (context != null && context.mounted) {
- showShortToast(
- context,
- StringsLocalizations.of(context).canOnlyRemoveFilesOwnedByYou,
- );
+ showShortToast(context, context.strings.canOnlyRemoveFilesOwnedByYou);
}
return;
}
@@ -783,8 +772,8 @@ class CollectionActions {
Future<void> _showUnSupportedAlert(BuildContext context) async {
final AlertDialog alert = AlertDialog(
- title: Text(StringsLocalizations.of(context).sorry),
- content: Text(StringsLocalizations.of(context).subscribeToEnableSharing),
+ title: Text(context.strings.sorry),
+ content: Text(context.strings.subscribeToEnableSharing),
actions: [
ButtonWidget(
buttonType: ButtonType.primary,
@@ -792,7 +781,7 @@ class CollectionActions {
shouldStickToDarkTheme: false,
buttonAction: ButtonAction.first,
shouldSurfaceExecutionStates: true,
- labelText: StringsLocalizations.of(context).subscribe,
+ labelText: context.strings.subscribe,
onTap: () async {
// for quickLink collection, we need to trash the collection
Navigator.of(context)
@@ -813,7 +802,7 @@ class CollectionActions {
buttonAction: ButtonAction.cancel,
isInAlert: true,
shouldStickToDarkTheme: false,
- labelText: StringsLocalizations.of(context).ok,
+ labelText: context.strings.ok,
),
),
],
diff --git a/mobile/apps/photos/lib/ui/actions/file/file_actions.dart b/mobile/apps/photos/lib/ui/actions/file/file_actions.dart
index 30f089469d..33c9340a02 100644
--- a/mobile/apps/photos/lib/ui/actions/file/file_actions.dart
+++ b/mobile/apps/photos/lib/ui/actions/file/file_actions.dart
@@ -21,7 +21,7 @@ Future<void> showSingleFileDeleteSheet(
Function(EnteFile)? onFileRemoved,
bool isLocalOnlyContext = false,
}) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final bool isLocal = file.localID != null;
final bool isRemote = file.uploadedFileID != null;
if (isLocalGalleryMode) {
diff --git a/mobile/apps/photos/lib/ui/cast/cast.dart b/mobile/apps/photos/lib/ui/cast/cast.dart
index d31973f663..aea2ab3990 100644
--- a/mobile/apps/photos/lib/ui/cast/cast.dart
+++ b/mobile/apps/photos/lib/ui/cast/cast.dart
@@ -16,7 +16,7 @@ import "package:photos/ui/settings/cast/cast_settings_page.dart";
import "package:photos/utils/dialog_util.dart";
Future<void> showCastSheet(BuildContext context, Collection collection) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final textStyle = getEnteTextTheme(context);
final gw = CastGateway(NetworkClient.instance.enteDio);
final showAutoPair = castService.isSupported;
diff --git a/mobile/apps/photos/lib/ui/cast/pair_with_auto.dart b/mobile/apps/photos/lib/ui/cast/pair_with_auto.dart
index d6a500e227..92c3766382 100644
--- a/mobile/apps/photos/lib/ui/cast/pair_with_auto.dart
+++ b/mobile/apps/photos/lib/ui/cast/pair_with_auto.dart
@@ -47,7 +47,7 @@ class _PairWithAutoSheetState extends State<_PairWithAutoSheet> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final textStyles = getEnteTextTheme(context);
final body = Platform.isIOS
? "${l10n.autoCastDialogBody}\n\n${l10n.autoCastiOSPermission}"
@@ -166,7 +166,7 @@ class _PairWithAutoSheetState extends State<_PairWithAutoSheet> {
}
Future<void> _confirmStopCasting(Object device) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
await showBottomSheetComponent<void>(
context: context,
builder: (sheetContext) => BottomSheetComponent(
@@ -201,7 +201,7 @@ class _PairWithAutoSheetState extends State<_PairWithAutoSheet> {
}
Future<void> _handleError(Object error, StackTrace stackTrace) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
_logger.severe("Failed to pair automatically", error, stackTrace);
if (error is CastIPMismatchException) {
await showErrorDialog(
diff --git a/mobile/apps/photos/lib/ui/cast/pair_with_code.dart b/mobile/apps/photos/lib/ui/cast/pair_with_code.dart
index 3676b73ac4..df4465daf2 100644
--- a/mobile/apps/photos/lib/ui/cast/pair_with_code.dart
+++ b/mobile/apps/photos/lib/ui/cast/pair_with_code.dart
@@ -67,7 +67,7 @@ class _PairWithCodeSheetState extends State<_PairWithCodeSheet> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final logger = Logger("PairWithCodeSheet");
final textStyles = getEnteTextTheme(context);
return BottomSheetComponent(
diff --git a/mobile/apps/photos/lib/ui/collections/album/horizontal_list.dart b/mobile/apps/photos/lib/ui/collections/album/horizontal_list.dart
index 21a7fbacbf..06c11234d3 100644
--- a/mobile/apps/photos/lib/ui/collections/album/horizontal_list.dart
+++ b/mobile/apps/photos/lib/ui/collections/album/horizontal_list.dart
@@ -71,7 +71,7 @@ class _AlbumHorizontalListState extends State<AlbumHorizontalList> {
builder: (context, snapshot) {
if (snapshot.hasError) {
_logger.severe("failed to fetch albums", snapshot.error);
- return Text(StringsLocalizations.of(context).somethingWentWrong);
+ return Text(context.strings.somethingWentWrong);
} else if (snapshot.hasData) {
if (snapshot.data!.isEmpty) {
return const SizedBox.shrink();
@@ -94,7 +94,7 @@ class _AlbumHorizontalListState extends State<AlbumHorizontalList> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
- StringsLocalizations.of(context).albums,
+ context.strings.albums,
style: getEnteTextTheme(context).large,
),
if (widget.onViewAllTapped != null)
diff --git a/mobile/apps/photos/lib/ui/collections/album/list_item.dart b/mobile/apps/photos/lib/ui/collections/album/list_item.dart
index c9fad8323e..a5c78b0e92 100644
--- a/mobile/apps/photos/lib/ui/collections/album/list_item.dart
+++ b/mobile/apps/photos/lib/ui/collections/album/list_item.dart
@@ -89,9 +89,7 @@ class AlbumListItemWidget extends StatelessWidget {
builder: (context, snapshot) {
String countText = "";
if (snapshot.hasData) {
- countText = StringsLocalizations.of(
- context,
- ).itemCount(count: snapshot.data!);
+ countText = context.strings.itemCount(count: snapshot.data!);
} else if (snapshot.hasError) {
Logger("AlbumListItemWidget").severe(
"Failed to fetch file count of collection",
@@ -102,9 +100,7 @@ class AlbumListItemWidget extends StatelessWidget {
collection,
);
if (cachedCount != null) {
- countText = StringsLocalizations.of(
- context,
- ).itemCount(count: cachedCount);
+ countText = context.strings.itemCount(count: cachedCount);
}
}
return _buildSubtitle(
diff --git a/mobile/apps/photos/lib/ui/collections/album/new_list_item.dart b/mobile/apps/photos/lib/ui/collections/album/new_list_item.dart
index 562e5468e3..2e8a885ff9 100644
--- a/mobile/apps/photos/lib/ui/collections/album/new_list_item.dart
+++ b/mobile/apps/photos/lib/ui/collections/album/new_list_item.dart
@@ -37,7 +37,7 @@ class NewAlbumListItemWidget extends StatelessWidget {
),
),
title: Text(
- StringsLocalizations.of(context).createAlbum,
+ context.strings.createAlbum,
style: TextStyles.body.copyWith(color: colors.textLight),
maxLines: 1,
softWrap: false,
diff --git a/mobile/apps/photos/lib/ui/collections/album/new_row_item.dart b/mobile/apps/photos/lib/ui/collections/album/new_row_item.dart
index 80406220b0..1b1e31f4c2 100644
--- a/mobile/apps/photos/lib/ui/collections/album/new_row_item.dart
+++ b/mobile/apps/photos/lib/ui/collections/album/new_row_item.dart
@@ -44,7 +44,7 @@ class NewAlbumRowItemWidget extends StatelessWidget {
),
const SizedBox(height: _thumbnailToTextSpacing),
Text(
- StringsLocalizations.of(context).createAlbum,
+ context.strings.createAlbum,
style: TextStyles.body.copyWith(color: colors.textLight),
maxLines: 1,
softWrap: false,
diff --git a/mobile/apps/photos/lib/ui/collections/album/row_item.dart b/mobile/apps/photos/lib/ui/collections/album/row_item.dart
index 0f6e91d632..d618f233d3 100644
--- a/mobile/apps/photos/lib/ui/collections/album/row_item.dart
+++ b/mobile/apps/photos/lib/ui/collections/album/row_item.dart
@@ -286,9 +286,9 @@ class AlbumRowItemWidget extends StatelessWidget {
.getCachedFileCount(c);
}
if (cachedCount != null && cachedCount > 0) {
- final String textCount = StringsLocalizations.of(
- context,
- ).itemCount(count: cachedCount);
+ final String textCount = context.strings.itemCount(
+ count: cachedCount,
+ );
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
diff --git a/mobile/apps/photos/lib/ui/collections/album/smart_album_people.dart b/mobile/apps/photos/lib/ui/collections/album/smart_album_people.dart
index 4f5324005a..1942ddedf7 100644
--- a/mobile/apps/photos/lib/ui/collections/album/smart_album_people.dart
+++ b/mobile/apps/photos/lib/ui/collections/album/smart_album_people.dart
@@ -74,14 +74,14 @@ class _SmartAlbumPeopleState extends State<SmartAlbumPeople> {
: _selectedPeople.personIds.isNotEmpty;
return ButtonComponent(
variant: ButtonComponentVariant.primary,
- label: StringsLocalizations.of(context).save,
+ label: context.strings.save,
shouldSurfaceExecutionStates: false,
isDisabled: !areIdsChanged,
onTap: areIdsChanged
? () async {
final dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).pleaseWait,
+ context.strings.pleaseWait,
isDismissible: true,
);
@@ -191,8 +191,8 @@ class _SmartAlbumPeopleState extends State<SmartAlbumPeople> {
),
),
body: AppBarComponent(
- title: StringsLocalizations.of(context).people,
- subtitle: StringsLocalizations.of(context).peopleAutoAddDesc,
+ title: context.strings.people,
+ subtitle: context.strings.peopleAutoAddDesc,
physics: const BouncingScrollPhysics(),
slivers: <Widget>[
SliverFillRemaining(
@@ -211,10 +211,10 @@ Future<bool> removeFilesDialog(BuildContext context) async {
final completer = Completer<bool>();
await showActionSheet(
context: context,
- body: StringsLocalizations.of(context).shouldRemoveFilesSmartAlbumsDesc,
+ body: context.strings.shouldRemoveFilesSmartAlbumsDesc,
buttons: [
ButtonWidget(
- labelText: StringsLocalizations.of(context).yes,
+ labelText: context.strings.yes,
buttonType: ButtonType.neutral,
buttonSize: ButtonSize.large,
shouldStickToDarkTheme: true,
@@ -226,7 +226,7 @@ Future<bool> removeFilesDialog(BuildContext context) async {
},
),
ButtonWidget(
- labelText: StringsLocalizations.of(context).no,
+ labelText: context.strings.no,
buttonType: ButtonType.secondary,
buttonSize: ButtonSize.large,
shouldStickToDarkTheme: true,
diff --git a/mobile/apps/photos/lib/ui/collections/album/vertical_list.dart b/mobile/apps/photos/lib/ui/collections/album/vertical_list.dart
index 8aaedb09f4..fc5dd50749 100644
--- a/mobile/apps/photos/lib/ui/collections/album/vertical_list.dart
+++ b/mobile/apps/photos/lib/ui/collections/album/vertical_list.dart
@@ -132,10 +132,7 @@ class _AlbumVerticalListWidgetState extends State<AlbumVerticalListWidget> {
// Recent header
if (hasRecentCollections && adjustedIndex == 0) {
- return _buildSectionHeader(
- context,
- StringsLocalizations.of(context).recent,
- );
+ return _buildSectionHeader(context, context.strings.recent);
}
// Recent collections
@@ -243,9 +240,7 @@ class _AlbumVerticalListWidgetState extends State<AlbumVerticalListWidget> {
if (!context.mounted) return;
showShortToast(
context,
- StringsLocalizations.of(
- context,
- ).addedSuccessfullyTo(albumName: item.displayName),
+ context.strings.addedSuccessfullyTo(albumName: item.displayName),
);
if (!context.mounted) return;
Navigator.pop(context);
@@ -255,7 +250,7 @@ class _AlbumVerticalListWidgetState extends State<AlbumVerticalListWidget> {
}
Future<bool> _showAddToSharedAlbumSheet(BuildContext context) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final result = await showBottomSheetComponent<bool>(
context: context,
builder: (sheetContext) => BottomSheetComponent(
@@ -313,9 +308,9 @@ class _AlbumVerticalListWidgetState extends State<AlbumVerticalListWidget> {
if (filesCount > 0) {
final result = await showTextInputDialog(
context,
- title: StringsLocalizations.of(context).albumTitle,
- submitButtonLabel: StringsLocalizations.of(context).ok,
- hintText: StringsLocalizations.of(context).enterAlbumName,
+ title: context.strings.albumTitle,
+ submitButtonLabel: context.strings.ok,
+ hintText: context.strings.enterAlbumName,
onSubmit: (name) async {
return await _nameAlbum(context, name);
},
@@ -330,10 +325,7 @@ class _AlbumVerticalListWidgetState extends State<AlbumVerticalListWidget> {
}
} else {
Navigator.pop(context);
- showToast(
- context,
- StringsLocalizations.of(context).createAlbumActionHint,
- );
+ showToast(context, context.strings.createAlbumActionHint);
Bus.instance.fire(
TabChangedEvent(0, TabChangedEventSource.collectionsPage),
);
@@ -412,31 +404,31 @@ class _AlbumVerticalListWidgetState extends State<AlbumVerticalListWidget> {
if (widget.actionType == CollectionActionType.addFiles) {
if (!context.mounted) return;
- toastMessage = StringsLocalizations.of(
- context,
- ).addedSuccessfullyTo(albumName: item.displayName);
+ toastMessage = context.strings.addedSuccessfullyTo(
+ albumName: item.displayName,
+ );
shouldNavigateToCollection = true;
} else if (widget.actionType == CollectionActionType.moveFiles ||
widget.actionType == CollectionActionType.restoreFiles ||
widget.actionType == CollectionActionType.unHide) {
if (!context.mounted) return;
- toastMessage = StringsLocalizations.of(
- context,
- ).movedSuccessfullyTo(albumName: item.displayName);
+ toastMessage = context.strings.movedSuccessfullyTo(
+ albumName: item.displayName,
+ );
shouldNavigateToCollection = true;
} else if (widget.actionType ==
CollectionActionType.moveToHiddenCollection) {
if (!context.mounted) return;
- toastMessage = StringsLocalizations.of(
- context,
- ).movedSuccessfullyTo(albumName: item.displayName);
+ toastMessage = context.strings.movedSuccessfullyTo(
+ albumName: item.displayName,
+ );
shouldNavigateToCollection = true;
hasVerifiedLock = true;
} else if (widget.actionType == CollectionActionType.addToHiddenAlbum) {
if (!context.mounted) return;
- toastMessage = StringsLocalizations.of(
- context,
- ).addedSuccessfullyTo(albumName: item.displayName);
+ toastMessage = context.strings.addedSuccessfullyTo(
+ albumName: item.displayName,
+ );
shouldNavigateToCollection = true;
hasVerifiedLock = true;
} else {
@@ -538,9 +530,9 @@ class _AlbumVerticalListWidgetState extends State<AlbumVerticalListWidget> {
late final String message;
if (widget.actionType == CollectionActionType.moveFiles ||
widget.actionType == CollectionActionType.moveToHiddenCollection) {
- message = StringsLocalizations.of(context).movingFilesToAlbum;
+ message = context.strings.movingFilesToAlbum;
} else {
- message = StringsLocalizations.of(context).unhidingFilesToAlbum;
+ message = context.strings.unhidingFilesToAlbum;
}
final dialog = createProgressDialog(context, message, isDismissible: true);
@@ -563,11 +555,7 @@ class _AlbumVerticalListWidgetState extends State<AlbumVerticalListWidget> {
await dialog.hide();
if (!context.mounted) return false;
// ignore: unawaited_futures
- showErrorDialog(
- context,
- StringsLocalizations.of(context).oops,
- e.message as String?,
- );
+ showErrorDialog(context, context.strings.oops, e.message as String?);
return false;
} catch (e, s) {
_logger.severe("Could not move to album", e, s);
@@ -584,7 +572,7 @@ class _AlbumVerticalListWidgetState extends State<AlbumVerticalListWidget> {
) async {
final dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).restoringFiles,
+ context.strings.restoringFiles,
isDismissible: true,
);
await dialog.show();
@@ -602,11 +590,7 @@ class _AlbumVerticalListWidgetState extends State<AlbumVerticalListWidget> {
await dialog.hide();
if (!context.mounted) return false;
// ignore: unawaited_futures
- showErrorDialog(
- context,
- StringsLocalizations.of(context).oops,
- e.message as String?,
- );
+ showErrorDialog(context, context.strings.oops, e.message as String?);
return false;
} catch (e, s) {
_logger.severe("Could not move to album", e, s);
diff --git a/mobile/apps/photos/lib/ui/collections/collection_action_sheet.dart b/mobile/apps/photos/lib/ui/collections/collection_action_sheet.dart
index 01418a7f1c..62e3f8a3c6 100644
--- a/mobile/apps/photos/lib/ui/collections/collection_action_sheet.dart
+++ b/mobile/apps/photos/lib/ui/collections/collection_action_sheet.dart
@@ -49,28 +49,28 @@ String _actionName(
String text = "";
switch (type) {
case CollectionActionType.addFiles:
- text = StringsLocalizations.of(context).addItem(count: fileCount);
+ text = context.strings.addItem(count: fileCount);
break;
case CollectionActionType.moveFiles:
- text = StringsLocalizations.of(context).moveItem(count: fileCount);
+ text = context.strings.moveItem(count: fileCount);
break;
case CollectionActionType.restoreFiles:
- text = StringsLocalizations.of(context).restoreToAlbum;
+ text = context.strings.restoreToAlbum;
break;
case CollectionActionType.unHide:
- text = StringsLocalizations.of(context).unhideToAlbum;
+ text = context.strings.unhideToAlbum;
break;
case CollectionActionType.shareCollection:
- text = StringsLocalizations.of(context).share;
+ text = context.strings.share;
break;
case CollectionActionType.addToHiddenAlbum:
- text = StringsLocalizations.of(context).addToHiddenAlbum;
+ text = context.strings.addToHiddenAlbum;
break;
case CollectionActionType.moveToHiddenCollection:
- text = StringsLocalizations.of(context).moveToHiddenAlbum;
+ text = context.strings.moveToHiddenAlbum;
break;
case CollectionActionType.autoAddPeople:
- text = StringsLocalizations.of(context).autoAddToAlbum;
+ text = context.strings.autoAddToAlbum;
break;
}
return text;
@@ -195,9 +195,7 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
child: Column(
children: [
TextInputComponent(
- hintText: StringsLocalizations.of(
- context,
- ).searchByAlbumNameHint,
+ hintText: context.strings.searchByAlbumNameHint,
prefix: HugeIcon(
icon: HugeIcons.strokeRoundedSearch01,
size: 18,
@@ -232,7 +230,7 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
widgets.add(
ButtonComponent(
key: const ValueKey('add_button'),
- label: StringsLocalizations.of(context).add,
+ label: context.strings.add,
shouldSurfaceExecutionStates: false,
dismissModalOnSuccess: true,
isDisabled: _selectedCollections.isEmpty,
@@ -240,7 +238,7 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
if (widget.selectedPeople != null) {
final ProgressDialog dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).uploadingFilesToAlbum,
+ context.strings.uploadingFilesToAlbum,
isDismissible: true,
);
await dialog.show();
@@ -275,9 +273,9 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
if (!mounted) return;
showShortToast(
context,
- StringsLocalizations.of(
- context,
- ).addedToAlbums(count: _selectedCollections.length),
+ context.strings.addedToAlbums(
+ count: _selectedCollections.length,
+ ),
);
widget.selectedFiles?.clearAll();
}
diff --git a/mobile/apps/photos/lib/ui/collections/collection_list_page.dart b/mobile/apps/photos/lib/ui/collections/collection_list_page.dart
index 2797658689..56e3027805 100644
--- a/mobile/apps/photos/lib/ui/collections/collection_list_page.dart
+++ b/mobile/apps/photos/lib/ui/collections/collection_list_page.dart
@@ -158,7 +158,7 @@ class _CollectionListPageState extends State<CollectionListPage> {
List<EntePopupMenuOption<_CollectionListMenuAction>> _buildMenuOptions() {
final colorScheme = getEnteColorScheme(context);
- final strings = StringsLocalizations.of(context);
+ final strings = context.strings;
final currentViewType = albumViewType ?? localSettings.albumViewType();
final isListView = currentViewType == AlbumViewType.list;
final currentSortKey = sortKey;
diff --git a/mobile/apps/photos/lib/ui/collections/device/device_folder_list_item.dart b/mobile/apps/photos/lib/ui/collections/device/device_folder_list_item.dart
index 4074963057..ed31097784 100644
--- a/mobile/apps/photos/lib/ui/collections/device/device_folder_list_item.dart
+++ b/mobile/apps/photos/lib/ui/collections/device/device_folder_list_item.dart
@@ -57,9 +57,7 @@ class DeviceFolderListItem extends StatelessWidget {
style: TextStyles.body.copyWith(color: componentColors.textBase),
),
subtitle: Text(
- StringsLocalizations.of(
- context,
- ).itemCount(count: deviceCollection.count),
+ context.strings.itemCount(count: deviceCollection.count),
maxLines: 1,
softWrap: false,
overflow: TextOverflow.ellipsis,
diff --git a/mobile/apps/photos/lib/ui/collections/device/device_folder_row_item.dart b/mobile/apps/photos/lib/ui/collections/device/device_folder_row_item.dart
index 032d1cff05..5beb3f0a77 100644
--- a/mobile/apps/photos/lib/ui/collections/device/device_folder_row_item.dart
+++ b/mobile/apps/photos/lib/ui/collections/device/device_folder_row_item.dart
@@ -97,9 +97,7 @@ class DeviceFolderRowItem extends StatelessWidget {
SizedBox(
width: sideOfThumbnail,
child: Text(
- StringsLocalizations.of(
- context,
- ).itemCount(count: deviceCollection.count),
+ context.strings.itemCount(count: deviceCollection.count),
textAlign: TextAlign.left,
style: TextStyles.mini.copyWith(color: colors.textLight),
maxLines: 1,
diff --git a/mobile/apps/photos/lib/ui/collections/device/device_folders_vertical_grid_view.dart b/mobile/apps/photos/lib/ui/collections/device/device_folders_vertical_grid_view.dart
index 20b0ef6d81..375cb52e36 100644
--- a/mobile/apps/photos/lib/ui/collections/device/device_folders_vertical_grid_view.dart
+++ b/mobile/apps/photos/lib/ui/collections/device/device_folders_vertical_grid_view.dart
@@ -214,9 +214,7 @@ class _DeviceFolderVerticalGridViewBodyState
: Padding(
padding: const EdgeInsets.all(22),
child: EmptyState(
- text: StringsLocalizations.of(
- context,
- ).noResultsFound,
+ text: context.strings.noResultsFound,
),
),
)
@@ -240,9 +238,7 @@ class _DeviceFolderVerticalGridViewBodyState
return widget.showEmptyState
? SliverFillRemaining(
child: Center(
- child: Text(
- StringsLocalizations.of(context).failedToLoadAlbums,
- ),
+ child: Text(context.strings.failedToLoadAlbums),
),
)
: const SliverToBoxAdapter(child: SizedBox.shrink());
diff --git a/mobile/apps/photos/lib/ui/collections/flex_grid_view.dart b/mobile/apps/photos/lib/ui/collections/flex_grid_view.dart
index 0eed889f9f..e400351bb2 100644
--- a/mobile/apps/photos/lib/ui/collections/flex_grid_view.dart
+++ b/mobile/apps/photos/lib/ui/collections/flex_grid_view.dart
@@ -386,7 +386,7 @@ class _CreateAlbumBottomSheetState extends State<_CreateAlbumBottomSheet> {
@override
Widget build(BuildContext context) {
- final strings = StringsLocalizations.of(context);
+ final strings = context.strings;
return BottomSheetComponent(
title: strings.newAlbum,
isKeyboardAware: true,
diff --git a/mobile/apps/photos/lib/ui/common/user_dialogs.dart b/mobile/apps/photos/lib/ui/common/user_dialogs.dart
index e4e21407df..5fe41dbfac 100644
--- a/mobile/apps/photos/lib/ui/common/user_dialogs.dart
+++ b/mobile/apps/photos/lib/ui/common/user_dialogs.dart
@@ -10,25 +10,19 @@ import "package:photos/utils/share_util.dart";
Future<void> showInviteDialog(BuildContext context, String email) async {
await showDialogWidget(
context: context,
- title: StringsLocalizations.of(context).inviteToEnte,
+ title: context.strings.inviteToEnte,
icon: Icons.info_outline,
- body: StringsLocalizations.of(
- context,
- ).emailNoEnteAccountPhotos(email: email),
+ body: context.strings.emailNoEnteAccountPhotos(email: email),
isDismissible: true,
buttons: [
ButtonWidget(
buttonType: ButtonType.neutral,
icon: Icons.adaptive.share,
- labelText: StringsLocalizations.of(context).sendInvite,
+ labelText: context.strings.sendInvite,
isInAlert: true,
onTap: () async {
unawaited(
- shareText(
- StringsLocalizations.of(
- context,
- ).shareTextRecommendUsingEnteForPhotos,
- ),
+ shareText(context.strings.shareTextRecommendUsingEnteForPhotos),
);
},
),
diff --git a/mobile/apps/photos/lib/ui/components/action_sheet_widget.dart b/mobile/apps/photos/lib/ui/components/action_sheet_widget.dart
index 26b71a5648..3d73fd3935 100644
--- a/mobile/apps/photos/lib/ui/components/action_sheet_widget.dart
+++ b/mobile/apps/photos/lib/ui/components/action_sheet_widget.dart
@@ -119,7 +119,7 @@ class LegacyActionSheetWidget extends StatelessWidget {
ButtonComponentAdapter(button: button),
],
showCloseButton: cancelButton != null,
- closeTooltip: StringsLocalizations.of(context).close,
+ closeTooltip: context.strings.close,
closeResult: cancelButton == null ? null : sheetCloseResult(cancelButton),
onClose: cancelButton == null
? null
diff --git a/mobile/apps/photos/lib/ui/components/banners/get_started_banner.dart b/mobile/apps/photos/lib/ui/components/banners/get_started_banner.dart
index 84709e994a..ea21026a7d 100644
--- a/mobile/apps/photos/lib/ui/components/banners/get_started_banner.dart
+++ b/mobile/apps/photos/lib/ui/components/banners/get_started_banner.dart
@@ -39,7 +39,7 @@ class _GetStartedBannerState extends State<GetStartedBanner> {
return const SizedBox.shrink();
}
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final colors = context.componentColors;
final isDark = Theme.of(context).brightness == Brightness.dark;
final ctaColor = isDark ? colors.primary : colors.primaryDark;
diff --git a/mobile/apps/photos/lib/ui/components/banners/ml_progress_banner.dart b/mobile/apps/photos/lib/ui/components/banners/ml_progress_banner.dart
index 908fcb477d..91ff97feea 100644
--- a/mobile/apps/photos/lib/ui/components/banners/ml_progress_banner.dart
+++ b/mobile/apps/photos/lib/ui/components/banners/ml_progress_banner.dart
@@ -140,7 +140,7 @@ class _MLProgressBannerState extends State<MLProgressBanner> {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final format = NumberFormat();
final progress = total > 0 ? status.indexedItems.toDouble() / total : 0.0;
final showModelDownloadPhase = _shouldShowModelDownloadPhase(status);
diff --git a/mobile/apps/photos/lib/ui/components/banners/name_face_banner.dart b/mobile/apps/photos/lib/ui/components/banners/name_face_banner.dart
index 3764f6a838..bac4daa7f8 100644
--- a/mobile/apps/photos/lib/ui/components/banners/name_face_banner.dart
+++ b/mobile/apps/photos/lib/ui/components/banners/name_face_banner.dart
@@ -51,7 +51,7 @@ class _NameFaceBannerState extends State<NameFaceBanner> {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return Padding(
padding: const EdgeInsets.all(12),
diff --git a/mobile/apps/photos/lib/ui/components/banners/offline_settings_banner.dart b/mobile/apps/photos/lib/ui/components/banners/offline_settings_banner.dart
index 95d4f63e38..30bad8cb3e 100644
--- a/mobile/apps/photos/lib/ui/components/banners/offline_settings_banner.dart
+++ b/mobile/apps/photos/lib/ui/components/banners/offline_settings_banner.dart
@@ -28,7 +28,7 @@ class _OfflineSettingsBannerState extends State<OfflineSettingsBanner> {
}
final textTheme = getEnteTextTheme(context);
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final titleStyle = textTheme.largeBold.copyWith(
fontFamily: "Nunito",
fontWeight: FontWeight.w800,
diff --git a/mobile/apps/photos/lib/ui/components/banners/save_faces_banner.dart b/mobile/apps/photos/lib/ui/components/banners/save_faces_banner.dart
index 44cff56753..1c367a374a 100644
--- a/mobile/apps/photos/lib/ui/components/banners/save_faces_banner.dart
+++ b/mobile/apps/photos/lib/ui/components/banners/save_faces_banner.dart
@@ -51,7 +51,7 @@ class _SaveFacesBannerState extends State<SaveFacesBanner> {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return Padding(
padding: const EdgeInsets.all(12),
diff --git a/mobile/apps/photos/lib/ui/components/bottom_action_bar/action_bar_widget.dart b/mobile/apps/photos/lib/ui/components/bottom_action_bar/action_bar_widget.dart
index 49c5ae7bf3..f2d70551c5 100644
--- a/mobile/apps/photos/lib/ui/components/bottom_action_bar/action_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/components/bottom_action_bar/action_bar_widget.dart
@@ -60,15 +60,13 @@ class _ActionBarWidgetState extends State<ActionBarWidget> {
return Text(
_selectedOwnedFilesNotifier.value !=
_selectedFilesNotifier.value
- ? StringsLocalizations.of(
- context,
- ).selectedPhotosWithYours(
+ ? context.strings.selectedPhotosWithYours(
count: _selectedFilesNotifier.value,
yourCount: _selectedOwnedFilesNotifier.value,
)
- : StringsLocalizations.of(
- context,
- ).selectedPhotos(count: _selectedFilesNotifier.value),
+ : context.strings.selectedPhotos(
+ count: _selectedFilesNotifier.value,
+ ),
style: miniStyle,
);
},
@@ -85,10 +83,7 @@ class _ActionBarWidgetState extends State<ActionBarWidget> {
},
child: Align(
alignment: Alignment.centerRight,
- child: Text(
- StringsLocalizations.of(context).cancel,
- style: miniStyle,
- ),
+ child: Text(context.strings.cancel, style: miniStyle),
),
),
),
diff --git a/mobile/apps/photos/lib/ui/components/bottom_action_bar/album_action_bar_widget.dart b/mobile/apps/photos/lib/ui/components/bottom_action_bar/album_action_bar_widget.dart
index 694ff01de8..30121789aa 100644
--- a/mobile/apps/photos/lib/ui/components/bottom_action_bar/album_action_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/components/bottom_action_bar/album_action_bar_widget.dart
@@ -46,7 +46,7 @@ class _AlbumActionBarWidgetState extends State<AlbumActionBarWidget> {
valueListenable: _selectedAlbumNotifier,
builder: (context, value, child) {
return Text(
- StringsLocalizations.of(context).selectedAlbums(
+ context.strings.selectedAlbums(
count: widget.selectedAlbums?.albums.length ?? 0,
),
style: miniStyle,
@@ -65,10 +65,7 @@ class _AlbumActionBarWidgetState extends State<AlbumActionBarWidget> {
},
child: Align(
alignment: Alignment.centerRight,
- child: Text(
- StringsLocalizations.of(context).cancel,
- style: miniStyle,
- ),
+ child: Text(context.strings.cancel, style: miniStyle),
),
),
),
diff --git a/mobile/apps/photos/lib/ui/components/bottom_action_bar/people_action_bar_widget.dart b/mobile/apps/photos/lib/ui/components/bottom_action_bar/people_action_bar_widget.dart
index 07f425309c..303e2a642b 100644
--- a/mobile/apps/photos/lib/ui/components/bottom_action_bar/people_action_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/components/bottom_action_bar/people_action_bar_widget.dart
@@ -47,9 +47,7 @@ class _PeopleActionBarWidgetState extends State<PeopleActionBarWidget> {
builder: (context, value, child) {
final count = widget.selectedPeople?.personIds.length ?? 0;
return Text(
- StringsLocalizations.of(
- context,
- ).selectedPhotos(count: count),
+ context.strings.selectedPhotos(count: count),
style: miniStyle,
);
},
@@ -66,10 +64,7 @@ class _PeopleActionBarWidgetState extends State<PeopleActionBarWidget> {
},
child: Align(
alignment: Alignment.centerRight,
- child: Text(
- StringsLocalizations.of(context).cancel,
- style: miniStyle,
- ),
+ child: Text(context.strings.cancel, style: miniStyle),
),
),
),
diff --git a/mobile/apps/photos/lib/ui/components/buttons/button_component_adapter.dart b/mobile/apps/photos/lib/ui/components/buttons/button_component_adapter.dart
index dd4303e4b6..6c7473bfbc 100644
--- a/mobile/apps/photos/lib/ui/components/buttons/button_component_adapter.dart
+++ b/mobile/apps/photos/lib/ui/components/buttons/button_component_adapter.dart
@@ -122,7 +122,7 @@ Exception _toException(Object error) {
}
int sheetCancelButtonIndex(BuildContext context, List<ButtonWidget> buttons) {
- final cancelLabels = {StringsLocalizations.of(context).cancel, 'Cancel'};
+ final cancelLabels = {context.strings.cancel, 'Cancel'};
return buttons.indexWhere(
(button) =>
button.isInAlert &&
diff --git a/mobile/apps/photos/lib/ui/components/dialog_widget.dart b/mobile/apps/photos/lib/ui/components/dialog_widget.dart
index 9d7b57a6e7..0c37336292 100644
--- a/mobile/apps/photos/lib/ui/components/dialog_widget.dart
+++ b/mobile/apps/photos/lib/ui/components/dialog_widget.dart
@@ -78,7 +78,7 @@ class LegacyDialogWidget extends StatelessWidget {
ButtonComponentAdapter(button: button),
],
showCloseButton: cancelButton != null,
- closeTooltip: StringsLocalizations.of(context).close,
+ closeTooltip: context.strings.close,
closeResult: cancelButton == null ? null : sheetCloseResult(cancelButton),
onClose: cancelButton == null
? null
@@ -252,7 +252,7 @@ class _LegacyTextInputDialogState extends State<LegacyTextInputDialog> {
],
isKeyboardAware: true,
showCloseButton: true,
- closeTooltip: StringsLocalizations.of(context).close,
+ closeTooltip: context.strings.close,
closeResult: ButtonResult(),
);
}
diff --git a/mobile/apps/photos/lib/ui/components/keyboard/keyboard_top_button.dart b/mobile/apps/photos/lib/ui/components/keyboard/keyboard_top_button.dart
index 83401c9f32..061e1eb97d 100644
--- a/mobile/apps/photos/lib/ui/components/keyboard/keyboard_top_button.dart
+++ b/mobile/apps/photos/lib/ui/components/keyboard/keyboard_top_button.dart
@@ -36,7 +36,7 @@ class KeyboardTopButton extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 14),
onPressed: onCancelTap,
child: Text(
- cancelText ?? StringsLocalizations.of(context).cancel,
+ cancelText ?? context.strings.cancel,
style: enteTheme.smallBold,
),
),
@@ -44,7 +44,7 @@ class KeyboardTopButton extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 14),
onPressed: onDoneTap,
child: Text(
- doneText ?? StringsLocalizations.of(context).done,
+ doneText ?? context.strings.done,
style: enteTheme.smallBold,
),
),
diff --git a/mobile/apps/photos/lib/ui/family/edit_storage_limit_page.dart b/mobile/apps/photos/lib/ui/family/edit_storage_limit_page.dart
index 1f3e8904a7..a462e2837b 100644
--- a/mobile/apps/photos/lib/ui/family/edit_storage_limit_page.dart
+++ b/mobile/apps/photos/lib/ui/family/edit_storage_limit_page.dart
@@ -80,7 +80,7 @@ class _EditStorageLimitPageState extends State<EditStorageLimitPage> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
diff --git a/mobile/apps/photos/lib/ui/family/family_dashboard.dart b/mobile/apps/photos/lib/ui/family/family_dashboard.dart
index f4fb280dbc..bc3aca0db2 100644
--- a/mobile/apps/photos/lib/ui/family/family_dashboard.dart
+++ b/mobile/apps/photos/lib/ui/family/family_dashboard.dart
@@ -106,7 +106,7 @@ class FamilyDashboard extends StatelessWidget {
final activeMembers = visibleMembers
.where((member) => member.isActive)
.toList();
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -213,7 +213,7 @@ class _FamilyStorageCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colors = context.componentColors;
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final totalStorage = userDetails.getTotalStorage();
final totalUsed =
userDetails.familyData?.getTotalUsage() ?? userDetails.usage;
@@ -387,7 +387,7 @@ class _FamilyMemberRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final actions = familyMemberActions(
isAdmin: isAdminView,
isCurrentUser: isCurrentUser,
@@ -498,7 +498,7 @@ class _MemberAvatar extends StatelessWidget {
right: -4,
bottom: -4,
child: Semantics(
- label: StringsLocalizations.of(context).admin,
+ label: context.strings.admin,
child: ExcludeSemantics(
child: HugeIcon(
icon: HugeIcons.strokeRoundedCrown02,
diff --git a/mobile/apps/photos/lib/ui/family/family_plan_page.dart b/mobile/apps/photos/lib/ui/family/family_plan_page.dart
index 49740c9253..01e334fcfc 100644
--- a/mobile/apps/photos/lib/ui/family/family_plan_page.dart
+++ b/mobile/apps/photos/lib/ui/family/family_plan_page.dart
@@ -165,7 +165,7 @@ class _FamilyPlanPageState extends State<FamilyPlanPage> {
: _buildPaidAdvert(context);
return FamilyPageScaffold(
- title: _showsDashboard ? StringsLocalizations.of(context).family : null,
+ title: _showsDashboard ? context.strings.family : null,
actions: _showsDashboard ? [_buildDashboardOverflow(context)] : const [],
scrollable: _showsDashboard,
child: content,
@@ -173,7 +173,7 @@ class _FamilyPlanPageState extends State<FamilyPlanPage> {
}
Widget _buildFreeAdvert(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return _buildAdvert(
context,
illustrationAsset: _advertIllustrationAsset,
@@ -208,7 +208,7 @@ class _FamilyPlanPageState extends State<FamilyPlanPage> {
}
Widget _buildPaidAdvert(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return _buildAdvert(
context,
illustrationAsset: _advertIllustrationAsset,
@@ -421,7 +421,7 @@ class _FamilyPlanPageState extends State<FamilyPlanPage> {
}
Widget _buildDashboardOverflow(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final action = _isFamilyAdmin
? _FamilyDashboardOverflowAction.closePlan
: _FamilyDashboardOverflowAction.leavePlan;
@@ -503,9 +503,7 @@ class _FamilyPlanPageState extends State<FamilyPlanPage> {
if (result?.invitesSent ?? false) {
showToast(
context,
- StringsLocalizations.of(
- context,
- ).invitesSentCount(count: result!.sentCount),
+ context.strings.invitesSentCount(count: result!.sentCount),
);
}
}
@@ -540,7 +538,7 @@ class _FamilyPlanPageState extends State<FamilyPlanPage> {
userID: member.userID,
email: member.email,
)?[PersonService.kPersonIDKey];
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
await showBottomSheetComponent<void>(
context: context,
builder: (sheetContext) => BottomSheetComponent(
@@ -821,7 +819,7 @@ class _FamilyPlanPageState extends State<FamilyPlanPage> {
await FamilyService.instance.resendInvite(member);
await _refreshUserDetails();
if (mounted) {
- showToast(context, StringsLocalizations.of(context).inviteResent);
+ showToast(context, context.strings.inviteResent);
}
} catch (error) {
if (mounted) {
@@ -833,11 +831,9 @@ class _FamilyPlanPageState extends State<FamilyPlanPage> {
Future<void> _confirmRemoveMember(FamilyMember member) async {
final confirmed = await showFamilyConfirmationSheet(
context,
- title: StringsLocalizations.of(context).removeMemberConfirmTitle,
- body: StringsLocalizations.of(
- context,
- ).removeMemberConfirmBody(email: member.email),
- actionLabel: StringsLocalizations.of(context).remove,
+ title: context.strings.removeMemberConfirmTitle,
+ body: context.strings.removeMemberConfirmBody(email: member.email),
+ actionLabel: context.strings.remove,
);
if (!confirmed || !mounted) {
return;
@@ -856,11 +852,9 @@ class _FamilyPlanPageState extends State<FamilyPlanPage> {
Future<void> _confirmRevokeInvite(FamilyMember member) async {
final confirmed = await showFamilyConfirmationSheet(
context,
- title: StringsLocalizations.of(context).revokeInviteConfirmTitle,
- body: StringsLocalizations.of(
- context,
- ).revokeInviteConfirmBody(email: member.email),
- actionLabel: StringsLocalizations.of(context).revoke,
+ title: context.strings.revokeInviteConfirmTitle,
+ body: context.strings.revokeInviteConfirmBody(email: member.email),
+ actionLabel: context.strings.revoke,
);
if (!confirmed || !mounted) {
return;
@@ -879,9 +873,9 @@ class _FamilyPlanPageState extends State<FamilyPlanPage> {
Future<void> _confirmCloseFamily() async {
final confirmed = await showFamilyConfirmationSheet(
context,
- title: StringsLocalizations.of(context).closeFamilyConfirmTitle,
- body: StringsLocalizations.of(context).closeFamilyConfirmBody,
- actionLabel: StringsLocalizations.of(context).closeFamilyPlan,
+ title: context.strings.closeFamilyConfirmTitle,
+ body: context.strings.closeFamilyConfirmBody,
+ actionLabel: context.strings.closeFamilyPlan,
);
if (!confirmed || !mounted) {
return;
@@ -900,11 +894,9 @@ class _FamilyPlanPageState extends State<FamilyPlanPage> {
Future<void> _confirmLeaveFamily() async {
final confirmed = await showFamilyConfirmationSheet(
context,
- title: StringsLocalizations.of(context).leaveFamily,
- body: StringsLocalizations.of(
- context,
- ).areYouSureThatYouWantToLeaveTheFamily,
- actionLabel: StringsLocalizations.of(context).leave,
+ title: context.strings.leaveFamily,
+ body: context.strings.areYouSureThatYouWantToLeaveTheFamily,
+ actionLabel: context.strings.leave,
);
if (!confirmed || !mounted) {
return;
diff --git a/mobile/apps/photos/lib/ui/family/invite_members_page.dart b/mobile/apps/photos/lib/ui/family/invite_members_page.dart
index e061ffc1b4..fc1a1d5450 100644
--- a/mobile/apps/photos/lib/ui/family/invite_members_page.dart
+++ b/mobile/apps/photos/lib/ui/family/invite_members_page.dart
@@ -77,7 +77,7 @@ class _InviteMembersPageState extends State<InviteMembersPage> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final textTheme = getEnteTextTheme(context);
return FamilyPageScaffold(
@@ -125,7 +125,7 @@ class _InviteMembersPageState extends State<InviteMembersPage> {
Widget _buildInputRow(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final hasError = _errorMessage != null;
return Row(
@@ -243,7 +243,7 @@ class _InviteMembersPageState extends State<InviteMembersPage> {
return;
}
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final email = _emailController.text.trim().toLowerCase();
if (!_canAddMore) {
setState(() => _errorMessage = l10n.inviteLimitReached);
@@ -364,12 +364,8 @@ class _InviteMembersPageState extends State<InviteMembersPage> {
showToast(
context,
failedEmails.length == 1
- ? StringsLocalizations.of(
- context,
- ).failedToInvite(email: failedEmails.first)
- : StringsLocalizations.of(
- context,
- ).failedToInviteCount(count: failedEmails.length),
+ ? context.strings.failedToInvite(email: failedEmails.first)
+ : context.strings.failedToInviteCount(count: failedEmails.length),
);
}
throw const _HandledInviteActionException();
@@ -386,7 +382,7 @@ class _InviteMembersPageState extends State<InviteMembersPage> {
}
Future<void> _showInviteToEnteSheet(String email) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return showBaseBottomSheet<void>(
context,
title: l10n.inviteToEnte,
diff --git a/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart b/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart
index 2a936b031a..58ad56ae11 100644
--- a/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart
+++ b/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart
@@ -17,7 +17,7 @@ Future<bool?> showApplyCodeSheet(
return showBottomSheetComponent<bool>(
context: context,
builder: (_) => BottomSheetComponent(
- title: StringsLocalizations.of(context).applyCodeTitle,
+ title: context.strings.applyCodeTitle,
isKeyboardAware: true,
content: _ApplyCodeContent(
referralView: referralView,
@@ -99,18 +99,15 @@ class _ApplyCodeContentState extends State<_ApplyCodeContent> {
} catch (e) {
Logger("ApplyCodeSheet").severe("Failed to apply code", e);
if (mounted) {
- String errorMessage = StringsLocalizations.of(
- context,
- ).failedToApplyCode;
+ String errorMessage = context.strings.failedToApplyCode;
if (e is DioException &&
e.response != null &&
e.response!.data != null) {
final code = e.response!.data["code"];
if (code == "INVALID_CODE") {
- errorMessage = StringsLocalizations.of(context).invalidReferralCode;
+ errorMessage = context.strings.invalidReferralCode;
} else if (code != null) {
- errorMessage =
- "${StringsLocalizations.of(context).failedToApplyCode}: $code";
+ errorMessage = "${context.strings.failedToApplyCode}: $code";
}
}
setState(() {
@@ -122,7 +119,7 @@ class _ApplyCodeContentState extends State<_ApplyCodeContent> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return Column(
mainAxisSize: MainAxisSize.min,
diff --git a/mobile/apps/photos/lib/ui/growth/change_referral_code_sheet.dart b/mobile/apps/photos/lib/ui/growth/change_referral_code_sheet.dart
index af2381a5af..fbb7cb4beb 100644
--- a/mobile/apps/photos/lib/ui/growth/change_referral_code_sheet.dart
+++ b/mobile/apps/photos/lib/ui/growth/change_referral_code_sheet.dart
@@ -14,7 +14,7 @@ Future<bool?> showChangeReferralCodeSheet(
return showBottomSheetComponent<bool>(
context: context,
builder: (_) => BottomSheetComponent(
- title: StringsLocalizations.of(context).changeYourReferralCode,
+ title: context.strings.changeYourReferralCode,
isKeyboardAware: true,
content: _ChangeReferralCodeContent(
currentCode: currentCode,
@@ -90,15 +90,11 @@ class _ChangeReferralCodeContentState
if (e is DioException) {
if (e.response?.statusCode == 400) {
setState(() {
- _errorMessage = StringsLocalizations.of(
- context,
- ).unavailableReferralCode;
+ _errorMessage = context.strings.unavailableReferralCode;
});
} else if (e.response?.statusCode == 429) {
setState(() {
- _errorMessage = StringsLocalizations.of(
- context,
- ).codeChangeLimitReached;
+ _errorMessage = context.strings.codeChangeLimitReached;
});
} else {
if (mounted) {
@@ -121,7 +117,7 @@ class _ChangeReferralCodeContentState
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return Column(
mainAxisSize: MainAxisSize.min,
diff --git a/mobile/apps/photos/lib/ui/growth/code_success_screen.dart b/mobile/apps/photos/lib/ui/growth/code_success_screen.dart
index 74735e35da..78fd201653 100644
--- a/mobile/apps/photos/lib/ui/growth/code_success_screen.dart
+++ b/mobile/apps/photos/lib/ui/growth/code_success_screen.dart
@@ -19,7 +19,7 @@ class CodeSuccessScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colors = context.componentColors;
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return SettingsPageScaffold(
title: l10n.codeAppliedPageTitle,
diff --git a/mobile/apps/photos/lib/ui/growth/referral_code_widget.dart b/mobile/apps/photos/lib/ui/growth/referral_code_widget.dart
index 25892b3413..1fb8907563 100644
--- a/mobile/apps/photos/lib/ui/growth/referral_code_widget.dart
+++ b/mobile/apps/photos/lib/ui/growth/referral_code_widget.dart
@@ -78,11 +78,10 @@ class ReferralCodeWidget extends StatelessWidget {
.email;
showInfoDialog(
context,
- title: StringsLocalizations.of(context).error,
- body: StringsLocalizations.of(context)
- .onlyFamilyAdminCanChangeCode(
- familyAdminEmail: familyAdmin,
- ),
+ title: context.strings.error,
+ body: context.strings.onlyFamilyAdminCanChangeCode(
+ familyAdminEmail: familyAdmin,
+ ),
icon: Icons.error,
);
} else {
diff --git a/mobile/apps/photos/lib/ui/growth/referral_screen.dart b/mobile/apps/photos/lib/ui/growth/referral_screen.dart
index 9e13697bd8..d30de96dd1 100644
--- a/mobile/apps/photos/lib/ui/growth/referral_screen.dart
+++ b/mobile/apps/photos/lib/ui/growth/referral_screen.dart
@@ -44,7 +44,7 @@ class _ReferralScreenState extends State<ReferralScreen> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return FutureBuilder<Tuple2<ReferralView, UserDetails>>(
future: _fetchData(),
builder: (context, snapshot) {
@@ -138,7 +138,7 @@ class ReferralWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colors = context.componentColors;
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final bool isReferralEnabled = referralView.planInfo.isEnabled;
return Column(
@@ -231,15 +231,13 @@ class ReferralWidget extends StatelessWidget {
color: colors.textLight,
height: 2,
);
- final step3Text = StringsLocalizations.of(
- context,
- ).referralStep3(storageInGB: storageInGB);
+ final step3Text = context.strings.referralStep3(storageInGB: storageInGB);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(StringsLocalizations.of(context).referralStep1, style: mutedStyle),
- Text(StringsLocalizations.of(context).referralStep2, style: mutedStyle),
+ Text(context.strings.referralStep1, style: mutedStyle),
+ Text(context.strings.referralStep2, style: mutedStyle),
RichText(
text: TextSpan(
style: mutedStyle,
diff --git a/mobile/apps/photos/lib/ui/growth/storage_details_screen.dart b/mobile/apps/photos/lib/ui/growth/storage_details_screen.dart
index b117bb6d39..00027caa60 100644
--- a/mobile/apps/photos/lib/ui/growth/storage_details_screen.dart
+++ b/mobile/apps/photos/lib/ui/growth/storage_details_screen.dart
@@ -23,7 +23,7 @@ class StorageDetailsScreen extends StatefulWidget {
class _StorageDetailsScreenState extends State<StorageDetailsScreen> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return SettingsPageScaffold(
title: l10n.referralStats,
diff --git a/mobile/apps/photos/lib/ui/home/gallery_download_banner.dart b/mobile/apps/photos/lib/ui/home/gallery_download_banner.dart
index 2b83c2ec56..0944253b96 100644
--- a/mobile/apps/photos/lib/ui/home/gallery_download_banner.dart
+++ b/mobile/apps/photos/lib/ui/home/gallery_download_banner.dart
@@ -135,7 +135,7 @@ class _GalleryDownloadBannerState extends State<GalleryDownloadBanner>
onPressed: () {
service.dismissCompletionBanner().ignore();
},
- child: Text(StringsLocalizations.of(context).dismiss),
+ child: Text(context.strings.dismiss),
)
else
IconButton(
@@ -154,7 +154,7 @@ class _GalleryDownloadBannerState extends State<GalleryDownloadBanner>
}
String _bannerMessage(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final service = galleryDownloadQueueService;
if (service.isCompletionBannerVisible) {
@@ -415,7 +415,7 @@ class _TaskStatus extends StatelessWidget {
);
case DownloadStatus.pending:
return Text(
- "${StringsLocalizations.of(context).queued} β€’ ${formatBytes(task.totalBytes)}",
+ "${context.strings.queued} β€’ ${formatBytes(task.totalBytes)}",
style: textTheme.miniMuted,
);
case DownloadStatus.paused:
@@ -439,7 +439,7 @@ class _TaskStatus extends StatelessWidget {
return "Unavailable";
}
if (error == DownloadManager.applePhotosUnsupportedResourceError) {
- return StringsLocalizations.of(context).applePhotosUnsupportedResource;
+ return context.strings.applePhotosUnsupportedResource;
}
if (error == null || error.isEmpty) {
return "Download failed";
diff --git a/mobile/apps/photos/lib/ui/home/grant_permissions_widget.dart b/mobile/apps/photos/lib/ui/home/grant_permissions_widget.dart
index 1c20bd6e3f..333a80ef2b 100644
--- a/mobile/apps/photos/lib/ui/home/grant_permissions_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/grant_permissions_widget.dart
@@ -360,9 +360,7 @@ class _GrantPermissionsWidgetState extends State<GrantPermissionsWidget> {
_buildPermissionsAnimation(context),
const Flexible(child: SizedBox(height: 22)),
Text(
- StringsLocalizations.of(
- context,
- ).grantGalleryPermissionTitle,
+ context.strings.grantGalleryPermissionTitle,
textAlign: .center,
textScaler: .noScaling,
style: TextStyle(
@@ -381,9 +379,7 @@ class _GrantPermissionsWidgetState extends State<GrantPermissionsWidget> {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
- StringsLocalizations.of(
- context,
- ).grantGalleryPermissionDesc,
+ context.strings.grantGalleryPermissionDesc,
textAlign: TextAlign.center,
style: textTheme.body.copyWith(
color: colorScheme.textMuted,
@@ -394,9 +390,7 @@ class _GrantPermissionsWidgetState extends State<GrantPermissionsWidget> {
const Flexible(child: SizedBox(height: 32)),
ButtonWidgetV2(
buttonType: ButtonTypeV2.neutral,
- labelText: StringsLocalizations.of(
- context,
- ).grantPermission,
+ labelText: context.strings.grantPermission,
onTap: _onTapOfflineGrantPermission,
),
const Flexible(child: SizedBox(height: 20)),
@@ -420,7 +414,7 @@ class _GrantPermissionsWidgetState extends State<GrantPermissionsWidget> {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: StyledText(
- text: StringsLocalizations.of(context).byAgreeing,
+ text: context.strings.byAgreeing,
textAlign: TextAlign.center,
style: textTheme.bodyMuted,
tags: {
@@ -430,7 +424,7 @@ class _GrantPermissionsWidgetState extends State<GrantPermissionsWidget> {
MaterialPageRoute(
builder: (BuildContext context) {
return WebPage(
- StringsLocalizations.of(context).termsOfServicesTitle,
+ context.strings.termsOfServicesTitle,
"https://ente.com/terms",
);
},
@@ -447,7 +441,7 @@ class _GrantPermissionsWidgetState extends State<GrantPermissionsWidget> {
MaterialPageRoute(
builder: (BuildContext context) {
return WebPage(
- StringsLocalizations.of(context).privacyPolicyTitle,
+ context.strings.privacyPolicyTitle,
"https://ente.com/privacy",
);
},
diff --git a/mobile/apps/photos/lib/ui/home/header_error_widget.dart b/mobile/apps/photos/lib/ui/home/header_error_widget.dart
index 8e197aa0b2..bdf06750a4 100644
--- a/mobile/apps/photos/lib/ui/home/header_error_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/header_error_widget.dart
@@ -20,8 +20,8 @@ class HeaderErrorWidget extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 6),
child: BannerComponent(
leadingIcon: HugeIcons.strokeRoundedInformationCircle,
- title: StringsLocalizations.of(context).subscribe,
- subtitle: StringsLocalizations.of(context).yourSubscriptionHasExpired,
+ title: context.strings.subscribe,
+ subtitle: context.strings.yourSubscriptionHasExpired,
state: BannerComponentState.failure,
onTap: () async {
await routeToPage(
@@ -37,8 +37,8 @@ class HeaderErrorWidget extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 6),
child: BannerComponent(
leadingIcon: HugeIcons.strokeRoundedDatabase,
- title: StringsLocalizations.of(context).upgrade,
- subtitle: StringsLocalizations.of(context).storageLimitExceeded,
+ title: context.strings.upgrade,
+ subtitle: context.strings.storageLimitExceeded,
state: BannerComponentState.failure,
onTap: () async {
await routeToPage(
@@ -54,10 +54,8 @@ class HeaderErrorWidget extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 6),
child: BannerComponent(
leadingIcon: HugeIcons.strokeRoundedAlertCircle,
- title: StringsLocalizations.of(context).freeUpDeviceSpace,
- subtitle: StringsLocalizations.of(
- context,
- ).backupPausedFreeUpDeviceStorage,
+ title: context.strings.freeUpDeviceSpace,
+ subtitle: context.strings.backupPausedFreeUpDeviceStorage,
state: BannerComponentState.failure,
onTap: () async {
await routeToPage(
@@ -73,15 +71,15 @@ class HeaderErrorWidget extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 6),
child: BannerComponent(
leadingIcon: HugeIcons.strokeRoundedAlertCircle,
- title: StringsLocalizations.of(context).backupFailed,
- subtitle: StringsLocalizations.of(context).couldNotBackUpTryLater,
+ title: context.strings.backupFailed,
+ subtitle: context.strings.couldNotBackUpTryLater,
state: BannerComponentState.failure,
onTap: () {
sendLogs(
context,
- StringsLocalizations.of(context).raiseTicket,
+ context.strings.raiseTicket,
- subject: StringsLocalizations.of(context).backupFailed,
+ subject: context.strings.backupFailed,
);
},
),
diff --git a/mobile/apps/photos/lib/ui/home/landing_page_widget.dart b/mobile/apps/photos/lib/ui/home/landing_page_widget.dart
index b73f4dff74..9c5c734c2d 100644
--- a/mobile/apps/photos/lib/ui/home/landing_page_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/landing_page_widget.dart
@@ -89,9 +89,7 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
_buildOnboardingAnimation(),
Text(
- StringsLocalizations.of(
- context,
- ).onboardingTitle,
+ context.strings.onboardingTitle,
textAlign: TextAlign.center,
textScaler: TextScaler.noScaling,
style: TextStyle(
@@ -115,9 +113,7 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
horizontal: 32,
),
child: Text(
- StringsLocalizations.of(
- context,
- ).onboardingDesc,
+ context.strings.onboardingDesc,
textAlign: TextAlign.center,
style: textTheme.body.copyWith(
color: colorScheme.greenLight,
@@ -136,9 +132,7 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
),
ButtonComponent(
variant: ButtonComponentVariant.neutral,
- label: StringsLocalizations.of(
- context,
- ).createAnEnteAccount,
+ label: context.strings.createAnEnteAccount,
onTap: _navigateToSignUpPage,
shouldSurfaceExecutionStates: false,
),
@@ -146,9 +140,7 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
const SizedBox(height: 12),
ButtonComponent(
variant: ButtonComponentVariant.secondary,
- label: StringsLocalizations.of(
- context,
- ).continueWithoutAccount,
+ label: context.strings.continueWithoutAccount,
onTap: _navigateWithoutAccount,
shouldSurfaceExecutionStates: false,
),
@@ -157,9 +149,7 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
TextButton(
onPressed: _navigateToSignInPage,
child: Text(
- StringsLocalizations.of(
- context,
- ).loginToExistingAccount,
+ context.strings.loginToExistingAccount,
style: textTheme.body.copyWith(
decoration: TextDecoration.underline,
decorationColor: Colors.white,
@@ -294,13 +284,13 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
if (autoLogout) {
final result = await showDialogWidget(
context: context,
- title: StringsLocalizations.of(context).pleaseLoginAgain,
- body: StringsLocalizations.of(context).autoLogoutMessage,
+ title: context.strings.pleaseLoginAgain,
+ body: context.strings.autoLogoutMessage,
buttons: [
ButtonWidget(
buttonType: ButtonType.neutral,
buttonAction: ButtonAction.first,
- labelText: StringsLocalizations.of(context).ok,
+ labelText: context.strings.ok,
isInAlert: true,
),
],
diff --git a/mobile/apps/photos/lib/ui/home/loading_photos_widget.dart b/mobile/apps/photos/lib/ui/home/loading_photos_widget.dart
index 2a998630c3..83d98f30ea 100644
--- a/mobile/apps/photos/lib/ui/home/loading_photos_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/loading_photos_widget.dart
@@ -129,9 +129,9 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
_importProgressEvent = Bus.instance.on<LocalImportProgressEvent>().listen(
(event) {
if (!mounted) return;
- _loadingMessage = StringsLocalizations.of(
- context,
- ).processingImport(folderName: event.folderName);
+ _loadingMessage = context.strings.processingImport(
+ folderName: event.folderName,
+ );
if (mounted) {
setState(() {});
}
@@ -151,7 +151,7 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
@override
Widget build(BuildContext context) {
- _loadingMessage ??= StringsLocalizations.of(context).loadingYourPhotos;
+ _loadingMessage ??= context.strings.loadingYourPhotos;
_setupLoadingMessages(context);
final isLightMode = Theme.of(context).brightness == Brightness.light;
return Scaffold(
@@ -200,7 +200,7 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
- StringsLocalizations.of(context).didYouKnow,
+ context.strings.didYouKnow,
style: Theme.of(context).textTheme.titleLarge!
.copyWith(
color: Theme.of(context).colorScheme.greenText,
@@ -249,25 +249,19 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
onPressed: () {
showDialogWidget(
context: context,
- title: StringsLocalizations.of(context).oops,
+ title: context.strings.oops,
icon: Icons.error_outline_outlined,
- body: StringsLocalizations.of(
- context,
- ).localSyncErrorMessage,
+ body: context.strings.localSyncErrorMessage,
isDismissible: true,
buttons: [
ButtonWidget(
buttonType: ButtonType.primary,
- labelText: StringsLocalizations.of(
- context,
- ).contactSupport,
+ labelText: context.strings.contactSupport,
buttonAction: ButtonAction.second,
onTap: () async {
await sendLogs(
context,
- StringsLocalizations.of(
- context,
- ).contactSupport,
+ context.strings.contactSupport,
postShare: () {},
);
@@ -286,21 +280,19 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
}
void _setupLoadingMessages(BuildContext context) {
- _messages.add(StringsLocalizations.of(context).loadMessage1);
+ _messages.add(context.strings.loadMessage1);
_messages.add(
- StringsLocalizations.of(context).loadMessage2(
+ context.strings.loadMessage2(
memoriesCountInMillions: _preservedMemoriesCountInMillions,
),
);
- _messages.add(StringsLocalizations.of(context).loadMessage3);
- _messages.add(StringsLocalizations.of(context).loadMessage4);
- _messages.add(StringsLocalizations.of(context).loadMessage5);
- _messages.add(StringsLocalizations.of(context).loadMessage6);
- _messages.add(StringsLocalizations.of(context).loadMessage7);
- _messages.add(
- StringsLocalizations.of(context).loadMessage8(webUrl: kPhotosWebDomain),
- );
- _messages.add(StringsLocalizations.of(context).loadMessage9);
+ _messages.add(context.strings.loadMessage3);
+ _messages.add(context.strings.loadMessage4);
+ _messages.add(context.strings.loadMessage5);
+ _messages.add(context.strings.loadMessage6);
+ _messages.add(context.strings.loadMessage7);
+ _messages.add(context.strings.loadMessage8(webUrl: kPhotosWebDomain));
+ _messages.add(context.strings.loadMessage9);
}
Widget _getMessage(String text) {
diff --git a/mobile/apps/photos/lib/ui/home/memories/craft_memories.dart b/mobile/apps/photos/lib/ui/home/memories/craft_memories.dart
index 198049417d..fe7fd1e5e6 100644
--- a/mobile/apps/photos/lib/ui/home/memories/craft_memories.dart
+++ b/mobile/apps/photos/lib/ui/home/memories/craft_memories.dart
@@ -42,7 +42,7 @@ class _CraftMemoriesState extends State<CraftMemories> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return Padding(
padding: const EdgeInsets.all(MemoryCoverWidget.gap / 2.0),
child: SizedBox(
diff --git a/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart b/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart
index bcfcb3594f..4678b398b3 100644
--- a/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart
+++ b/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart
@@ -816,7 +816,7 @@ class BottomIcons extends StatelessWidget {
.findAncestorStateOfType<_FullScreenMemoryState>();
final memoryTitle =
context.findAncestorWidgetOfExactType<FullScreenMemory>()?.title ??
- StringsLocalizations.of(context).memories;
+ context.strings.memories;
return Positioned(
left: 0,
@@ -833,7 +833,7 @@ class BottomIcons extends StatelessWidget {
final currentFile = inheritedData.memories[safeIndex].file;
if (fullScreenState == null) return const SizedBox.shrink();
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final isOwner = currentFile.isOwner;
final collection = currentFile.collectionID == null
? null
@@ -1048,7 +1048,7 @@ class _MemoryTopOverlay extends StatelessWidget {
SizedBox.square(
dimension: 48,
child: IconButton(
- tooltip: StringsLocalizations.of(context).close,
+ tooltip: context.strings.close,
padding: const EdgeInsets.all(8),
style: IconButton.styleFrom(
minimumSize: const Size.square(48),
@@ -1411,7 +1411,7 @@ Future<void> _shareMemory(
final title = memoryTitle.trim();
await shareText(
formatMemoryShareText(
- title.isNotEmpty ? title : StringsLocalizations.of(context).memories,
+ title.isNotEmpty ? title : context.strings.memories,
shareLinkData.$1,
),
context: context,
@@ -1428,7 +1428,7 @@ Future<(String, int)?> _getOrCreateMemoryLink(
String memoryTitle,
) async {
if (memories.isEmpty) return null;
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final dialog = createProgressDialog(context, l10n.creatingLink);
await dialog.show();
try {
diff --git a/mobile/apps/photos/lib/ui/home/memories/memory_share_sheet.dart b/mobile/apps/photos/lib/ui/home/memories/memory_share_sheet.dart
index 0544c45a00..7ea764d374 100644
--- a/mobile/apps/photos/lib/ui/home/memories/memory_share_sheet.dart
+++ b/mobile/apps/photos/lib/ui/home/memories/memory_share_sheet.dart
@@ -90,7 +90,7 @@ class _MemoryShareSelectionSheetState
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final colors = context.componentColors;
final screenHeight = MediaQuery.sizeOf(context).height;
final sheetHeight = math.min(
diff --git a/mobile/apps/photos/lib/ui/home/status_bar_widget.dart b/mobile/apps/photos/lib/ui/home/status_bar_widget.dart
index 3b78661fd1..729c62fd3b 100644
--- a/mobile/apps/photos/lib/ui/home/status_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/status_bar_widget.dart
@@ -149,7 +149,7 @@ class _StatusBarWidgetState extends State<StatusBarWidget> {
}
Widget _mlBanner(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return _bannerPadding(
BannerComponent(
leadingIcon: HugeIcons.strokeRoundedAiBrain01,
@@ -171,7 +171,7 @@ class _StatusBarWidgetState extends State<StatusBarWidget> {
return _bannerPadding(
BannerComponent(
leadingIcon: HugeIcons.strokeRoundedAlertCircle,
- title: StringsLocalizations.of(context).confirmYourRecoveryKey,
+ title: context.strings.confirmYourRecoveryKey,
state: BannerComponentState.warning,
onTap: () async {
await routeToPage(
@@ -255,29 +255,29 @@ class _SyncStatusWidgetState extends State<SyncStatusWidget> {
String _getRefreshingText(BuildContext context) {
if (_event == null) {
- return StringsLocalizations.of(context).loadingGallery;
+ return context.strings.loadingGallery;
}
if (_event!.status == SyncStatus.startedFirstGalleryImport ||
_event!.status == SyncStatus.completedFirstGalleryImport) {
- return StringsLocalizations.of(context).loadingGallery;
+ return context.strings.loadingGallery;
}
if (_event!.status == SyncStatus.applyingRemoteDiff) {
- return StringsLocalizations.of(context).syncing;
+ return context.strings.syncing;
}
if (_event!.status == SyncStatus.preparingForUpload) {
if (_event!.total == null || _event!.total! <= 0) {
- return StringsLocalizations.of(context).encryptingBackup;
+ return context.strings.encryptingBackup;
} else if (_event!.total == 1) {
- return StringsLocalizations.of(context).uploadingSingleMemory;
+ return context.strings.uploadingSingleMemory;
} else {
- return StringsLocalizations.of(context).uploadingMultipleMemories(
+ return context.strings.uploadingMultipleMemories(
count: NumberFormat().format(_event!.total!),
);
}
}
if (_event!.status == SyncStatus.inProgress) {
final format = NumberFormat();
- return StringsLocalizations.of(context).syncProgress(
+ return context.strings.syncProgress(
completed: format.format(_event!.completed!),
total: format.format(_event!.total!),
);
@@ -290,10 +290,10 @@ class _SyncStatusWidgetState extends State<SyncStatusWidget> {
}
if (_event!.status == SyncStatus.completedBackup) {
if (_event!.wasStopped) {
- return StringsLocalizations.of(context).syncStopped;
+ return context.strings.syncStopped;
}
}
- return StringsLocalizations.of(context).allMemoriesPreserved;
+ return context.strings.allMemoriesPreserved;
}
}
@@ -366,9 +366,7 @@ class SyncStatusCompletedWidget extends StatelessWidget {
),
Padding(
padding: const EdgeInsets.only(left: 12),
- child: Text(
- StringsLocalizations.of(context).allMemoriesPreserved,
- ),
+ child: Text(context.strings.allMemoriesPreserved),
),
],
),
diff --git a/mobile/apps/photos/lib/ui/map/map_pull_up_gallery.dart b/mobile/apps/photos/lib/ui/map/map_pull_up_gallery.dart
index 01b6316020..4206efea95 100644
--- a/mobile/apps/photos/lib/ui/map/map_pull_up_gallery.dart
+++ b/mobile/apps/photos/lib/ui/map/map_pull_up_gallery.dart
@@ -156,20 +156,14 @@ class _MapPullUpGalleryState extends State<MapPullUpGallery> {
mainAxisSize: MainAxisSize.min,
children: [
Text(
- StringsLocalizations.of(
- context,
- ).noPhotosFoundHere,
+ context.strings.noPhotosFoundHere,
style: textTheme.large,
),
const SizedBox(height: 4),
Text(
widget.hasLocationData
- ? StringsLocalizations.of(
- context,
- ).zoomOutToSeePhotos
- : StringsLocalizations.of(
- context,
- ).noImagesWithLocation,
+ ? context.strings.zoomOutToSeePhotos
+ : context.strings.noImagesWithLocation,
style: textTheme.smallFaint,
),
],
diff --git a/mobile/apps/photos/lib/ui/map/map_screen.dart b/mobile/apps/photos/lib/ui/map/map_screen.dart
index e60b5123e6..70d26a15a0 100644
--- a/mobile/apps/photos/lib/ui/map/map_screen.dart
+++ b/mobile/apps/photos/lib/ui/map/map_screen.dart
@@ -91,10 +91,7 @@ class _MapScreenState extends State<MapScreen> {
if (tempMarkers.isEmpty) {
if (!mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).noImagesWithLocation,
- );
+ showShortToast(context, context.strings.noImagesWithLocation);
if (!visibleImages.isClosed) {
visibleImages.sink.add([]);
}
diff --git a/mobile/apps/photos/lib/ui/map/tile/layers.dart b/mobile/apps/photos/lib/ui/map/tile/layers.dart
index 3077ea1ef0..0a2c9c16a2 100644
--- a/mobile/apps/photos/lib/ui/map/tile/layers.dart
+++ b/mobile/apps/photos/lib/ui/map/tile/layers.dart
@@ -77,7 +77,7 @@ class OSMTileAttributes extends StatelessWidget {
iconSize: options.iconSize,
attributions: [
TextSourceAttribution(
- StringsLocalizations.of(context).openstreetmapContributors,
+ context.strings.openstreetmapContributors,
textStyle: textTheme,
onTap: () => launchUrlString('https://openstreetmap.org/copyright'),
),
@@ -110,7 +110,7 @@ class OSMFranceTileAttributes extends StatelessWidget {
iconSize: options.iconSize,
attributions: [
TextSourceAttribution(
- StringsLocalizations.of(context).openstreetmapContributors,
+ context.strings.openstreetmapContributors,
textStyle: textTheme,
onTap: () => launchUrlString('https://openstreetmap.org/copyright'),
),
@@ -120,7 +120,7 @@ class OSMFranceTileAttributes extends StatelessWidget {
onTap: () => launchUrl(Uri.parse('https://www.hotosm.org/')),
),
TextSourceAttribution(
- StringsLocalizations.of(context).hostedAtOsmFrance,
+ context.strings.hostedAtOsmFrance,
textStyle: textTheme,
onTap: () => launchUrl(Uri.parse('https://www.openstreetmap.fr/')),
),
diff --git a/mobile/apps/photos/lib/ui/notification/update/change_log_page.dart b/mobile/apps/photos/lib/ui/notification/update/change_log_page.dart
index 0875ecb8b0..4000bbf0a0 100644
--- a/mobile/apps/photos/lib/ui/notification/update/change_log_page.dart
+++ b/mobile/apps/photos/lib/ui/notification/update/change_log_page.dart
@@ -26,7 +26,7 @@ class _ChangeLogPageState extends State<ChangeLogPage> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final colors = context.componentColors;
final isLocalGallery = isLocalGalleryMode;
return BottomSheetComponent(
diff --git a/mobile/apps/photos/lib/ui/payment/add_on_page.dart b/mobile/apps/photos/lib/ui/payment/add_on_page.dart
index c23ca41c76..17608d845e 100644
--- a/mobile/apps/photos/lib/ui/payment/add_on_page.dart
+++ b/mobile/apps/photos/lib/ui/payment/add_on_page.dart
@@ -31,8 +31,8 @@ class AddOnPage extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
body: AppBarComponent(
- title: StringsLocalizations.of(context).addOns,
- subtitle: StringsLocalizations.of(context).addOnPageSubtitle,
+ title: context.strings.addOns,
+ subtitle: context.strings.addOnPageSubtitle,
slivers: <Widget>[
SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16),
@@ -83,7 +83,7 @@ class AddOnViewSection extends StatelessWidget {
),
if (bonus.validTill != 0)
Text(
- StringsLocalizations.of(context).validTill(
+ context.strings.validTill(
endDate:
DateFormat.yMMMd(
Localizations.localeOf(context).languageCode,
diff --git a/mobile/apps/photos/lib/ui/payment/payment_web_page.dart b/mobile/apps/photos/lib/ui/payment/payment_web_page.dart
index 3dce949d0e..eb43e10f20 100644
--- a/mobile/apps/photos/lib/ui/payment/payment_web_page.dart
+++ b/mobile/apps/photos/lib/ui/payment/payment_web_page.dart
@@ -62,9 +62,7 @@ class _PaymentWebPageState extends State<PaymentWebPage> {
}
},
child: Scaffold(
- appBar: AppBar(
- title: Text(StringsLocalizations.of(context).subscription),
- ),
+ appBar: AppBar(title: Text(context.strings.subscription)),
body: Column(
children: <Widget>[
(progress != 1.0)
@@ -146,18 +144,18 @@ class _PaymentWebPageState extends State<PaymentWebPage> {
useRootNavigator: false,
context: context,
builder: (context) => AlertDialog(
- title: Text(StringsLocalizations.of(context).areYouSureYouWantToExit),
+ title: Text(context.strings.areYouSureYouWantToExit),
actions: <Widget>[
TextButton(
child: Text(
- StringsLocalizations.of(context).yes,
+ context.strings.yes,
style: const TextStyle(color: Colors.redAccent),
),
onPressed: () => Navigator.of(context).pop(true),
),
TextButton(
child: Text(
- StringsLocalizations.of(context).no,
+ context.strings.no,
style: TextStyle(
color: Theme.of(context).colorScheme.greenAlternative,
),
@@ -202,11 +200,11 @@ class _PaymentWebPageState extends State<PaymentWebPage> {
context: context,
barrierDismissible: false,
builder: (context) => AlertDialog(
- title: Text(StringsLocalizations.of(context).paymentFailed),
- content: Text(StringsLocalizations.of(context).paymentFailedMessage),
+ title: Text(context.strings.paymentFailed),
+ content: Text(context.strings.paymentFailedMessage),
actions: <Widget>[
TextButton(
- child: Text(StringsLocalizations.of(context).contactSupport),
+ child: Text(context.strings.contactSupport),
onPressed: () => Navigator.of(context).pop(true),
),
],
@@ -232,23 +230,19 @@ class _PaymentWebPageState extends State<PaymentWebPage> {
);
if (!mounted) return;
final content = widget.actionType == 'buy'
- ? StringsLocalizations.of(context).yourPurchaseWasSuccessful
- : StringsLocalizations.of(
- context,
- ).yourSubscriptionWasUpdatedSuccessfully;
+ ? context.strings.yourPurchaseWasSuccessful
+ : context.strings.yourSubscriptionWasUpdatedSuccessfully;
if (!mounted) return;
await _showExitPageDialog(
- title: StringsLocalizations.of(context).thankYou,
+ title: context.strings.thankYou,
content: content,
);
} catch (error) {
_logger.severe(error);
if (!mounted) return;
await _showExitPageDialog(
- title: StringsLocalizations.of(context).failedToVerifyPaymentStatus,
- content: StringsLocalizations.of(
- context,
- ).pleaseWaitForSometimeBeforeRetrying,
+ title: context.strings.failedToVerifyPaymentStatus,
+ content: context.strings.pleaseWaitForSometimeBeforeRetrying,
);
}
}
@@ -266,7 +260,7 @@ class _PaymentWebPageState extends State<PaymentWebPage> {
actions: <Widget>[
TextButton(
child: Text(
- StringsLocalizations.of(context).ok,
+ context.strings.ok,
style: TextStyle(
color: Theme.of(context).colorScheme.greenAlternative,
),
diff --git a/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart b/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart
index e5dd3c9456..f5326130c8 100644
--- a/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart
+++ b/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart
@@ -79,7 +79,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
purchases,
) async {
if (!mounted) return;
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
if (!_dialog.isShowing()) {
await _dialog.show();
}
@@ -203,7 +203,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
}
_dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).pleaseWait,
+ context.strings.pleaseWait,
isDismissible: true,
);
return Scaffold(
@@ -220,8 +220,8 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
),
title: Text(
widget.isOnboarding
- ? StringsLocalizations.of(context).chooseYourPlan
- : "${StringsLocalizations.of(context).subscription}${kDebugMode ? ' Store' : ''}",
+ ? context.strings.chooseYourPlan
+ : "${context.strings.subscription}${kDebugMode ? ' Store' : ''}",
style: textTheme.largeBold,
),
centerTitle: true,
@@ -239,7 +239,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
padding: const EdgeInsets.fromLTRB(24, 12, 24, 12),
child: ButtonWidgetV2(
buttonType: ButtonTypeV2.primary,
- labelText: StringsLocalizations.of(context).continueLabel,
+ labelText: context.strings.continueLabel,
isDisabled: _selectedProductID == null,
onTap: _selectedProductID == null
? null
@@ -367,9 +367,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
Padding(
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
child: Text(
- StringsLocalizations.of(
- context,
- ).visitWebToManage(webUrl: kPhotosWebDomain),
+ context.strings.visitWebToManage(webUrl: kPhotosWebDomain),
style: getEnteTextTheme(
context,
).small.copyWith(color: colorScheme.textMuted),
@@ -381,7 +379,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
child: MenuItemWidgetNew(
- title: StringsLocalizations.of(context).managePaymentMethod,
+ title: context.strings.managePaymentMethod,
menuItemColor: colorScheme.fillFaint,
pressedColor: colorScheme.fillFaintPressed,
trailingWidget: Icon(
@@ -405,8 +403,8 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
child: MenuItemWidgetNew(
title: _isFreePlanUser()
- ? StringsLocalizations.of(context).family
- : StringsLocalizations.of(context).manageFamily,
+ ? context.strings.family
+ : context.strings.manageFamily,
menuItemColor: colorScheme.fillFaint,
pressedColor: colorScheme.fillFaintPressed,
trailingWidget: Icon(
@@ -467,10 +465,8 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
} else if (paymentProvider == stripe) {
showErrorDialog(
context,
- StringsLocalizations.of(context).sorry,
- StringsLocalizations.of(
- context,
- ).visitWebToManage(webUrl: kPhotosWebDomain),
+ context.strings.sorry,
+ context.strings.visitWebToManage(webUrl: kPhotosWebDomain),
);
} else {
final String capitalizedWord = paymentProvider.isNotEmpty
@@ -478,10 +474,8 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
: '';
showErrorDialog(
context,
- StringsLocalizations.of(context).sorry,
- StringsLocalizations.of(
- context,
- ).contactToManageSubscription(provider: capitalizedWord),
+ context.strings.sorry,
+ context.strings.contactToManageSubscription(provider: capitalizedWord),
);
}
}
@@ -532,10 +526,8 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
// ignore: unawaited_futures
showErrorDialog(
context,
- StringsLocalizations.of(context).sorry,
- StringsLocalizations.of(
- context,
- ).visitWebToManage(webUrl: kPhotosWebDomain),
+ context.strings.sorry,
+ context.strings.visitWebToManage(webUrl: kPhotosWebDomain),
);
},
child: SubscriptionPlanWidget(
@@ -570,7 +562,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
child: SubscriptionPlanWidget(
storage: _freePlan.storage,
price: "",
- period: StringsLocalizations.of(context).freeTrial,
+ period: context.strings.freeTrial,
isActive: widget.isOnboarding
? _selectedProductID == freeProductID
: _isFreePlanUser(),
@@ -609,8 +601,8 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
// ignore: unawaited_futures
showErrorDialog(
context,
- StringsLocalizations.of(context).sorry,
- StringsLocalizations.of(context).youCannotDowngradeToThisPlan,
+ context.strings.sorry,
+ context.strings.youCannotDowngradeToThisPlan,
);
return;
}
@@ -640,10 +632,8 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
// ignore: unawaited_futures
showErrorDialog(
context,
- StringsLocalizations.of(context).couldNotUpdateSubscription,
- StringsLocalizations.of(
- context,
- ).pleaseContactSupportAndWeWillBeHappyToHelp,
+ context.strings.couldNotUpdateSubscription,
+ context.strings.pleaseContactSupportAndWeWillBeHappyToHelp,
);
return;
} else {
@@ -737,10 +727,8 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
if (_isActiveStripeSubscriber) {
await showErrorDialog(
context,
- StringsLocalizations.of(context).sorry,
- StringsLocalizations.of(
- context,
- ).visitWebToManage(webUrl: kPhotosWebDomain),
+ context.strings.sorry,
+ context.strings.visitWebToManage(webUrl: kPhotosWebDomain),
);
return;
}
@@ -763,8 +751,8 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
);
await showErrorDialog(
context,
- StringsLocalizations.of(context).sorry,
- StringsLocalizations.of(context).youCannotDowngradeToThisPlan,
+ context.strings.sorry,
+ context.strings.youCannotDowngradeToThisPlan,
);
return;
}
@@ -791,10 +779,8 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
if (!mounted) return;
await showErrorDialog(
context,
- StringsLocalizations.of(context).couldNotUpdateSubscription,
- StringsLocalizations.of(
- context,
- ).pleaseContactSupportAndWeWillBeHappyToHelp,
+ context.strings.couldNotUpdateSubscription,
+ context.strings.pleaseContactSupportAndWeWillBeHappyToHelp,
);
return;
}
diff --git a/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart b/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart
index 4e38d09611..b588ee09f7 100644
--- a/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart
+++ b/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart
@@ -121,10 +121,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
await _fetchSub();
} catch (e) {
if (!mounted) return;
- showToast(
- context,
- StringsLocalizations.of(context).failedToRefreshStripeSubscription,
- );
+ showToast(context, context.strings.failedToRefreshStripeSubscription);
}
await _dialog.hide();
@@ -157,8 +154,8 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
),
title: Text(
widget.isOnboarding
- ? StringsLocalizations.of(context).chooseYourPlan
- : StringsLocalizations.of(context).subscription,
+ ? context.strings.chooseYourPlan
+ : context.strings.subscription,
style: textTheme.largeBold,
),
centerTitle: true,
@@ -176,7 +173,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
padding: const EdgeInsets.fromLTRB(24, 12, 24, 12),
child: ButtonWidgetV2(
buttonType: ButtonTypeV2.primary,
- labelText: StringsLocalizations.of(context).continueLabel,
+ labelText: context.strings.continueLabel,
isDisabled: _selectedPlanProductID == null,
onTap: _selectedPlanProductID == null
? null
@@ -192,10 +189,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
Widget _getBody() {
if (!_isLoading) {
_isLoading = true;
- _dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).pleaseWait,
- );
+ _dialog = createProgressDialog(context, context.strings.pleaseWait);
_fetchSub();
}
if (_hasLoadedData) {
@@ -251,7 +245,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
child: MenuItemWidgetNew(
- title: StringsLocalizations.of(context).manageFamily,
+ title: context.strings.manageFamily,
menuItemColor: colorScheme.fillFaint,
pressedColor: colorScheme.fillFaintPressed,
trailingWidget: Icon(
@@ -355,10 +349,10 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
: '';
await showErrorDialog(
context,
- StringsLocalizations.of(context).sorry,
- StringsLocalizations.of(
- context,
- ).contactToManageSubscription(provider: capitalizedWord),
+ context.strings.sorry,
+ context.strings.contactToManageSubscription(
+ provider: capitalizedWord,
+ ),
);
}
}
@@ -373,10 +367,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
.push(
MaterialPageRoute(
builder: (BuildContext context) {
- return WebPage(
- StringsLocalizations.of(context).paymentDetails,
- url,
- );
+ return WebPage(context.strings.paymentDetails, url);
},
),
)
@@ -395,8 +386,8 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
return const SizedBox.shrink();
}
final String title = isRenewCancelled
- ? StringsLocalizations.of(context).renewSubscription
- : StringsLocalizations.of(context).cancelSubscription;
+ ? context.strings.renewSubscription
+ : context.strings.cancelSubscription;
return MenuItemWidgetNew(
title: title,
alwaysShowSuccessState: false,
@@ -413,17 +404,17 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
final choice = await showChoiceDialog(
context,
title: title,
- body: StringsLocalizations.of(context).areYouSureYouWantToRenew,
- firstButtonLabel: StringsLocalizations.of(context).yesRenew,
+ body: context.strings.areYouSureYouWantToRenew,
+ firstButtonLabel: context.strings.yesRenew,
);
confirmAction = choice!.action == ButtonAction.first;
} else {
final choice = await showChoiceDialog(
context,
title: title,
- body: StringsLocalizations.of(context).areYouSureYouWantToCancel,
- firstButtonLabel: StringsLocalizations.of(context).yesCancel,
- secondButtonLabel: StringsLocalizations.of(context).no,
+ body: context.strings.areYouSureYouWantToCancel,
+ firstButtonLabel: context.strings.yesCancel,
+ secondButtonLabel: context.strings.no,
isCritical: true,
);
confirmAction = choice!.action == ButtonAction.first;
@@ -449,17 +440,17 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
showShortToast(
context,
isAutoRenewDisabled
- ? StringsLocalizations.of(context).failedToRenew
- : StringsLocalizations.of(context).failedToCancel,
+ ? context.strings.failedToRenew
+ : context.strings.failedToCancel,
);
}
await _dialog.hide();
if (!isAutoRenewDisabled && mounted) {
await showTextInputDialog(
context,
- title: StringsLocalizations.of(context).askCancelReason,
- submitButtonLabel: StringsLocalizations.of(context).send,
- hintText: StringsLocalizations.of(context).optionalAsShortAsYouLike,
+ title: context.strings.askCancelReason,
+ submitButtonLabel: context.strings.send,
+ hintText: context.strings.optionalAsShortAsYouLike,
alwaysShowSuccessState: true,
textCapitalization: TextCapitalization.words,
onSubmit: (String text) async {
@@ -493,7 +484,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
child: SubscriptionPlanWidget(
storage: _freePlan.storage,
price: "",
- period: StringsLocalizations.of(context).freeTrial,
+ period: context.strings.freeTrial,
isActive: widget.isOnboarding
? _selectedPlanProductID == freeProductID
: _isFreePlanUser(),
@@ -530,8 +521,8 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
_currentSubscription!.productID != freeProductID) {
await showErrorDialog(
context,
- StringsLocalizations.of(context).sorry,
- StringsLocalizations.of(context).cancelOtherSubscription(
+ context.strings.sorry,
+ context.strings.cancelOtherSubscription(
paymentProvider: _currentSubscription!.paymentProvider,
),
);
@@ -549,8 +540,8 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
);
await showErrorDialog(
context,
- StringsLocalizations.of(context).sorry,
- StringsLocalizations.of(context).youCannotDowngradeToThisPlan,
+ context.strings.sorry,
+ context.strings.youCannotDowngradeToThisPlan,
);
return;
}
@@ -559,11 +550,9 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
// confirm if user wants to change plan or not
final result = await showChoiceDialog(
context,
- title: StringsLocalizations.of(context).confirmPlanChange,
- body: StringsLocalizations.of(
- context,
- ).areYouSureYouWantToChangeYourPlan,
- firstButtonLabel: StringsLocalizations.of(context).yes,
+ title: context.strings.confirmPlanChange,
+ body: context.strings.areYouSureYouWantToChangeYourPlan,
+ firstButtonLabel: context.strings.yes,
);
if (result?.action == ButtonAction.first) {
stripPurChaseAction = 'update';
@@ -683,8 +672,8 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
_currentSubscription!.productID != freeProductID) {
await showErrorDialog(
context,
- StringsLocalizations.of(context).sorry,
- StringsLocalizations.of(context).cancelOtherSubscription(
+ context.strings.sorry,
+ context.strings.cancelOtherSubscription(
paymentProvider: _currentSubscription!.paymentProvider,
),
);
@@ -702,8 +691,8 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
);
await showErrorDialog(
context,
- StringsLocalizations.of(context).sorry,
- StringsLocalizations.of(context).youCannotDowngradeToThisPlan,
+ context.strings.sorry,
+ context.strings.youCannotDowngradeToThisPlan,
);
return;
}
@@ -712,11 +701,9 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
if (_isStripeSubscriber && _hasActiveSubscription) {
final result = await showChoiceDialog(
context,
- title: StringsLocalizations.of(context).confirmPlanChange,
- body: StringsLocalizations.of(
- context,
- ).areYouSureYouWantToChangeYourPlan,
- firstButtonLabel: StringsLocalizations.of(context).yes,
+ title: context.strings.confirmPlanChange,
+ body: context.strings.areYouSureYouWantToChangeYourPlan,
+ firstButtonLabel: context.strings.yes,
);
if (result!.action == ButtonAction.first) {
stripPurChaseAction = 'update';
diff --git a/mobile/apps/photos/lib/ui/payment/subscription_common_widgets.dart b/mobile/apps/photos/lib/ui/payment/subscription_common_widgets.dart
index da2e01a92c..8796e98308 100644
--- a/mobile/apps/photos/lib/ui/payment/subscription_common_widgets.dart
+++ b/mobile/apps/photos/lib/ui/payment/subscription_common_widgets.dart
@@ -36,11 +36,9 @@ class ValidityWidget extends StatelessWidget {
DateTime.fromMicrosecondsSinceEpoch(currentSubscription!.expiryTime),
);
- var message = StringsLocalizations.of(context).renewsOn(endDate: endDate);
+ var message = context.strings.renewsOn(endDate: endDate);
if (currentSubscription!.attributes?.isCancelled ?? false) {
- message = StringsLocalizations.of(
- context,
- ).subWillBeCancelledOn(endDate: endDate);
+ message = context.strings.subWillBeCancelledOn(endDate: endDate);
if (addOnBonus.isNotEmpty) {
hideSubValidityView = true;
}
@@ -84,9 +82,10 @@ class AddOnBonusValidity extends StatelessWidget {
return Padding(
padding: const EdgeInsets.only(top: 4, bottom: 4),
child: Text(
- StringsLocalizations.of(
- context,
- ).addOnValidTill(storageAmount: storage, endDate: endDate),
+ context.strings.addOnValidTill(
+ storageAmount: storage,
+ endDate: endDate,
+ ),
style: getEnteTextTheme(context).smallFaint,
textAlign: TextAlign.center,
),
@@ -105,7 +104,7 @@ class SubFaqWidget extends StatelessWidget {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
child: MenuItemWidgetNew(
- title: StringsLocalizations.of(context).faqs,
+ title: context.strings.faqs,
menuItemColor: colorScheme.fillFaint,
pressedColor: colorScheme.fillFaintPressed,
trailingWidget: Icon(
@@ -197,7 +196,7 @@ class _SubscriptionToggleState extends State<SubscriptionToggle> {
width: widthOfButton,
child: Center(
child: Text(
- StringsLocalizations.of(context).yearly,
+ context.strings.yearly,
style: textTheme.bodyMuted,
),
),
@@ -214,7 +213,7 @@ class _SubscriptionToggleState extends State<SubscriptionToggle> {
width: widthOfButton,
child: Center(
child: Text(
- StringsLocalizations.of(context).monthly,
+ context.strings.monthly,
style: textTheme.bodyMuted,
),
),
@@ -240,8 +239,8 @@ class _SubscriptionToggleState extends State<SubscriptionToggle> {
child: Text(
key: ValueKey(_isYearly),
_isYearly
- ? StringsLocalizations.of(context).yearly
- : StringsLocalizations.of(context).monthly,
+ ? context.strings.yearly
+ : context.strings.monthly,
style: textTheme.body,
),
),
diff --git a/mobile/apps/photos/lib/ui/payment/subscription_plan_widget.dart b/mobile/apps/photos/lib/ui/payment/subscription_plan_widget.dart
index 58ad7abe49..1fd0a85a6d 100644
--- a/mobile/apps/photos/lib/ui/payment/subscription_plan_widget.dart
+++ b/mobile/apps/photos/lib/ui/payment/subscription_plan_widget.dart
@@ -190,7 +190,7 @@ class _Price extends StatelessWidget {
children: [
TextSpan(text: price),
TextSpan(
- text: "/${StringsLocalizations.of(context).month}",
+ text: "/${context.strings.month}",
style: textTheme.small.copyWith(color: colorScheme.contentLight),
),
],
@@ -228,7 +228,7 @@ class _Price extends StatelessWidget {
children: [
TextSpan(text: price),
TextSpan(
- text: "/${StringsLocalizations.of(context).yearShort}",
+ text: "/${context.strings.yearShort}",
style: textTheme.small.copyWith(
color: colorScheme.contentLight,
),
@@ -239,13 +239,13 @@ class _Price extends StatelessWidget {
),
if (isPlayStore)
Text(
- "$currencySymbol$pricePerMonthString / ${StringsLocalizations.of(context).month}",
+ "$currencySymbol$pricePerMonthString / ${context.strings.month}",
style: textTheme.tiny.copyWith(color: colorScheme.contentLight),
textAlign: TextAlign.end,
),
if (!isPlayStore)
Text(
- "$currencySymbol$pricePerMonthString / ${StringsLocalizations.of(context).month}",
+ "$currencySymbol$pricePerMonthString / ${context.strings.month}",
style: textTheme.largeBold.copyWith(
color: colorScheme.contentDarker,
),
@@ -257,9 +257,7 @@ class _Price extends StatelessWidget {
style: textTheme.tiny.copyWith(color: colorScheme.contentLight),
children: [
TextSpan(text: price),
- TextSpan(
- text: "/${StringsLocalizations.of(context).yearShort}",
- ),
+ TextSpan(text: "/${context.strings.yearShort}"),
],
),
textAlign: TextAlign.end,
diff --git a/mobile/apps/photos/lib/ui/payment/view_add_on_widget.dart b/mobile/apps/photos/lib/ui/payment/view_add_on_widget.dart
index ef4433503a..d818a54bb5 100644
--- a/mobile/apps/photos/lib/ui/payment/view_add_on_widget.dart
+++ b/mobile/apps/photos/lib/ui/payment/view_add_on_widget.dart
@@ -21,7 +21,7 @@ class ViewAddOnButton extends StatelessWidget {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
child: MenuItemWidgetNew(
- title: StringsLocalizations.of(context).viewAddOnButton,
+ title: context.strings.viewAddOnButton,
menuItemColor: colorScheme.fillFaint,
pressedColor: colorScheme.fillFaintPressed,
trailingWidget: Icon(
diff --git a/mobile/apps/photos/lib/ui/picker/external_media_picker_page.dart b/mobile/apps/photos/lib/ui/picker/external_media_picker_page.dart
index 6783262ad0..7851ee1838 100644
--- a/mobile/apps/photos/lib/ui/picker/external_media_picker_page.dart
+++ b/mobile/apps/photos/lib/ui/picker/external_media_picker_page.dart
@@ -137,10 +137,7 @@ class _ExternalMediaPickerPageState extends State<ExternalMediaPickerPage> {
return;
}
if (uris.isEmpty) {
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
setState(() {
_isCompleting = false;
});
@@ -217,10 +214,10 @@ class _ExternalMediaPickerPageState extends State<ExternalMediaPickerPage> {
final selectedCount = _selectedFiles.files.length;
return Text(
selectedCount == 0
- ? StringsLocalizations.of(context).selectItemsToAdd
- : StringsLocalizations.of(
- context,
- ).selectedPhotos(count: selectedCount),
+ ? context.strings.selectItemsToAdd
+ : context.strings.selectedPhotos(
+ count: selectedCount,
+ ),
style: getEnteTextTheme(context).largeBold,
);
},
@@ -329,9 +326,7 @@ class _PickerBottomActionBar extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
- StringsLocalizations.of(
- context,
- ).selectedPhotos(count: selectedCount),
+ context.strings.selectedPhotos(count: selectedCount),
style: textTheme.miniMuted,
textAlign: TextAlign.center,
),
@@ -342,7 +337,7 @@ class _PickerBottomActionBar extends StatelessWidget {
child: ButtonWidgetV2(
buttonType: ButtonTypeV2.secondary,
buttonSize: ButtonSizeV2.large,
- labelText: StringsLocalizations.of(context).cancel,
+ labelText: context.strings.cancel,
isDisabled: isCompleting,
shouldSurfaceExecutionStates: false,
onTap: isCompleting
@@ -357,7 +352,7 @@ class _PickerBottomActionBar extends StatelessWidget {
child: ButtonWidgetV2(
buttonType: ButtonTypeV2.primary,
buttonSize: ButtonSizeV2.large,
- labelText: StringsLocalizations.of(context).done,
+ labelText: context.strings.done,
isDisabled: isCompleting,
onTap: isCompleting ? null : onDone,
),
diff --git a/mobile/apps/photos/lib/ui/settings/about/about_us_page.dart b/mobile/apps/photos/lib/ui/settings/about/about_us_page.dart
index 7720e44cfe..e5a960468f 100644
--- a/mobile/apps/photos/lib/ui/settings/about/about_us_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/about/about_us_page.dart
@@ -15,7 +15,7 @@ class AboutUsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return SettingsPageScaffold(
title: l10n.about,
@@ -90,10 +90,7 @@ class AboutUsPage extends StatelessWidget {
}
Future<void> _checkForUpdates(BuildContext context) async {
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).checking,
- );
+ final dialog = createProgressDialog(context, context.strings.checking);
await dialog.show();
final shouldUpdate = await updateService.shouldUpdate();
await dialog.hide();
@@ -109,10 +106,7 @@ class AboutUsPage extends StatelessWidget {
);
} else {
if (!context.mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).youAreOnTheLatestVersion,
- );
+ showShortToast(context, context.strings.youAreOnTheLatestVersion);
}
}
}
diff --git a/mobile/apps/photos/lib/ui/settings/account/account_settings_page.dart b/mobile/apps/photos/lib/ui/settings/account/account_settings_page.dart
index cd54162609..3084d8a0e1 100644
--- a/mobile/apps/photos/lib/ui/settings/account/account_settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/account/account_settings_page.dart
@@ -22,7 +22,7 @@ class AccountSettingsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return SettingsPageScaffold(
title: l10n.account,
@@ -119,7 +119,7 @@ class AccountSettingsPage extends StatelessWidget {
final hasAuthenticated = await LocalAuthenticationService.instance
.requestLocalAuthentication(
context,
- StringsLocalizations.of(context).authToChangeYourEmail,
+ context.strings.authToChangeYourEmail,
);
if (hasAuthenticated) {
if (!context.mounted) return;
@@ -131,7 +131,7 @@ class AccountSettingsPage extends StatelessWidget {
final hasAuthenticated = await LocalAuthenticationService.instance
.requestLocalAuthentication(
context,
- StringsLocalizations.of(context).authToChangeYourPassword,
+ context.strings.authToChangeYourPassword,
);
if (hasAuthenticated) {
if (!context.mounted) return;
@@ -151,7 +151,7 @@ class AccountSettingsPage extends StatelessWidget {
final hasAuthenticated = await LocalAuthenticationService.instance
.requestLocalAuthentication(
context,
- StringsLocalizations.of(context).authToViewYourRecoveryKey,
+ context.strings.authToViewYourRecoveryKey,
);
if (hasAuthenticated) {
String recoveryKey;
@@ -170,7 +170,7 @@ class AccountSettingsPage extends StatelessWidget {
builder: (BuildContext context) {
return RecoveryKeyPage(
recoveryKey,
- StringsLocalizations.of(context).ok,
+ context.strings.ok,
onDone: () {},
);
},
@@ -190,7 +190,7 @@ class AccountSettingsPage extends StatelessWidget {
final hasAuthenticated = await LocalAuthenticationService.instance
.requestLocalAuthentication(
context,
- StringsLocalizations.of(context).authToInitiateAccountDeletion,
+ context.strings.authToInitiateAccountDeletion,
);
if (!context.mounted || !hasAuthenticated) {
return;
diff --git a/mobile/apps/photos/lib/ui/settings/app_update_dialog.dart b/mobile/apps/photos/lib/ui/settings/app_update_dialog.dart
index 5a0a4059cc..046ff729f1 100644
--- a/mobile/apps/photos/lib/ui/settings/app_update_dialog.dart
+++ b/mobile/apps/photos/lib/ui/settings/app_update_dialog.dart
@@ -53,7 +53,7 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
mainAxisSize: MainAxisSize.min,
children: [
Text(
- StringsLocalizations.of(context).aNewVersionOfEnteIsAvailable,
+ context.strings.aNewVersionOfEnteIsAvailable,
style: enteTextTheme.body.copyWith(color: enteColor.textMuted),
),
const Padding(padding: EdgeInsets.all(8)),
@@ -64,7 +64,7 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
const Padding(padding: EdgeInsets.all(8)),
ButtonWidget(
buttonType: ButtonType.primary,
- labelText: StringsLocalizations.of(context).download,
+ labelText: context.strings.download,
onTap: () async {
// ignore: unawaited_futures
launchUrlString(
@@ -76,7 +76,7 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
const SizedBox(height: 6),
ButtonWidget(
buttonType: ButtonType.secondary,
- labelText: StringsLocalizations.of(context).cancel,
+ labelText: context.strings.cancel,
onTap: () async {
Navigator.of(context).pop();
},
@@ -101,8 +101,8 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
const SizedBox(height: 16),
Text(
shouldForceUpdate
- ? StringsLocalizations.of(context).criticalUpdateAvailable
- : StringsLocalizations.of(context).updateAvailable,
+ ? context.strings.criticalUpdateAvailable
+ : context.strings.updateAvailable,
style: enteTextTheme.h3Bold,
),
],
diff --git a/mobile/apps/photos/lib/ui/settings/app_version_widget.dart b/mobile/apps/photos/lib/ui/settings/app_version_widget.dart
index 443c2bfb66..a00fa9544d 100644
--- a/mobile/apps/photos/lib/ui/settings/app_version_widget.dart
+++ b/mobile/apps/photos/lib/ui/settings/app_version_widget.dart
@@ -49,9 +49,7 @@ class _AppVersionWidgetState extends State<AppVersionWidget> {
padding: const EdgeInsets.symmetric(vertical: 20),
child: Center(
child: Text(
- StringsLocalizations.of(
- context,
- ).appVersion(versionValue: snapshot.data!),
+ context.strings.appVersion(versionValue: snapshot.data!),
style: textTheme.smallMuted,
),
),
diff --git a/mobile/apps/photos/lib/ui/settings/appearance/appearance_settings_page.dart b/mobile/apps/photos/lib/ui/settings/appearance/appearance_settings_page.dart
index 9a5c213907..c65cd28232 100644
--- a/mobile/apps/photos/lib/ui/settings/appearance/appearance_settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/appearance/appearance_settings_page.dart
@@ -38,7 +38,7 @@ class _AppearanceSettingsPageState extends State<AppearanceSettingsPage> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
return SettingsPageScaffold(
@@ -123,25 +123,25 @@ class _ThemePickerSheet extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BottomSheetComponent(
- title: StringsLocalizations.of(context).theme,
+ title: context.strings.theme,
showCloseButton: false,
content: MenuGroupComponent(
items: [
_themeOption(
context,
- title: StringsLocalizations.of(context).lightTheme,
+ title: context.strings.lightTheme,
isSelected: currentThemeMode == AdaptiveThemeMode.light,
onTap: () => _selectTheme(context, AdaptiveThemeMode.light),
),
_themeOption(
context,
- title: StringsLocalizations.of(context).darkTheme,
+ title: context.strings.darkTheme,
isSelected: currentThemeMode == AdaptiveThemeMode.dark,
onTap: () => _selectTheme(context, AdaptiveThemeMode.dark),
),
_themeOption(
context,
- title: StringsLocalizations.of(context).systemTheme,
+ title: context.strings.systemTheme,
isSelected: currentThemeMode == AdaptiveThemeMode.system,
onTap: () => _selectTheme(context, AdaptiveThemeMode.system),
),
diff --git a/mobile/apps/photos/lib/ui/settings/backup/backup_folder_selection_page.dart b/mobile/apps/photos/lib/ui/settings/backup/backup_folder_selection_page.dart
index a32b907f29..77bd7f1db9 100644
--- a/mobile/apps/photos/lib/ui/settings/backup/backup_folder_selection_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/backup/backup_folder_selection_page.dart
@@ -103,7 +103,7 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
}
Future<void> updateFolderSettings() async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final dialog = createProgressDialog(context, l10n.updatingFolderSelection);
await dialog.show();
try {
@@ -145,7 +145,7 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
}
Future<bool> _showOnlyNewBackupWarning(int onlyNewSinceEpoch) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final date = DateTime.fromMicrosecondsSinceEpoch(onlyNewSinceEpoch);
final locale = Localizations.localeOf(context).languageCode;
final formattedDate = DateFormat.yMMMd(locale).format(date);
@@ -198,7 +198,7 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
}
Widget _buildBottomNavigationBar() {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final colors = context.componentColors;
final canSubmit = !(_treatAsOnboarding && _selectedDevicePathIDs.isEmpty);
@@ -239,7 +239,7 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
}
Widget _buildScrollableBody() {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final colors = context.componentColors;
return AppBarComponent(
@@ -331,7 +331,7 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
double sideOfThumbnail,
) {
final colors = context.componentColors;
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final isSelected = _selectedDevicePathIDs.contains(deviceCollection.id);
final importedCount = _pathIDToItemCount?[deviceCollection.id];
final formattedCount = NumberFormat().format(deviceCollection.count);
diff --git a/mobile/apps/photos/lib/ui/settings/backup/backup_item_card.dart b/mobile/apps/photos/lib/ui/settings/backup/backup_item_card.dart
index f6c0274fea..adb600d05e 100644
--- a/mobile/apps/photos/lib/ui/settings/backup/backup_item_card.dart
+++ b/mobile/apps/photos/lib/ui/settings/backup/backup_item_card.dart
@@ -142,16 +142,12 @@ class _BackupItemCardState extends State<BackupItemCard> {
context: context,
isDismissible: true,
builder: (_) => BottomSheetComponent(
- title: StringsLocalizations.of(context).backupFailed,
- message: StringsLocalizations.of(
- context,
- ).sorryBackupFailedDesc,
+ title: context.strings.backupFailed,
+ message: context.strings.sorryBackupFailedDesc,
illustration: Image.asset("assets/warning-grey.png"),
actions: [
ButtonComponent(
- label: StringsLocalizations.of(
- context,
- ).contactSupport,
+ label: context.strings.contactSupport,
onTap: () async {
_logger.warning(
"Backup failed for ${widget.item.file.displayName}",
@@ -159,7 +155,7 @@ class _BackupItemCardState extends State<BackupItemCard> {
);
await sendLogs(
context,
- StringsLocalizations.of(context).contactSupport,
+ context.strings.contactSupport,
postShare: () {},
);
@@ -169,7 +165,7 @@ class _BackupItemCardState extends State<BackupItemCard> {
},
),
ButtonComponent(
- label: StringsLocalizations.of(context).ok,
+ label: context.strings.ok,
variant: ButtonComponentVariant.secondary,
onTap: () async {
Navigator.of(context).pop();
diff --git a/mobile/apps/photos/lib/ui/settings/backup/backup_settings_page.dart b/mobile/apps/photos/lib/ui/settings/backup/backup_settings_page.dart
index f7e41fe754..bd22fbda51 100644
--- a/mobile/apps/photos/lib/ui/settings/backup/backup_settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/backup/backup_settings_page.dart
@@ -13,7 +13,7 @@ class BackupSettingsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return SettingsPageScaffold(
title: l10n.backup,
diff --git a/mobile/apps/photos/lib/ui/settings/backup/backup_settings_screen.dart b/mobile/apps/photos/lib/ui/settings/backup/backup_settings_screen.dart
index 5677a7e577..19d7c944d1 100644
--- a/mobile/apps/photos/lib/ui/settings/backup/backup_settings_screen.dart
+++ b/mobile/apps/photos/lib/ui/settings/backup/backup_settings_screen.dart
@@ -23,7 +23,7 @@ class BackupSettingsScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return SettingsPageScaffold(
title: l10n.backupSettings,
diff --git a/mobile/apps/photos/lib/ui/settings/backup/backup_status_screen.dart b/mobile/apps/photos/lib/ui/settings/backup/backup_status_screen.dart
index 6afc01b23d..4a87d01f6a 100644
--- a/mobile/apps/photos/lib/ui/settings/backup/backup_status_screen.dart
+++ b/mobile/apps/photos/lib/ui/settings/backup/backup_status_screen.dart
@@ -108,7 +108,7 @@ class _BackupStatusScreenState extends State<BackupStatusScreen> {
return Scaffold(
backgroundColor: context.componentColors.backgroundBase,
body: AppBarComponent(
- title: StringsLocalizations.of(context).backupStatus,
+ title: context.strings.backupStatus,
slivers: [
if (allItems.isEmpty)
const SliverFillRemaining(
@@ -159,7 +159,7 @@ class _EmptyBackupStatus extends StatelessWidget {
),
const SizedBox(height: Spacing.lg),
Text(
- StringsLocalizations.of(context).backupStatusDescription,
+ context.strings.backupStatusDescription,
textAlign: TextAlign.center,
style: TextStyles.large.copyWith(color: colors.textLight),
),
diff --git a/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart b/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart
index d387516b63..7c5ede5479 100644
--- a/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart
+++ b/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart
@@ -39,7 +39,7 @@ class _FreeUpSpaceOptionsScreenState extends State<FreeUpSpaceOptionsScreen> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return SettingsPageScaffold(
title: l10n.freeUpSpace,
@@ -148,8 +148,8 @@ class _FreeUpSpaceOptionsScreenState extends State<FreeUpSpaceOptionsScreen> {
unawaited(
showErrorDialog(
context,
- StringsLocalizations.of(context).allClear,
- StringsLocalizations.of(context).noDeviceThatCanBeDeleted,
+ context.strings.allClear,
+ context.strings.noDeviceThatCanBeDeleted,
),
);
} else {
@@ -176,10 +176,8 @@ class _FreeUpSpaceOptionsScreenState extends State<FreeUpSpaceOptionsScreen> {
unawaited(
showErrorDialog(
context,
- StringsLocalizations.of(context).noDuplicates,
- StringsLocalizations.of(
- context,
- ).youveNoDuplicateFilesThatCanBeCleared,
+ context.strings.noDuplicates,
+ context.strings.youveNoDuplicateFilesThatCanBeCleared,
),
);
} else {
@@ -210,8 +208,8 @@ class _FreeUpSpaceOptionsScreenState extends State<FreeUpSpaceOptionsScreen> {
unawaited(
showErrorDialog(
context,
- StringsLocalizations.of(context).noDeleteSuggestion,
- StringsLocalizations.of(context).youHaveNoFileSuggestedForDeletion,
+ context.strings.noDeleteSuggestion,
+ context.strings.youHaveNoFileSuggestedForDeletion,
),
);
} else {
@@ -227,22 +225,19 @@ class _FreeUpSpaceOptionsScreenState extends State<FreeUpSpaceOptionsScreen> {
);
showChoiceDialog(
context,
- title: StringsLocalizations.of(context).success,
- body: StringsLocalizations.of(
- context,
- ).youHaveSuccessfullyFreedUp(storageSaved: formatBytes(status.size)),
- firstButtonLabel: StringsLocalizations.of(context).rateUs,
+ title: context.strings.success,
+ body: context.strings.youHaveSuccessfullyFreedUp(
+ storageSaved: formatBytes(status.size),
+ ),
+ firstButtonLabel: context.strings.rateUs,
firstButtonOnTap: () async {
await updateService.launchReviewUrl();
},
firstButtonType: ButtonType.primary,
- secondButtonLabel: StringsLocalizations.of(context).ok,
+ secondButtonLabel: context.strings.ok,
secondButtonOnTap: () async {
if (Platform.isIOS) {
- showToast(
- context,
- StringsLocalizations.of(context).remindToEmptyDeviceTrash,
- );
+ showToast(context, context.strings.remindToEmptyDeviceTrash);
}
},
);
@@ -251,10 +246,10 @@ class _FreeUpSpaceOptionsScreenState extends State<FreeUpSpaceOptionsScreen> {
context: context,
isDismissible: true,
builder: (_) => BottomSheetComponent(
- title: StringsLocalizations.of(context).success,
- message: StringsLocalizations.of(
- context,
- ).youHaveSuccessfullyFreedUp(storageSaved: formatBytes(status.size)),
+ title: context.strings.success,
+ message: context.strings.youHaveSuccessfullyFreedUp(
+ storageSaved: formatBytes(status.size),
+ ),
illustration: Icon(
Icons.download_done_rounded,
size: 64,
@@ -262,14 +257,11 @@ class _FreeUpSpaceOptionsScreenState extends State<FreeUpSpaceOptionsScreen> {
),
actions: [
ButtonComponent(
- label: StringsLocalizations.of(context).ok,
+ label: context.strings.ok,
variant: ButtonComponentVariant.neutral,
onTap: () async {
if (Platform.isIOS) {
- showToast(
- context,
- StringsLocalizations.of(context).remindToEmptyDeviceTrash,
- );
+ showToast(context, context.strings.remindToEmptyDeviceTrash);
}
Navigator.of(context).pop();
},
@@ -283,22 +275,19 @@ class _FreeUpSpaceOptionsScreenState extends State<FreeUpSpaceOptionsScreen> {
void _showDuplicateFilesDeletedDialog(DeduplicationResult result) {
showChoiceDialog(
context,
- title: StringsLocalizations.of(context).success,
- body: StringsLocalizations.of(context).duplicateFileCountWithStorageSaved(
+ title: context.strings.success,
+ body: context.strings.duplicateFileCountWithStorageSaved(
count: result.count,
storageSaved: formatBytes(result.size),
),
- firstButtonLabel: StringsLocalizations.of(context).rateUs,
+ firstButtonLabel: context.strings.rateUs,
firstButtonOnTap: () async {
await updateService.launchReviewUrl();
},
firstButtonType: ButtonType.primary,
- secondButtonLabel: StringsLocalizations.of(context).ok,
+ secondButtonLabel: context.strings.ok,
secondButtonOnTap: () async {
- showShortToast(
- context,
- StringsLocalizations.of(context).remindToEmptyEnteTrash,
- );
+ showShortToast(context, context.strings.remindToEmptyEnteTrash);
},
);
}
diff --git a/mobile/apps/photos/lib/ui/settings/cast/cast_settings_page.dart b/mobile/apps/photos/lib/ui/settings/cast/cast_settings_page.dart
index 1e36fe5a99..9f0c95e492 100644
--- a/mobile/apps/photos/lib/ui/settings/cast/cast_settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/cast/cast_settings_page.dart
@@ -21,7 +21,7 @@ class CastSettingsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final textTheme = getEnteTextTheme(context);
return SettingsPageScaffold(
title: l10n.castSessions,
@@ -82,7 +82,7 @@ class _CastSessionsListState extends State<CastSessionsList> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final colors = context.componentColors;
final logger = Logger("CastSessionsList");
return FutureBuilder(
@@ -127,7 +127,7 @@ class _CastSessionsListState extends State<CastSessionsList> {
}
Future<void> _revokeSession(CastInfo session, Logger logger) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
await showBottomSheetComponent<void>(
context: context,
builder: (sheetContext) => BottomSheetComponent(
diff --git a/mobile/apps/photos/lib/ui/settings/developer_settings_page.dart b/mobile/apps/photos/lib/ui/settings/developer_settings_page.dart
index 673f747634..78e4755a89 100644
--- a/mobile/apps/photos/lib/ui/settings/developer_settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/developer_settings_page.dart
@@ -48,7 +48,7 @@ class _DeveloperSettingsPageState extends State<DeveloperSettingsPage> {
},
),
title: Text(
- StringsLocalizations.of(context).developerSettings,
+ context.strings.developerSettings,
style: textTheme.largeBold,
),
centerTitle: true,
@@ -61,7 +61,7 @@ class _DeveloperSettingsPageState extends State<DeveloperSettingsPage> {
children: [
const SizedBox(height: 20),
TextInputComponent(
- label: StringsLocalizations.of(context).serverEndpoint,
+ label: context.strings.serverEndpoint,
hintText: endpoint,
controller: _urlController,
autocorrect: false,
@@ -70,7 +70,7 @@ class _DeveloperSettingsPageState extends State<DeveloperSettingsPage> {
),
const SizedBox(height: 20),
ButtonComponent(
- label: StringsLocalizations.of(context).save,
+ label: context.strings.save,
onTap: () async {
final url = _urlController.text.trim();
_logger.info("Entered endpoint: $url");
@@ -92,7 +92,7 @@ class _DeveloperSettingsPageState extends State<DeveloperSettingsPage> {
if (!context.mounted) return;
showToast(
context,
- StringsLocalizations.of(context).endpointUpdatedMessage,
+ context.strings.endpointUpdatedMessage,
);
if (!context.mounted) return;
Navigator.of(context).pop();
@@ -104,11 +104,9 @@ class _DeveloperSettingsPageState extends State<DeveloperSettingsPage> {
if (!context.mounted) return;
await showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).invalidEndpoint,
+ title: context.strings.invalidEndpoint,
message:
- StringsLocalizations.of(
- context,
- ).invalidEndpointMessage +
+ context.strings.invalidEndpointMessage +
"\n" +
e.toString(),
assetPath: 'assets/warning-grey.png',
diff --git a/mobile/apps/photos/lib/ui/settings/developer_settings_tap_area.dart b/mobile/apps/photos/lib/ui/settings/developer_settings_tap_area.dart
index c8753ee04b..492d5d2af5 100644
--- a/mobile/apps/photos/lib/ui/settings/developer_settings_tap_area.dart
+++ b/mobile/apps/photos/lib/ui/settings/developer_settings_tap_area.dart
@@ -44,14 +44,14 @@ class _DeveloperSettingsTapAreaState extends State<DeveloperSettingsTapArea> {
await showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).developerSettings,
- message: StringsLocalizations.of(context).developerSettingsWarning,
+ title: context.strings.developerSettings,
+ message: context.strings.developerSettingsWarning,
assetPath: "assets/warning-grey.png",
isDismissible: false,
buttons: [
ButtonWidgetV2(
buttonType: ButtonTypeV2.primary,
- labelText: StringsLocalizations.of(context).yes,
+ labelText: context.strings.yes,
onTap: () async {
Navigator.of(context).pop();
await Navigator.of(context).push(
diff --git a/mobile/apps/photos/lib/ui/settings/developer_settings_widget.dart b/mobile/apps/photos/lib/ui/settings/developer_settings_widget.dart
index 69e8967a12..66ee7330c3 100644
--- a/mobile/apps/photos/lib/ui/settings/developer_settings_widget.dart
+++ b/mobile/apps/photos/lib/ui/settings/developer_settings_widget.dart
@@ -13,9 +13,9 @@ class DeveloperSettingsWidget extends StatelessWidget {
return Padding(
padding: const EdgeInsets.only(bottom: 20),
child: Text(
- StringsLocalizations.of(
- context,
- ).customEndpoint(endpoint: "${endpointURI.host}:${endpointURI.port}"),
+ context.strings.customEndpoint(
+ endpoint: "${endpointURI.host}:${endpointURI.port}",
+ ),
style: Theme.of(context).textTheme.bodySmall,
),
);
diff --git a/mobile/apps/photos/lib/ui/settings/gallery_settings_screen.dart b/mobile/apps/photos/lib/ui/settings/gallery_settings_screen.dart
index 15e7d97b25..911ed92da6 100644
--- a/mobile/apps/photos/lib/ui/settings/gallery_settings_screen.dart
+++ b/mobile/apps/photos/lib/ui/settings/gallery_settings_screen.dart
@@ -34,7 +34,7 @@ class _GallerySettingsScreenState extends State<GallerySettingsScreen> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return SettingsPageScaffold(
title: l10n.gallery,
@@ -84,7 +84,7 @@ class _GallerySettingsScreenState extends State<GallerySettingsScreen> {
}
Future<void> _showPhotoGridSizeSheet(BuildContext context) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
await showBottomSheetComponent<void>(
context: context,
builder: (sheetContext) => BottomSheetComponent(
@@ -129,7 +129,7 @@ class _GallerySettingsScreenState extends State<GallerySettingsScreen> {
}
Future<void> _showGroupTypeSheet(BuildContext context) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final currentGroupType = localSettings.getGalleryGroupType();
await showBottomSheetComponent<void>(
context: context,
diff --git a/mobile/apps/photos/lib/ui/settings/memories_settings_screen.dart b/mobile/apps/photos/lib/ui/settings/memories_settings_screen.dart
index eb772569ca..4bcd51b845 100644
--- a/mobile/apps/photos/lib/ui/settings/memories_settings_screen.dart
+++ b/mobile/apps/photos/lib/ui/settings/memories_settings_screen.dart
@@ -19,7 +19,7 @@ class MemoriesSettingsScreen extends StatefulWidget {
class _MemoriesSettingsScreenState extends State<MemoriesSettingsScreen> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return SettingsPageScaffold(
title: l10n.memories,
diff --git a/mobile/apps/photos/lib/ui/settings/ml/machine_learning_settings_page.dart b/mobile/apps/photos/lib/ui/settings/ml/machine_learning_settings_page.dart
index 0d8fd7bd74..2ae8e47b21 100644
--- a/mobile/apps/photos/lib/ui/settings/ml/machine_learning_settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/ml/machine_learning_settings_page.dart
@@ -86,11 +86,11 @@ class _MachineLearningSettingsPageState
final colors = context.componentColors;
return SettingsPageScaffold(
- title: StringsLocalizations.of(context).machineLearning,
+ title: context.strings.machineLearning,
onTitleTap: _handleEnabledTitleTap,
children: [
Text(
- StringsLocalizations.of(context).mlIndexingDescription,
+ context.strings.mlIndexingDescription,
textAlign: TextAlign.left,
style: TextStyles.mini.copyWith(color: colors.textLight),
),
@@ -103,7 +103,7 @@ class _MachineLearningSettingsPageState
Widget _buildDisabledMLScreen(BuildContext context) {
return SettingsPageScaffold(
- title: StringsLocalizations.of(context).mlConsent,
+ title: context.strings.mlConsent,
children: [
_buildDisabledMLDescription(context),
const SizedBox(height: 20),
@@ -118,7 +118,7 @@ class _MachineLearningSettingsPageState
_buildDisabledConsentAckRow(context),
const SizedBox(height: 20),
ButtonComponent(
- label: StringsLocalizations.of(context).mlConsent,
+ label: context.strings.mlConsent,
isDisabled: !_hasAcknowledgedMLConsent,
onTap: () async {
if (!_hasAcknowledgedMLConsent) return;
@@ -127,7 +127,7 @@ class _MachineLearningSettingsPageState
),
const SizedBox(height: 12),
ButtonComponent(
- label: StringsLocalizations.of(context).cancel,
+ label: context.strings.cancel,
variant: ButtonComponentVariant.secondary,
onTap: () async {
await _handleDisabledScreenExit();
@@ -208,7 +208,7 @@ class _MachineLearningSettingsPageState
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- StringsLocalizations.of(context).mlConsentDescription,
+ context.strings.mlConsentDescription,
textAlign: TextAlign.left,
style: TextStyles.mini.copyWith(color: colors.textLight),
),
@@ -216,7 +216,7 @@ class _MachineLearningSettingsPageState
GestureDetector(
onTap: () async => _openMLPrivacyPolicy(context),
child: Text(
- StringsLocalizations.of(context).mlConsentPrivacy,
+ context.strings.mlConsentPrivacy,
textAlign: TextAlign.left,
style: TextStyles.mini.copyWith(
color: colors.textLight,
@@ -253,7 +253,7 @@ class _MachineLearningSettingsPageState
const SizedBox(width: 10),
Expanded(
child: Text(
- StringsLocalizations.of(context).mlConsentConfirmation,
+ context.strings.mlConsentConfirmation,
style: TextStyles.mini.copyWith(color: colors.textLight),
),
),
@@ -267,7 +267,7 @@ class _MachineLearningSettingsPageState
MaterialPageRoute(
builder: (BuildContext context) {
return WebPage(
- StringsLocalizations.of(context).privacyPolicyTitle,
+ context.strings.privacyPolicyTitle,
"https://ente.com/privacy",
);
},
@@ -283,7 +283,7 @@ class _MachineLearningSettingsPageState
return Column(
children: [
MenuComponent(
- title: StringsLocalizations.of(context).enabled,
+ title: context.strings.enabled,
leading: const HugeIcon(
icon: HugeIcons.strokeRoundedToggleOn,
size: IconSizes.small,
@@ -297,7 +297,7 @@ class _MachineLearningSettingsPageState
),
const SizedBox(height: 8),
MenuComponent(
- title: StringsLocalizations.of(context).localIndexing,
+ title: context.strings.localIndexing,
leading: const HugeIcon(
icon: HugeIcons.strokeRoundedCpu,
size: IconSizes.small,
@@ -397,7 +397,7 @@ class _ModelLoadingStateState extends State<ModelLoadingState> {
child: Align(
alignment: Alignment.centerLeft,
child: Text(
- StringsLocalizations.of(context).status.toUpperCase(),
+ context.strings.status.toUpperCase(),
style: TextStyles.mini.copyWith(color: colors.textLight),
),
),
@@ -413,10 +413,10 @@ class _ModelLoadingStateState extends State<ModelLoadingState> {
MLModelDownloadService.instance.triggerModelsDownload(
onlyIndexingModels: false,
);
- title = StringsLocalizations.of(context).checkingModels;
+ title = context.strings.checkingModels;
leadingIcon = HugeIcons.strokeRoundedCloudDownload;
} else {
- title = StringsLocalizations.of(context).waitingForWifi;
+ title = context.strings.waitingForWifi;
leadingIcon = HugeIcons.strokeRoundedWifi02;
}
}
@@ -491,7 +491,7 @@ class MLStatusWidgetState extends State<MLStatusWidget> {
child: Align(
alignment: Alignment.centerLeft,
child: Text(
- StringsLocalizations.of(context).status.toUpperCase(),
+ context.strings.status.toUpperCase(),
style: TextStyles.mini.copyWith(color: colors.textLight),
),
),
@@ -508,9 +508,7 @@ class MLStatusWidgetState extends State<MLStatusWidget> {
if (!_isDeviceHealthy && pendingFiles > 0) {
return Text(
- StringsLocalizations.of(
- context,
- ).indexingPausedStatusDescription,
+ context.strings.indexingPausedStatusDescription,
style: TextStyles.mini.copyWith(color: colors.textLight),
);
}
@@ -519,7 +517,7 @@ class MLStatusWidgetState extends State<MLStatusWidget> {
children: [
MenuComponent(
key: ValueKey("pending_items_$pendingFiles"),
- title: StringsLocalizations.of(context).processed,
+ title: context.strings.processed,
leading: const HugeIcon(
icon: HugeIcons.strokeRoundedClock01,
size: IconSizes.small,
@@ -537,15 +535,13 @@ class MLStatusWidgetState extends State<MLStatusWidget> {
Padding(
padding: const EdgeInsets.only(top: 8),
child: MenuComponent(
- title: StringsLocalizations.of(
- context,
- ).clusteringProgress,
+ title: context.strings.clusteringProgress,
leading: const HugeIcon(
icon: HugeIcons.strokeRoundedSparkles,
size: IconSizes.small,
),
trailing: Text(
- StringsLocalizations.of(context).currentlyRunning,
+ context.strings.currentlyRunning,
style: TextStyles.mini.copyWith(
color: colors.textLight,
),
@@ -556,7 +552,7 @@ class MLStatusWidgetState extends State<MLStatusWidget> {
Padding(
padding: const EdgeInsets.only(top: 8),
child: MenuComponent(
- title: StringsLocalizations.of(context).waitingForWifi,
+ title: context.strings.waitingForWifi,
leading: const HugeIcon(
icon: HugeIcons.strokeRoundedWifi02,
size: IconSizes.small,
diff --git a/mobile/apps/photos/lib/ui/settings/notification_settings_screen.dart b/mobile/apps/photos/lib/ui/settings/notification_settings_screen.dart
index 861e3dfad8..b56b4ae142 100644
--- a/mobile/apps/photos/lib/ui/settings/notification_settings_screen.dart
+++ b/mobile/apps/photos/lib/ui/settings/notification_settings_screen.dart
@@ -55,7 +55,7 @@ class _NotificationSettingsScreenState
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final service = NotificationService.instance;
final showOnlyOnThisDay = isLocalGalleryMode;
diff --git a/mobile/apps/photos/lib/ui/settings/pending_sync/pending_sync_info_screen.dart b/mobile/apps/photos/lib/ui/settings/pending_sync/pending_sync_info_screen.dart
index f532057d1d..30531e957e 100644
--- a/mobile/apps/photos/lib/ui/settings/pending_sync/pending_sync_info_screen.dart
+++ b/mobile/apps/photos/lib/ui/settings/pending_sync/pending_sync_info_screen.dart
@@ -104,7 +104,7 @@ class _PendingSyncInfoScreenState extends State<PendingSyncInfoScreen> {
return SettingsPageScaffold(
title: "App Temp",
children: [
- MenuSectionTitle(title: StringsLocalizations.of(context).cachedData),
+ MenuSectionTitle(title: context.strings.cachedData),
MenuGroupComponent(
items: [
for (var pathIndex = 0; pathIndex < paths.length; pathIndex++)
diff --git a/mobile/apps/photos/lib/ui/settings/search/settings_search_page.dart b/mobile/apps/photos/lib/ui/settings/search/settings_search_page.dart
index 30c3cc4160..cbe3afa61a 100644
--- a/mobile/apps/photos/lib/ui/settings/search/settings_search_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/search/settings_search_page.dart
@@ -48,7 +48,7 @@ class _SettingsSearchPageState extends State<SettingsSearchPage> {
if (query.isEmpty || _allItems == null) {
_filteredItems = [];
} else {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final sectionOrder = <String, int>{};
for (var i = 0; i < _allItems!.length; i++) {
final item = _allItems![i];
@@ -158,7 +158,7 @@ class _SettingsSearchPageState extends State<SettingsSearchPage> {
child: TextInputComponent(
controller: _searchController,
focusNode: _searchFocusNode,
- hintText: StringsLocalizations.of(context).searchSettings,
+ hintText: context.strings.searchSettings,
onChanged: _onSearchChanged,
prefix: HugeIcon(
icon: HugeIcons.strokeRoundedSearch01,
@@ -192,7 +192,7 @@ class _SettingsSearchPageState extends State<SettingsSearchPage> {
children: [
const SizedBox(height: 8),
Text(
- StringsLocalizations.of(context).suggestions,
+ context.strings.suggestions,
style: TextStyles.large.copyWith(
color: context.componentColors.textBase,
),
@@ -221,7 +221,7 @@ class _SettingsSearchPageState extends State<SettingsSearchPage> {
child: Padding(
padding: const EdgeInsets.all(32),
child: Text(
- StringsLocalizations.of(context).noResultsFound,
+ context.strings.noResultsFound,
style: TextStyles.body.copyWith(
color: context.componentColors.textLight,
),
diff --git a/mobile/apps/photos/lib/ui/settings/search/settings_search_registry.dart b/mobile/apps/photos/lib/ui/settings/search/settings_search_registry.dart
index a98206a774..f8794c2e4d 100644
--- a/mobile/apps/photos/lib/ui/settings/search/settings_search_registry.dart
+++ b/mobile/apps/photos/lib/ui/settings/search/settings_search_registry.dart
@@ -24,7 +24,7 @@ import "package:photos/ui/settings/widget_settings_screen.dart";
/// Registry that provides all searchable settings items
class SettingsSearchRegistry {
static List<SettingsSearchItem> getSearchableItems(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final hasLoggedIn = Configuration.instance.isLoggedIn();
final isLocalGallery = isLocalGalleryMode;
final showThemeControls = Platform.isAndroid || kDebugMode;
@@ -760,7 +760,7 @@ class SettingsSearchRegistry {
BuildContext context,
void Function(Widget Function(BuildContext) routeBuilder) onNavigate,
) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final hasLoggedIn = Configuration.instance.isLoggedIn();
final isLocalGallery = isLocalGalleryMode;
diff --git a/mobile/apps/photos/lib/ui/settings/security/security_settings_page.dart b/mobile/apps/photos/lib/ui/settings/security/security_settings_page.dart
index e57e6e6ebe..1cdd1347d1 100644
--- a/mobile/apps/photos/lib/ui/settings/security/security_settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/security/security_settings_page.dart
@@ -60,7 +60,7 @@ class _SecuritySettingsPageState extends State<SecuritySettingsPage> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final showAccountSecurity =
_config.hasConfiguredAccount() && !isLocalGalleryMode;
@@ -146,9 +146,7 @@ class _SecuritySettingsPageState extends State<SecuritySettingsPage> {
final hasAuthenticated = await LocalAuthenticationService.instance
.requestLocalAuthentication(
context,
- StringsLocalizations.of(
- context,
- ).authToConfigureTwofactorAuthentication,
+ context.strings.authToConfigureTwofactorAuthentication,
);
final isTwoFactorEnabled = UserService.instance.hasEnabledTwoFactor();
if (hasAuthenticated) {
@@ -164,7 +162,7 @@ class _SecuritySettingsPageState extends State<SecuritySettingsPage> {
}
Future<void> _disableTwoFactor() async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
await showBottomSheetComponent<void>(
context: context,
builder: (sheetContext) => BottomSheetComponent(
@@ -191,7 +189,7 @@ class _SecuritySettingsPageState extends State<SecuritySettingsPage> {
final hasAuthenticated = await LocalAuthenticationService.instance
.requestLocalAuthentication(
context,
- StringsLocalizations.of(context).authToChangeEmailVerificationSetting,
+ context.strings.authToChangeEmailVerificationSetting,
);
final isEmailMFAEnabled = UserService.instance.hasEmailMFAEnabled();
if (hasAuthenticated) {
@@ -221,16 +219,13 @@ class _SecuritySettingsPageState extends State<SecuritySettingsPage> {
await UserService.instance.updateEmailMFA(isEnabled);
} catch (e) {
if (!mounted) return;
- showToast(context, StringsLocalizations.of(context).somethingWentWrong);
+ showToast(context, context.strings.somethingWentWrong);
}
}
Future<void> _onPasskeyTap(BuildContext context) async {
final hasAuthenticated = await LocalAuthenticationService.instance
- .requestLocalAuthentication(
- context,
- StringsLocalizations.of(context).authToViewPasskey,
- );
+ .requestLocalAuthentication(context, context.strings.authToViewPasskey);
if (hasAuthenticated && mounted && context.mounted) {
await _handlePasskeyClick(context);
}
@@ -268,7 +263,7 @@ class _SecuritySettingsPageState extends State<SecuritySettingsPage> {
if (!context.mounted) return;
final bool result = await requestAuthentication(
context,
- StringsLocalizations.of(context).authToChangeLockscreenSetting,
+ context.strings.authToChangeLockscreenSetting,
);
if (result) {
if (!context.mounted) return;
@@ -284,10 +279,8 @@ class _SecuritySettingsPageState extends State<SecuritySettingsPage> {
if (!context.mounted) return;
await showErrorDialog(
context,
- StringsLocalizations.of(context).noSystemLockFound,
- StringsLocalizations.of(
- context,
- ).toEnableAppLockPleaseSetupDevicePasscodeOrScreen,
+ context.strings.noSystemLockFound,
+ context.strings.toEnableAppLockPleaseSetupDevicePasscodeOrScreen,
);
}
}
@@ -296,7 +289,7 @@ class _SecuritySettingsPageState extends State<SecuritySettingsPage> {
final hasAuthenticated = await LocalAuthenticationService.instance
.requestLocalAuthentication(
context,
- StringsLocalizations.of(context).authToViewYourActiveSessions,
+ context.strings.authToViewYourActiveSessions,
);
if (hasAuthenticated) {
if (!context.mounted) return;
diff --git a/mobile/apps/photos/lib/ui/settings/storage_card_widget.dart b/mobile/apps/photos/lib/ui/settings/storage_card_widget.dart
index 599ccfa85f..694e0cfeef 100644
--- a/mobile/apps/photos/lib/ui/settings/storage_card_widget.dart
+++ b/mobile/apps/photos/lib/ui/settings/storage_card_widget.dart
@@ -159,8 +159,8 @@ class _StorageCardWidgetState extends State<StorageCardWidget> {
children: [
Text(
isMobileScreenSmall
- ? StringsLocalizations.of(context).usedSpace
- : StringsLocalizations.of(context).storage,
+ ? context.strings.usedSpace
+ : context.strings.storage,
style: const TextStyle(
fontFamily: 'Montserrat',
fontSize: 11,
@@ -230,7 +230,7 @@ class _StorageCardWidgetState extends State<StorageCardWidget> {
),
const SizedBox(width: 4),
Text(
- StringsLocalizations.of(context).storageBreakupYou,
+ context.strings.storageBreakupYou,
style: const TextStyle(
fontFamily: 'Montserrat',
fontSize: 9,
@@ -249,7 +249,7 @@ class _StorageCardWidgetState extends State<StorageCardWidget> {
),
const SizedBox(width: 4),
Text(
- StringsLocalizations.of(context).storageBreakupFamily,
+ context.strings.storageBreakupFamily,
style: const TextStyle(
fontFamily: 'Montserrat',
fontSize: 9,
@@ -261,7 +261,7 @@ class _StorageCardWidgetState extends State<StorageCardWidget> {
)
: const SizedBox.shrink(),
Text(
- StringsLocalizations.of(context).memoryCount(
+ context.strings.memoryCount(
count: userDetails.fileCount,
formattedCount: NumberFormat().format(userDetails.fileCount),
),
diff --git a/mobile/apps/photos/lib/ui/settings/streaming/video_streaming_settings_page.dart b/mobile/apps/photos/lib/ui/settings/streaming/video_streaming_settings_page.dart
index 3146eb443c..06d99372c6 100644
--- a/mobile/apps/photos/lib/ui/settings/streaming/video_streaming_settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/streaming/video_streaming_settings_page.dart
@@ -37,7 +37,7 @@ class _VideoStreamingSettingsPageState
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final hasEnabled = VideoPreviewService.instance.isVideoStreamingEnabled;
final children = hasEnabled
? _enabledChildren(context)
@@ -72,7 +72,7 @@ class _VideoStreamingSettingsPageState
List<Widget> _enabledChildren(BuildContext context) {
final colors = context.componentColors;
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return [
Text.rich(
TextSpan(
@@ -118,7 +118,7 @@ class _VideoStreamingSettingsPageState
List<Widget> _disabledChildren(BuildContext context) {
final colors = context.componentColors;
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return [
const SizedBox(height: 80),
Image.asset("assets/enable-streaming-static.png", height: 160),
@@ -162,7 +162,7 @@ class _VideoStreamingSettingsPageState
.push(
MaterialPageRoute(
builder: (BuildContext context) {
- return WebPage(StringsLocalizations.of(context).help, helpUrl);
+ return WebPage(context.strings.help, helpUrl);
},
),
)
@@ -233,7 +233,7 @@ class VideoStreamingStatusWidgetState
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MenuComponent(
- title: StringsLocalizations.of(context).processed,
+ title: context.strings.processed,
leading: _streamingMenuIcon(
context,
HugeIcons.strokeRoundedClock01,
@@ -250,7 +250,7 @@ class VideoStreamingStatusWidgetState
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
- StringsLocalizations.of(context).videoStreamingNote,
+ context.strings.videoStreamingNote,
style: TextStyles.body.copyWith(color: colors.textLight),
),
),
diff --git a/mobile/apps/photos/lib/ui/settings/support/help_support_page.dart b/mobile/apps/photos/lib/ui/settings/support/help_support_page.dart
index f9c5b48813..6b000ee719 100644
--- a/mobile/apps/photos/lib/ui/settings/support/help_support_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/support/help_support_page.dart
@@ -32,7 +32,7 @@ class HelpSupportPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return SettingsPageScaffold(
title: l10n.helpAndSupport,
@@ -185,10 +185,7 @@ class HelpSupportPage extends StatelessWidget {
Future<void> _viewLogs(BuildContext context) async {
final logFile = SuperLogging.logFile;
if (logFile == null) {
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
return;
}
await Navigator.of(
@@ -204,10 +201,7 @@ class HelpSupportPage extends StatelessWidget {
} catch (e, s) {
_logger.severe("Failed to export logs", e, s);
if (context.mounted) {
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
}
}
}
diff --git a/mobile/apps/photos/lib/ui/settings/support/no_mail_app_sheet.dart b/mobile/apps/photos/lib/ui/settings/support/no_mail_app_sheet.dart
index 8486b8e1d8..9505c19a2b 100644
--- a/mobile/apps/photos/lib/ui/settings/support/no_mail_app_sheet.dart
+++ b/mobile/apps/photos/lib/ui/settings/support/no_mail_app_sheet.dart
@@ -19,7 +19,7 @@ Future<void> showNoMailAppSheet(
await showBottomSheetComponent<void>(
context: context,
builder: (_) => BottomSheetComponent(
- title: StringsLocalizations.of(context).noEmailAppFound,
+ title: context.strings.noEmailAppFound,
content: NoMailAppSheet(
toEmail: toEmail,
subject: subject,
@@ -54,7 +54,7 @@ class NoMailAppSheet extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final copyFields = <_CopyFieldData>[
_CopyFieldData(label: l10n.subject, value: subject),
_CopyFieldData(label: l10n.message, value: message),
diff --git a/mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart b/mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart
index 924b35f727..4a9df4bd07 100644
--- a/mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart
@@ -33,7 +33,7 @@ class _ReportIssuePageState extends State<ReportIssuePage> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final colors = context.componentColors;
final subjectHasText = _subjectController.text.isNotEmpty;
final descriptionHasText = _descriptionController.text.isNotEmpty;
@@ -107,7 +107,7 @@ class _ReportIssuePageState extends State<ReportIssuePage> {
Future<void> _copyToClipboard(String text) async {
await Clipboard.setData(ClipboardData(text: text));
if (mounted) {
- showShortToast(context, StringsLocalizations.of(context).copied);
+ showShortToast(context, context.strings.copied);
}
}
@@ -115,7 +115,7 @@ class _ReportIssuePageState extends State<ReportIssuePage> {
if (_isSending) {
return;
}
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final subject = _subjectController.text.trim();
final description = _descriptionController.text.trim();
if (subject.isEmpty) {
diff --git a/mobile/apps/photos/lib/ui/settings/widget_settings_screen.dart b/mobile/apps/photos/lib/ui/settings/widget_settings_screen.dart
index 6929b7f2cc..a9b3d3e143 100644
--- a/mobile/apps/photos/lib/ui/settings/widget_settings_screen.dart
+++ b/mobile/apps/photos/lib/ui/settings/widget_settings_screen.dart
@@ -35,7 +35,7 @@ class WidgetSettingsScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return SettingsPageScaffold(
title: l10n.widgets,
diff --git a/mobile/apps/photos/lib/ui/settings/widgets/albums_widget_settings.dart b/mobile/apps/photos/lib/ui/settings/widgets/albums_widget_settings.dart
index 5edcfc03ce..7b7d21159e 100644
--- a/mobile/apps/photos/lib/ui/settings/widgets/albums_widget_settings.dart
+++ b/mobile/apps/photos/lib/ui/settings/widgets/albums_widget_settings.dart
@@ -96,7 +96,7 @@ class _AlbumsWidgetSettingsState extends State<AlbumsWidgetSettings> {
listenable: _selectedAlbums,
builder: (context, _) {
return ButtonComponent(
- label: StringsLocalizations.of(context).save,
+ label: context.strings.save,
shouldSurfaceExecutionStates: false,
onTap: _selectedAlbums.albums.isNotEmpty
? () async {
@@ -119,9 +119,9 @@ class _AlbumsWidgetSettingsState extends State<AlbumsWidgetSettings> {
interactive: true,
controller: _scrollController,
child: AppBarComponent(
- title: StringsLocalizations.of(context).albums,
+ title: context.strings.albums,
subtitle: hasInstalledAny
- ? StringsLocalizations.of(context).albumsWidgetDesc
+ ? context.strings.albumsWidgetDesc
: context.strings.addAlbumWidgetPrompt,
controller: _scrollController,
slivers: <Widget>[
@@ -150,7 +150,7 @@ class _AlbumsWidgetSettingsState extends State<AlbumsWidgetSettings> {
child: Padding(
padding: const EdgeInsets.fromLTRB(16, 18, 16, 8),
child: MenuComponent(
- title: StringsLocalizations.of(context).showTextOnWidget,
+ title: context.strings.showTextOnWidget,
trailing: ToggleSwitchComponent(
selected: _showText,
onChanged: (showText) async {
diff --git a/mobile/apps/photos/lib/ui/settings/widgets/memories_widget_settings.dart b/mobile/apps/photos/lib/ui/settings/widgets/memories_widget_settings.dart
index 89cad1a414..0724d6a83e 100644
--- a/mobile/apps/photos/lib/ui/settings/widgets/memories_widget_settings.dart
+++ b/mobile/apps/photos/lib/ui/settings/widgets/memories_widget_settings.dart
@@ -101,9 +101,9 @@ class _MemoriesWidgetSettingsState extends State<MemoriesWidgetSettings> {
return Scaffold(
backgroundColor: colorScheme.backgroundColour,
body: AppBarComponent(
- title: StringsLocalizations.of(context).memories,
+ title: context.strings.memories,
subtitle: hasInstalledAny
- ? StringsLocalizations.of(context).memoriesWidgetDesc
+ ? context.strings.memoriesWidgetDesc
: context.strings.addMemoriesWidgetPrompt,
slivers: <Widget>[
if (!hasInstalledAny)
@@ -137,9 +137,7 @@ class _MemoriesWidgetSettingsState extends State<MemoriesWidgetSettings> {
const SizedBox(height: 18),
if (kDebugMode) ...[
MenuComponent(
- title: StringsLocalizations.of(
- context,
- ).showTextOnWidget,
+ title: context.strings.showTextOnWidget,
trailing: ToggleSwitchComponent(
selected: _showText,
onChanged: (showText) async {
@@ -162,9 +160,7 @@ class _MemoriesWidgetSettingsState extends State<MemoriesWidgetSettings> {
MenuGroupComponent(
items: [
MenuComponent(
- title: StringsLocalizations.of(
- context,
- ).pastYearsMemories,
+ title: context.strings.pastYearsMemories,
leading: SvgPicture.asset(
"assets/icons/past-year-memory-icon.svg",
colorFilter: ColorFilter.mode(
@@ -183,9 +179,7 @@ class _MemoriesWidgetSettingsState extends State<MemoriesWidgetSettings> {
),
),
MenuComponent(
- title: StringsLocalizations.of(
- context,
- ).onThisDayMemories,
+ title: context.strings.onThisDayMemories,
leading: SvgPicture.asset(
"assets/icons/memories-widget-icon.svg",
colorFilter: ColorFilter.mode(
@@ -205,9 +199,7 @@ class _MemoriesWidgetSettingsState extends State<MemoriesWidgetSettings> {
),
if (isMLEnabled)
MenuComponent(
- title: StringsLocalizations.of(
- context,
- ).smartMemories,
+ title: context.strings.smartMemories,
leading: SvgPicture.asset(
"assets/icons/smart-memory-icon.svg",
colorFilter: ColorFilter.mode(
diff --git a/mobile/apps/photos/lib/ui/settings/widgets/people_widget_settings.dart b/mobile/apps/photos/lib/ui/settings/widgets/people_widget_settings.dart
index faca25d1cb..099f1de657 100644
--- a/mobile/apps/photos/lib/ui/settings/widgets/people_widget_settings.dart
+++ b/mobile/apps/photos/lib/ui/settings/widgets/people_widget_settings.dart
@@ -71,7 +71,7 @@ class _PeopleWidgetSettingsState extends State<PeopleWidgetSettings> {
: _selectedPeople.personIds.isNotEmpty;
return ButtonComponent(
- label: StringsLocalizations.of(context).save,
+ label: context.strings.save,
shouldSurfaceExecutionStates: false,
isDisabled: !areIdsChanged,
onTap: areIdsChanged
@@ -91,9 +91,9 @@ class _PeopleWidgetSettingsState extends State<PeopleWidgetSettings> {
)
: null,
body: AppBarComponent(
- title: StringsLocalizations.of(context).people,
+ title: context.strings.people,
subtitle: hasInstalledAny
- ? StringsLocalizations.of(context).peopleWidgetDesc
+ ? context.strings.peopleWidgetDesc
: context.strings.addPeopleWidgetPrompt,
slivers: <Widget>[
if (!hasInstalledAny)
@@ -118,7 +118,7 @@ class _PeopleWidgetSettingsState extends State<PeopleWidgetSettings> {
child: Padding(
padding: const EdgeInsets.fromLTRB(16, 18, 16, 8),
child: MenuComponent(
- title: StringsLocalizations.of(context).showTextOnWidget,
+ title: context.strings.showTextOnWidget,
trailing: ToggleSwitchComponent(
selected: _showText,
onChanged: (showText) async {
diff --git a/mobile/apps/photos/lib/ui/settings_page.dart b/mobile/apps/photos/lib/ui/settings_page.dart
index 1745d5bb46..c7d233a00f 100644
--- a/mobile/apps/photos/lib/ui/settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings_page.dart
@@ -71,9 +71,7 @@ class _SettingsBody extends StatelessWidget {
animation: emailNotifier,
builder: (context, _) {
final email = hasLoggedIn ? emailNotifier.value ?? "" : "";
- final title = email.isEmpty
- ? StringsLocalizations.of(context).settings
- : email;
+ final title = email.isEmpty ? context.strings.settings : email;
return SettingsPageScaffold(
title: title,
@@ -107,7 +105,7 @@ class _SettingsBody extends StatelessWidget {
const StorageCardWidget(),
const SizedBox(height: 16),
_buildMenuItem(
- title: StringsLocalizations.of(context).account,
+ title: context.strings.account,
icon: HugeIcons.strokeRoundedUser,
onTap: () async {
await routeToPage(context, const AccountSettingsPage());
@@ -115,7 +113,7 @@ class _SettingsBody extends StatelessWidget {
),
const SizedBox(height: 8),
_buildMenuItem(
- title: StringsLocalizations.of(context).backup,
+ title: context.strings.backup,
icon: HugeIcons.strokeRoundedCloudUpload,
onTap: () async {
await routeToPage(context, const BackupSettingsPage());
@@ -125,7 +123,7 @@ class _SettingsBody extends StatelessWidget {
],
// Privacy and personalization section
_buildMenuItem(
- title: StringsLocalizations.of(context).security,
+ title: context.strings.security,
icon: HugeIcons.strokeRoundedSecurityCheck,
onTap: () async {
await routeToPage(context, const SecuritySettingsPage());
@@ -133,7 +131,7 @@ class _SettingsBody extends StatelessWidget {
),
const SizedBox(height: 8),
_buildMenuItem(
- title: StringsLocalizations.of(context).appearance,
+ title: context.strings.appearance,
icon: HugeIcons.strokeRoundedPaintBoard,
onTap: () async {
await routeToPage(context, const AppearanceSettingsPage());
@@ -157,7 +155,7 @@ class _SettingsBody extends StatelessWidget {
const SizedBox(height: 8),
// Support section
_buildMenuItem(
- title: StringsLocalizations.of(context).helpAndSupport,
+ title: context.strings.helpAndSupport,
icon: HugeIcons.strokeRoundedHelpCircle,
onTap: () async {
await routeToPage(context, const HelpSupportPage());
@@ -165,7 +163,7 @@ class _SettingsBody extends StatelessWidget {
),
const SizedBox(height: 8),
_buildMenuItem(
- title: StringsLocalizations.of(context).about,
+ title: context.strings.about,
icon: HugeIcons.strokeRoundedInformationCircle,
onTap: () async {
await routeToPage(context, const AboutUsPage());
@@ -260,9 +258,9 @@ class _SettingsBody extends StatelessWidget {
Widget _buildOfflineLoginCard(BuildContext context, ColorTokens colors) {
return _buildMenuItem(
- title: StringsLocalizations.of(context).alreadyHaveAnAccount,
+ title: context.strings.alreadyHaveAnAccount,
icon: HugeIcons.strokeRoundedLogin01,
- subtitle: StringsLocalizations.of(context).loginToEnte,
+ subtitle: context.strings.loginToEnte,
trailing: Container(
width: 40,
height: 40,
@@ -286,28 +284,28 @@ class _SettingsBody extends StatelessWidget {
return MenuGroupComponent(
items: [
_buildMenuItem(
- title: StringsLocalizations.of(context).machineLearning,
+ title: context.strings.machineLearning,
icon: HugeIcons.strokeRoundedMagicWand01,
onTap: () async {
await routeToPage(context, const MachineLearningSettingsPage());
},
),
_buildMenuItem(
- title: StringsLocalizations.of(context).memories,
+ title: context.strings.memories,
icon: HugeIcons.strokeRoundedSparkles,
onTap: () async {
await routeToPage(context, const MemoriesSettingsScreen());
},
),
_buildMenuItem(
- title: StringsLocalizations.of(context).notifications,
+ title: context.strings.notifications,
icon: HugeIcons.strokeRoundedNotification01,
onTap: () async {
await routeToPage(context, const NotificationSettingsScreen());
},
),
_buildMenuItem(
- title: StringsLocalizations.of(context).widgets,
+ title: context.strings.widgets,
icon: HugeIcons.strokeRoundedAlignBoxBottomRight,
onTap: () async {
await routeToPage(context, const WidgetSettingsScreen());
@@ -322,7 +320,7 @@ class _SettingsBody extends StatelessWidget {
return MenuGroupComponent(
items: [
_buildMenuItem(
- title: StringsLocalizations.of(context).legacy,
+ title: context.strings.legacy,
icon: HugeIcons.strokeRoundedFavourite,
showOnlyLoadingState: true,
onTap: () async {
@@ -331,7 +329,7 @@ class _SettingsBody extends StatelessWidget {
await LocalAuthenticationService.instance
.requestLocalAuthentication(
context,
- StringsLocalizations.of(context).authToManageLegacy,
+ context.strings.authToManageLegacy,
);
if (hasAuthenticated) {
if (!context.mounted) return;
@@ -346,7 +344,7 @@ class _SettingsBody extends StatelessWidget {
},
),
_buildMenuItem(
- title: StringsLocalizations.of(context).family,
+ title: context.strings.family,
icon: HugeIcons.strokeRoundedUserMultiple,
showOnlyLoadingState: true,
shouldSurfaceExecutionStates: true,
@@ -374,7 +372,7 @@ class _SettingsBody extends StatelessWidget {
},
),
_buildMenuItem(
- title: StringsLocalizations.of(context).referrals,
+ title: context.strings.referrals,
icon: HugeIcons.strokeRoundedTicketStar,
onTap: () async {
await routeToPage(context, const ReferralScreen());
@@ -388,7 +386,7 @@ class _SettingsBody extends StatelessWidget {
return MenuGroupComponent(
items: [
_buildMenuItem(
- title: StringsLocalizations.of(context).freeUpSpace,
+ title: context.strings.freeUpSpace,
icon: HugeIcons.strokeRoundedRocket01,
showOnlyLoadingState: true,
onTap: () async {
@@ -396,35 +394,35 @@ class _SettingsBody extends StatelessWidget {
},
),
_buildMenuItem(
- title: StringsLocalizations.of(context).machineLearning,
+ title: context.strings.machineLearning,
icon: HugeIcons.strokeRoundedMagicWand01,
onTap: () async {
await routeToPage(context, const MachineLearningSettingsPage());
},
),
_buildMenuItem(
- title: StringsLocalizations.of(context).memories,
+ title: context.strings.memories,
icon: HugeIcons.strokeRoundedSparkles,
onTap: () async {
await routeToPage(context, const MemoriesSettingsScreen());
},
),
_buildMenuItem(
- title: StringsLocalizations.of(context).notifications,
+ title: context.strings.notifications,
icon: HugeIcons.strokeRoundedNotification01,
onTap: () async {
await routeToPage(context, const NotificationSettingsScreen());
},
),
_buildMenuItem(
- title: StringsLocalizations.of(context).widgets,
+ title: context.strings.widgets,
icon: HugeIcons.strokeRoundedAlignBoxBottomRight,
onTap: () async {
await routeToPage(context, const WidgetSettingsScreen());
},
),
_buildMenuItem(
- title: StringsLocalizations.of(context).videoStreaming,
+ title: context.strings.videoStreaming,
icon: HugeIcons.strokeRoundedVideoCameraAi,
onTap: () async {
await routeToPage(context, const VideoStreamingSettingsPage());
@@ -432,7 +430,7 @@ class _SettingsBody extends StatelessWidget {
),
if (flagService.enableMultiCast)
_buildMenuItem(
- title: StringsLocalizations.of(context).castSessions,
+ title: context.strings.castSessions,
icon: HugeIcons.strokeRoundedTvSmart,
onTap: () async {
await routeToPage(context, const CastSettingsPage());
@@ -445,7 +443,7 @@ class _SettingsBody extends StatelessWidget {
SettingsItem _buildMapsMenuItem(BuildContext context) {
return _buildMenuItem(
- title: StringsLocalizations.of(context).maps,
+ title: context.strings.maps,
icon: HugeIcons.strokeRoundedMaping,
trailing: ToggleSwitchComponent.async(
value: () => mapEnabled,
@@ -455,10 +453,7 @@ class _SettingsBody extends StatelessWidget {
await setMapEnabled(!isEnabled);
} catch (e) {
if (context.mounted) {
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
}
rethrow;
}
@@ -471,7 +466,7 @@ class _SettingsBody extends StatelessWidget {
return MenuGroupComponent(
items: [
_buildMenuItem(
- title: StringsLocalizations.of(context).merchandise,
+ title: context.strings.merchandise,
icon: HugeIcons.strokeRoundedTShirt,
onTap: () async {
await launchUrlString(
@@ -481,7 +476,7 @@ class _SettingsBody extends StatelessWidget {
},
),
_buildMenuItem(
- title: StringsLocalizations.of(context).rateUs,
+ title: context.strings.rateUs,
icon: HugeIcons.strokeRoundedStar,
onTap: () async {
final rateUrl = updateService.getRateDetails().item2;
@@ -494,7 +489,7 @@ class _SettingsBody extends StatelessWidget {
Widget _buildLogoutCard(BuildContext context) {
return _buildMenuItem(
- title: StringsLocalizations.of(context).logout,
+ title: context.strings.logout,
icon: HugeIcons.strokeRoundedLogout05,
isDestructive: true,
onTap: () async {
@@ -506,10 +501,10 @@ class _SettingsBody extends StatelessWidget {
void _onLogoutTapped(BuildContext context) {
showChoiceActionSheet(
context,
- title: StringsLocalizations.of(context).warning,
- body: StringsLocalizations.of(context).areYouSureYouWantToLogout,
+ title: context.strings.warning,
+ body: context.strings.areYouSureYouWantToLogout,
illustration: Image.asset("assets/warning-grey.png"),
- firstButtonLabel: StringsLocalizations.of(context).yes,
+ firstButtonLabel: context.strings.yes,
isCritical: true,
firstButtonOnTap: () async {
await UserService.instance.logout(context);
@@ -521,7 +516,7 @@ class _SettingsBody extends StatelessWidget {
await showVerifyIdentitySheet(
context,
self: true,
- title: StringsLocalizations.of(context).verifyIDLabel,
+ title: context.strings.verifyIDLabel,
);
}
}
diff --git a/mobile/apps/photos/lib/ui/sharing/add_participant_page.dart b/mobile/apps/photos/lib/ui/sharing/add_participant_page.dart
index ffec2bed00..ef29146e1f 100644
--- a/mobile/apps/photos/lib/ui/sharing/add_participant_page.dart
+++ b/mobile/apps/photos/lib/ui/sharing/add_participant_page.dart
@@ -79,9 +79,7 @@ class _AddParticipantPage extends State<AddParticipantPage> {
final footerDescriptions = [
if (filterSuggestedUsers.isNotEmpty)
ShareSectionDescription(
- StringsLocalizations.of(
- context,
- ).longPressAnEmailToVerifyEndToEndEncryption,
+ context.strings.longPressAnEmailToVerifyEndToEndEncryption,
),
..._roleDescriptionWidgets(),
];
@@ -94,13 +92,11 @@ class _AddParticipantPage extends State<AddParticipantPage> {
padding: const EdgeInsets.symmetric(horizontal: Spacing.lg),
sliver: SliverList.list(
children: [
- ShareSectionTitle(StringsLocalizations.of(context).addANewEmail),
+ ShareSectionTitle(context.strings.addANewEmail),
_enterEmailField(),
if (filterSuggestedUsers.isNotEmpty) ...[
const SizedBox(height: Spacing.xxl),
- ShareSectionTitle(
- StringsLocalizations.of(context).orPickAnExistingOne,
- ),
+ ShareSectionTitle(context.strings.orPickAnExistingOne),
],
],
),
@@ -175,13 +171,11 @@ class _AddParticipantPage extends State<AddParticipantPage> {
return [
if (widget.actionTypesToShow.contains(ActionTypesToShow.addCollaborator))
ShareSectionDescription(
- StringsLocalizations.of(
- context,
- ).collaboratorsCanAddPhotosAndVideosToTheSharedAlbum,
+ context.strings.collaboratorsCanAddPhotosAndVideosToTheSharedAlbum,
),
if (widget.actionTypesToShow.contains(ActionTypesToShow.addAdmin))
ShareSectionDescription(
- StringsLocalizations.of(context).adminsCanManagePhotosAndParticipants,
+ context.strings.adminsCanManagePhotosAndParticipants,
),
];
}
@@ -248,9 +242,9 @@ class _AddParticipantPage extends State<AddParticipantPage> {
? ButtonComponentVariant.neutral
: ButtonComponentVariant.primary,
size: ButtonComponentSize.large,
- label: StringsLocalizations.of(
- context,
- ).addCollaborators(count: _selectedEmails.length),
+ label: context.strings.addCollaborators(
+ count: _selectedEmails.length,
+ ),
isDisabled: _selectedEmails.isEmpty,
onTap: () async {
final results = <bool>[];
@@ -273,9 +267,9 @@ class _AddParticipantPage extends State<AddParticipantPage> {
if (!mounted) return;
showToast(
context,
- StringsLocalizations.of(
- context,
- ).collaboratorsSuccessfullyAdded(count: noOfSuccessfullAdds),
+ context.strings.collaboratorsSuccessfullyAdded(
+ count: noOfSuccessfullAdds,
+ ),
);
if (!results.any((e) => e == false) && mounted) {
@@ -290,9 +284,7 @@ class _AddParticipantPage extends State<AddParticipantPage> {
ButtonComponent(
variant: ButtonComponentVariant.primary,
size: ButtonComponentSize.large,
- label: StringsLocalizations.of(
- context,
- ).addViewers(count: _selectedEmails.length),
+ label: context.strings.addViewers(count: _selectedEmails.length),
isDisabled: _selectedEmails.isEmpty,
onTap: () async {
final results = <bool>[];
@@ -315,9 +307,9 @@ class _AddParticipantPage extends State<AddParticipantPage> {
if (!mounted) return;
showToast(
context,
- StringsLocalizations.of(
- context,
- ).viewersSuccessfullyAdded(count: noOfSuccessfullAdds),
+ context.strings.viewersSuccessfullyAdded(
+ count: noOfSuccessfullAdds,
+ ),
);
if (!results.any((e) => e == false) && mounted) {
@@ -334,9 +326,7 @@ class _AddParticipantPage extends State<AddParticipantPage> {
? ButtonComponentVariant.primary
: ButtonComponentVariant.neutral,
size: ButtonComponentSize.large,
- label: StringsLocalizations.of(
- context,
- ).addAdmins(count: _selectedEmails.length),
+ label: context.strings.addAdmins(count: _selectedEmails.length),
isDisabled: _selectedEmails.isEmpty,
onTap: () async {
final results = <bool>[];
@@ -359,9 +349,7 @@ class _AddParticipantPage extends State<AddParticipantPage> {
if (!mounted) return;
showToast(
context,
- StringsLocalizations.of(
- context,
- ).adminsSuccessfullyAdded(count: successful),
+ context.strings.adminsSuccessfullyAdded(count: successful),
);
if (!results.any((e) => e == false) && mounted) {
@@ -393,7 +381,7 @@ class _AddParticipantPage extends State<AddParticipantPage> {
child: TextInputComponent(
controller: _textController,
focusNode: textFieldFocusNode,
- hintText: StringsLocalizations.of(context).enterAnEmailAddress,
+ hintText: context.strings.enterAnEmailAddress,
isClearable: true,
shouldUnfocusOnClearOrSubmit: true,
autofillHints: const [AutofillHints.email],
@@ -409,7 +397,7 @@ class _AddParticipantPage extends State<AddParticipantPage> {
const SizedBox(width: Spacing.sm),
IconButtonComponent(
variant: IconButtonComponentVariant.green,
- tooltip: StringsLocalizations.of(context).add,
+ tooltip: context.strings.add,
icon: const HugeIcon(icon: HugeIcons.strokeRoundedMailAdd01),
onTap: _emailIsValid ? _addNewEmail : null,
),
@@ -486,15 +474,15 @@ class _AddParticipantPage extends State<AddParticipantPage> {
String _getTitle() {
if (widget.actionTypesToShow.length > 1) {
- return StringsLocalizations.of(context).addParticipants;
+ return context.strings.addParticipants;
}
switch (widget.actionTypesToShow.first) {
case ActionTypesToShow.addViewer:
- return StringsLocalizations.of(context).addViewer;
+ return context.strings.addViewer;
case ActionTypesToShow.addCollaborator:
- return StringsLocalizations.of(context).addCollaborator;
+ return context.strings.addCollaborator;
case ActionTypesToShow.addAdmin:
- return StringsLocalizations.of(context).addAdmin;
+ return context.strings.addAdmin;
}
}
@@ -504,13 +492,11 @@ class _AddParticipantPage extends State<AddParticipantPage> {
}
switch (widget.actionTypesToShow.first) {
case ActionTypesToShow.addCollaborator:
- return StringsLocalizations.of(
- context,
- ).collaboratorsCanAddPhotosAndVideosToTheSharedAlbum;
+ return context
+ .strings
+ .collaboratorsCanAddPhotosAndVideosToTheSharedAlbum;
case ActionTypesToShow.addAdmin:
- return StringsLocalizations.of(
- context,
- ).adminsCanManagePhotosAndParticipants;
+ return context.strings.adminsCanManagePhotosAndParticipants;
case ActionTypesToShow.addViewer:
return null;
}
diff --git a/mobile/apps/photos/lib/ui/sharing/album_participants_page.dart b/mobile/apps/photos/lib/ui/sharing/album_participants_page.dart
index d2b0236929..add2473143 100644
--- a/mobile/apps/photos/lib/ui/sharing/album_participants_page.dart
+++ b/mobile/apps/photos/lib/ui/sharing/album_participants_page.dart
@@ -114,19 +114,19 @@ class _AlbumParticipantsPageState extends State<AlbumParticipantsPage> {
final children = <Widget>[
if (shouldShowPublicLink) ...[
- ShareSectionTitle(StringsLocalizations.of(context).publicLinkEnabled),
+ ShareSectionTitle(context.strings.publicLinkEnabled),
PublicLinkEnabledActionsWidget(
collection: _collection,
sendLinkButtonKey: _sendLinkButtonKey,
),
const SizedBox(height: Spacing.xxl),
],
- ShareSectionTitle(StringsLocalizations.of(context).albumOwner),
+ ShareSectionTitle(context.strings.albumOwner),
ShareMenuGroup(
items: [
ShareMenuItem(
title: isOwner
- ? StringsLocalizations.of(context).you
+ ? context.strings.you
: _nameIfAvailableElseEmail(owner),
leading: UserAvatarWidget(owner, currentUserID: currentUserID),
isDisabled: true,
@@ -135,37 +135,37 @@ class _AlbumParticipantsPageState extends State<AlbumParticipantsPage> {
),
..._participantSection(
context,
- title: StringsLocalizations.of(context).admins,
+ title: context.strings.admins,
users: admins,
currentUserID: currentUserID,
canManageParticipants: canManageParticipants,
addTitle: admins.isNotEmpty
- ? StringsLocalizations.of(context).addMoreAdmins
- : StringsLocalizations.of(context).addAdmin,
+ ? context.strings.addMoreAdmins
+ : context.strings.addAdmin,
addActions: const [ActionTypesToShow.addAdmin],
addIcon: HugeIcons.strokeRoundedCrown,
),
..._participantSection(
context,
- title: StringsLocalizations.of(context).collaborator,
+ title: context.strings.collaborator,
users: collaborators,
currentUserID: currentUserID,
canManageParticipants: canManageParticipants,
addTitle: collaborators.isNotEmpty
- ? StringsLocalizations.of(context).addMore
- : StringsLocalizations.of(context).addCollaborator,
+ ? context.strings.addMore
+ : context.strings.addCollaborator,
addActions: const [ActionTypesToShow.addCollaborator],
addIcon: HugeIcons.strokeRoundedUserGroup,
),
..._participantSection(
context,
- title: StringsLocalizations.of(context).viewer,
+ title: context.strings.viewer,
users: viewers,
currentUserID: currentUserID,
canManageParticipants: canManageParticipants,
addTitle: viewers.isNotEmpty
- ? StringsLocalizations.of(context).addMore
- : StringsLocalizations.of(context).addViewer,
+ ? context.strings.addMore
+ : context.strings.addViewer,
addActions: const [ActionTypesToShow.addViewer],
addIcon: HugeIcons.strokeRoundedView,
),
@@ -174,9 +174,7 @@ class _AlbumParticipantsPageState extends State<AlbumParticipantsPage> {
return ShareScaffold(
title: _collection.displayName,
- subtitle: StringsLocalizations.of(
- context,
- ).albumParticipantsCount(count: participants),
+ subtitle: context.strings.albumParticipantsCount(count: participants),
children: children,
);
}
@@ -199,7 +197,7 @@ class _AlbumParticipantsPageState extends State<AlbumParticipantsPage> {
for (final user in users)
ShareMenuItem(
title: user.id == currentUserID
- ? StringsLocalizations.of(context).you
+ ? context.strings.you
: _nameIfAvailableElseEmail(user),
leading: UserAvatarWidget(
user,
diff --git a/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_role_badge.dart b/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_role_badge.dart
index 6db7335fc8..fb8105133a 100644
--- a/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_role_badge.dart
+++ b/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_role_badge.dart
@@ -122,7 +122,7 @@ String librarySharingRoleLabel(
BuildContext context,
CollectionParticipantRole role,
) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return switch (role) {
CollectionParticipantRole.admin => l10n.admin,
CollectionParticipantRole.collaborator => l10n.collaborator,
diff --git a/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_selection_sheet.dart b/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_selection_sheet.dart
index 088badbea4..2103691e44 100644
--- a/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_selection_sheet.dart
+++ b/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_selection_sheet.dart
@@ -45,7 +45,7 @@ class LibrarySharingSelectionSheet extends StatelessWidget {
? LibrarySharingStrings.shareAlbumCount(
controller.selectedCount,
)
- : StringsLocalizations.of(context).save,
+ : context.strings.save,
density: ButtonComponentDensity.compact,
isDisabled: !controller.canApply,
onTap: onApply,
@@ -83,7 +83,7 @@ class LibrarySharingSelectionSheet extends StatelessWidget {
}
Widget _summary(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final selectableAlbumCount = controller.selectableAlbumCount;
final allSelected =
selectableAlbumCount > 0 &&
diff --git a/mobile/apps/photos/lib/ui/sharing/manage_album_participant.dart b/mobile/apps/photos/lib/ui/sharing/manage_album_participant.dart
index fefb98c5bc..8f960c5c97 100644
--- a/mobile/apps/photos/lib/ui/sharing/manage_album_participant.dart
+++ b/mobile/apps/photos/lib/ui/sharing/manage_album_participant.dart
@@ -39,14 +39,14 @@ class _ManageIndividualParticipantState
final resolvedName = resolveDisplayName(widget.user);
bool isConvertToViewSuccess = false;
return ShareScaffold(
- title: StringsLocalizations.of(context).manage,
+ title: context.strings.manage,
subtitle: resolvedName,
children: [
- ShareSectionTitle(StringsLocalizations.of(context).addedAs),
+ ShareSectionTitle(context.strings.addedAs),
ShareMenuGroup(
items: [
ShareMenuItem(
- title: StringsLocalizations.of(context).admin,
+ title: context.strings.admin,
icon: HugeIcons.strokeRoundedCrown,
trailing: isAdmin ? shareCheck(context) : null,
onTap: isAdmin
@@ -67,7 +67,7 @@ class _ManageIndividualParticipantState
},
),
ShareMenuItem(
- title: StringsLocalizations.of(context).collaborator,
+ title: context.strings.collaborator,
icon: HugeIcons.strokeRoundedUserGroup,
trailing: isCollaborator ? shareCheck(context) : null,
onTap: isCollaborator
@@ -89,7 +89,7 @@ class _ManageIndividualParticipantState
},
),
ShareMenuItem(
- title: StringsLocalizations.of(context).viewer,
+ title: context.strings.viewer,
icon: HugeIcons.strokeRoundedView,
trailing: isViewer ? shareCheck(context) : null,
showOnlyLoadingState: true,
@@ -98,13 +98,9 @@ class _ManageIndividualParticipantState
: () async {
final actionResult = await showChoiceActionSheet(
context,
- title: StringsLocalizations.of(
- context,
- ).changePermissionsQuestion,
- firstButtonLabel: StringsLocalizations.of(
- context,
- ).yesConvertToViewer,
- body: StringsLocalizations.of(context)
+ title: context.strings.changePermissionsQuestion,
+ firstButtonLabel: context.strings.yesConvertToViewer,
+ body: context.strings
.cannotAddMorePhotosAfterBecomingViewer(
user: resolvedName,
),
@@ -141,16 +137,14 @@ class _ManageIndividualParticipantState
],
),
ShareSectionDescription(
- StringsLocalizations.of(
- context,
- ).adminsAndCollaboratorsCanAddPhotosDescription,
+ context.strings.adminsAndCollaboratorsCanAddPhotosDescription,
),
const SizedBox(height: Spacing.xxl),
- ShareSectionTitle(StringsLocalizations.of(context).removeParticipant),
+ ShareSectionTitle(context.strings.removeParticipant),
ShareMenuGroup(
items: [
ShareMenuItem(
- title: StringsLocalizations.of(context).remove,
+ title: context.strings.remove,
leading: const Icon(Icons.not_interested_outlined),
isDestructive: true,
onTap: () async {
diff --git a/mobile/apps/photos/lib/ui/sharing/manage_links_widget.dart b/mobile/apps/photos/lib/ui/sharing/manage_links_widget.dart
index 244b7b0e56..c7d65f8b24 100644
--- a/mobile/apps/photos/lib/ui/sharing/manage_links_widget.dart
+++ b/mobile/apps/photos/lib/ui/sharing/manage_links_widget.dart
@@ -49,13 +49,13 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
final normalizedLayout = normalizePublicLinkLayout(layout);
switch (normalizedLayout) {
case 'masonry':
- return StringsLocalizations.of(context).layoutMasonry;
+ return context.strings.layoutMasonry;
case 'trip':
- return StringsLocalizations.of(context).layoutTrip;
+ return context.strings.layoutTrip;
case 'grouped':
- return StringsLocalizations.of(context).layoutGrouped;
+ return context.strings.layoutGrouped;
default:
- return StringsLocalizations.of(context).layoutMasonry;
+ return context.strings.layoutMasonry;
}
}
@@ -78,12 +78,12 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
final colors = context.componentColors;
return ShareScaffold(
- title: StringsLocalizations.of(context).manageLink,
+ title: context.strings.manageLink,
children: [
ShareMenuGroup(
items: [
ShareMenuItem(
- title: StringsLocalizations.of(context).albumLayout,
+ title: context.strings.albumLayout,
subtitle: _getLayoutDisplayName(
collection.pubMagicMetadata.layout ?? "masonry",
context,
@@ -107,7 +107,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
items: [
ShareMenuItem(
key: ValueKey("Allow collect $isCollectEnabled"),
- title: StringsLocalizations.of(context).allowAddingPhotos,
+ title: context.strings.allowAddingPhotos,
icon: HugeIcons.strokeRoundedImageAdd01,
trailing: ToggleSwitchComponent(
selected: isCollectEnabled,
@@ -120,7 +120,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
),
ShareMenuItem(
key: ValueKey("Enable comment $enableComment"),
- title: StringsLocalizations.of(context).enableComment,
+ title: context.strings.enableComment,
icon: HugeIcons.strokeRoundedComment01,
trailing: ToggleSwitchComponent(
selected: enableComment,
@@ -137,12 +137,12 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
ShareMenuGroup(
items: [
ShareMenuItem(
- title: StringsLocalizations.of(context).linkExpiry,
+ title: context.strings.linkExpiry,
subtitle: (url.hasExpiry
? (url.isExpired
- ? StringsLocalizations.of(context).linkExpired
- : StringsLocalizations.of(context).linkEnabled)
- : StringsLocalizations.of(context).linkNeverExpires),
+ ? context.strings.linkExpired
+ : context.strings.linkEnabled)
+ : context.strings.linkNeverExpires),
titleMaxLines: 1,
icon: HugeIcons.strokeRoundedCalendar03,
showChevron: true,
@@ -155,8 +155,8 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
if (url.hasExpiry) ...[
ShareSectionDescription(
url.isExpired
- ? StringsLocalizations.of(context).expiredLinkInfo
- : StringsLocalizations.of(context).linkExpiresOn(
+ ? context.strings.expiredLinkInfo
+ : context.strings.linkExpiresOn(
expiryTime: getFormattedTime(
DateTime.fromMicrosecondsSinceEpoch(url.validTill),
context: context,
@@ -169,9 +169,9 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
ShareMenuGroup(
items: [
ShareMenuItem(
- title: StringsLocalizations.of(context).linkDeviceLimit,
+ title: context.strings.linkDeviceLimit,
subtitle: url.deviceLimit == 0
- ? StringsLocalizations.of(context).noDeviceLimit
+ ? context.strings.noDeviceLimit
: "${url.deviceLimit}",
icon: HugeIcons.strokeRoundedLaptop,
showChevron: true,
@@ -181,7 +181,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
),
ShareMenuItem(
key: ValueKey("Allow downloads $isDownloadEnabled"),
- title: StringsLocalizations.of(context).allowDownloads,
+ title: context.strings.allowDownloads,
icon: HugeIcons.strokeRoundedDownload04,
trailing: ToggleSwitchComponent(
selected: isDownloadEnabled,
@@ -194,12 +194,8 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
unawaited(
showErrorDialog(
context,
- StringsLocalizations.of(
- context,
- ).disableDownloadWarningTitle,
- StringsLocalizations.of(
- context,
- ).disableDownloadWarningBody,
+ context.strings.disableDownloadWarningTitle,
+ context.strings.disableDownloadWarningBody,
),
);
}
@@ -208,7 +204,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
),
ShareMenuItem(
key: ValueKey("Allow join $isJoinEnabled"),
- title: StringsLocalizations.of(context).allowJoiningAlbum,
+ title: context.strings.allowJoiningAlbum,
icon: HugeIcons.strokeRoundedUserMultiple,
trailing: ToggleSwitchComponent(
selected: isJoinEnabled,
@@ -219,7 +215,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
),
ShareMenuItem(
key: ValueKey("Password lock $isPasswordEnabled"),
- title: StringsLocalizations.of(context).passwordLock,
+ title: context.strings.passwordLock,
icon: HugeIcons.strokeRoundedLockPassword,
trailing: ToggleSwitchComponent(
selected: isPasswordEnabled,
@@ -228,13 +224,9 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
unawaited(
showTextInputDialog(
context,
- title: StringsLocalizations.of(context).setAPassword,
- submitButtonLabel: StringsLocalizations.of(
- context,
- ).lockButtonLabel,
- hintText: StringsLocalizations.of(
- context,
- ).enterPassword,
+ title: context.strings.setAPassword,
+ submitButtonLabel: context.strings.lockButtonLabel,
+ hintText: context.strings.enterPassword,
isPasswordInput: true,
alwaysShowSuccessState: true,
onSubmit: (String password) async {
@@ -268,7 +260,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
ShareMenuGroup(
items: [
ShareMenuItem(
- title: StringsLocalizations.of(context).removeLink,
+ title: context.strings.removeLink,
leading: Icon(Icons.remove_circle_outline, color: colors.warning),
isDestructive: true,
onTap: () async {
@@ -301,7 +293,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
if (url.isExpired) {
return [
ShareMenuItem(
- title: StringsLocalizations.of(context).linkHasExpired,
+ title: context.strings.linkHasExpired,
leading: const Icon(Icons.error_outline_rounded),
isDestructive: true,
isDisabled: true,
@@ -311,20 +303,17 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
return [
ShareMenuItem(
- title: StringsLocalizations.of(context).copyLink,
+ title: context.strings.copyLink,
icon: HugeIcons.strokeRoundedCopy01,
showOnlyLoadingState: true,
onTap: () async {
await Clipboard.setData(ClipboardData(text: urlValue));
if (!context.mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).linkCopiedToClipboard,
- );
+ showShortToast(context, context.strings.linkCopiedToClipboard);
},
),
ShareMenuItem(
- title: StringsLocalizations.of(context).copyEmbedHtml,
+ title: context.strings.copyEmbedHtml,
leading: const Icon(Icons.code_rounded),
onTap: () async {
final embedHtml = CollectionsService.instance.getEmbedHtml(
@@ -332,22 +321,19 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
);
await Clipboard.setData(ClipboardData(text: embedHtml));
if (!context.mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).linkCopiedToClipboard,
- );
+ showShortToast(context, context.strings.linkCopiedToClipboard);
},
),
ShareMenuItem(
key: sendLinkButtonKey,
- title: StringsLocalizations.of(context).sendLink,
+ title: context.strings.sendLink,
icon: HugeIcons.strokeRoundedSent,
onTap: () async {
await shareAlbumLink(context, urlValue, sendLinkButtonKey);
},
),
ShareMenuItem(
- title: StringsLocalizations.of(context).sendQrCode,
+ title: context.strings.sendQrCode,
icon: HugeIcons.strokeRoundedQrCode,
onTap: () async {
await showDialog<void>(
@@ -360,8 +346,8 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
shareFileName: 'ente_qr_${widget.collection!.displayName}.png',
shareText:
'Scan this QR code to view my ${widget.collection!.displayName} album on ente',
- dialogTitle: StringsLocalizations.of(context).qrCode,
- shareButtonText: StringsLocalizations.of(context).share,
+ dialogTitle: context.strings.qrCode,
+ shareButtonText: context.strings.share,
logoAssetPath: 'assets/qr_logo.png',
branding: const QrTextBranding(
text: 'ente',
@@ -380,7 +366,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
}
Future<void> _showLinkExpirySheet(BuildContext context, PublicURL url) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final expiryOptions = [
(title: l10n.never, expireAfterInMicroseconds: 0),
(
@@ -504,7 +490,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
BuildContext context,
PublicURL url,
) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final currentDeviceLimit = url.deviceLimit;
final deviceLimits = [
if (!publicLinkDeviceLimits.contains(currentDeviceLimit))
@@ -587,10 +573,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
bool showProgressDialog = true,
}) async {
final dialog = showProgressDialog
- ? createProgressDialog(
- context,
- StringsLocalizations.of(context).pleaseWait,
- )
+ ? createProgressDialog(context, context.strings.pleaseWait)
: null;
await dialog?.show();
try {
@@ -600,7 +583,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
);
await dialog?.hide();
if (context.mounted) {
- showShortToast(context, StringsLocalizations.of(context).albumUpdated);
+ showShortToast(context, context.strings.albumUpdated);
setState(() {});
}
} catch (e) {
@@ -621,22 +604,22 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
Future<void> _showLinkEditNotAllowedDialog(BuildContext context) async {
final buttonResult = await showDialogWidget(
context: context,
- title: StringsLocalizations.of(context).sorry,
- body: StringsLocalizations.of(context).subscribeToChangeLinkSetting,
+ title: context.strings.sorry,
+ body: context.strings.subscribeToChangeLinkSetting,
buttons: [
ButtonWidget(
buttonType: ButtonType.primary,
isInAlert: true,
shouldStickToDarkTheme: true,
buttonAction: ButtonAction.first,
- labelText: StringsLocalizations.of(context).subscribe,
+ labelText: context.strings.subscribe,
),
ButtonWidget(
buttonType: ButtonType.secondary,
buttonAction: ButtonAction.cancel,
isInAlert: true,
shouldStickToDarkTheme: true,
- labelText: StringsLocalizations.of(context).ok,
+ labelText: context.strings.ok,
),
],
);
diff --git a/mobile/apps/photos/lib/ui/sharing/memory_link_details_sheet.dart b/mobile/apps/photos/lib/ui/sharing/memory_link_details_sheet.dart
index 1d08028cf6..ab513b3747 100644
--- a/mobile/apps/photos/lib/ui/sharing/memory_link_details_sheet.dart
+++ b/mobile/apps/photos/lib/ui/sharing/memory_link_details_sheet.dart
@@ -18,7 +18,7 @@ Future<bool?> showMemoryLinkDetailsSheet(
required int shareId,
required String title,
}) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return showBaseBottomSheet<bool>(
context,
title: l10n.shareLink,
diff --git a/mobile/apps/photos/lib/ui/sharing/pickers/layout_picker_page.dart b/mobile/apps/photos/lib/ui/sharing/pickers/layout_picker_page.dart
index dc4ee83ae4..3d45059a28 100644
--- a/mobile/apps/photos/lib/ui/sharing/pickers/layout_picker_page.dart
+++ b/mobile/apps/photos/lib/ui/sharing/pickers/layout_picker_page.dart
@@ -18,11 +18,11 @@ class LayoutPickerPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ShareScaffold(
- title: StringsLocalizations.of(context).albumLayout,
+ title: context.strings.albumLayout,
actions: [
IconButtonComponent(
variant: IconButtonComponentVariant.primary,
- tooltip: StringsLocalizations.of(context).preview,
+ tooltip: context.strings.preview,
shouldSurfaceExecutionStates: false,
icon: const HugeIcon(icon: HugeIcons.strokeRoundedView),
onTap: () async {
@@ -41,11 +41,7 @@ class LayoutPickerPage extends StatelessWidget {
);
await routeToPage(
context,
- WebPage(
- StringsLocalizations.of(context).preview,
- publicUrl,
- canOpenInBrowser: false,
- ),
+ WebPage(context.strings.preview, publicUrl, canOpenInBrowser: false),
);
} catch (e) {
if (!context.mounted) return;
@@ -65,9 +61,9 @@ class ItemsWidget extends StatefulWidget {
class _ItemsWidgetState extends State<ItemsWidget> {
late String currentLayout;
late final List<Tuple2<String, String>> _layoutOptions = [
- Tuple2(StringsLocalizations.of(context).layoutMasonry, "masonry"),
- Tuple2(StringsLocalizations.of(context).layoutTrip, "trip"),
- Tuple2(StringsLocalizations.of(context).layoutGrouped, "grouped"),
+ Tuple2(context.strings.layoutMasonry, "masonry"),
+ Tuple2(context.strings.layoutTrip, "trip"),
+ Tuple2(context.strings.layoutGrouped, "grouped"),
];
@override
@@ -91,9 +87,7 @@ class _ItemsWidgetState extends State<ItemsWidget> {
children: [
ShareMenuGroup(items: items),
if (currentLayout == "trip")
- ShareSectionDescription(
- StringsLocalizations.of(context).mapsPrivacyNotice,
- ),
+ ShareSectionDescription(context.strings.mapsPrivacyNotice),
],
);
}
diff --git a/mobile/apps/photos/lib/ui/sharing/public_link_enabled_actions_widget.dart b/mobile/apps/photos/lib/ui/sharing/public_link_enabled_actions_widget.dart
index 663312c074..93d7024abc 100644
--- a/mobile/apps/photos/lib/ui/sharing/public_link_enabled_actions_widget.dart
+++ b/mobile/apps/photos/lib/ui/sharing/public_link_enabled_actions_widget.dart
@@ -35,7 +35,7 @@ class PublicLinkEnabledActionsWidget extends StatelessWidget {
if (hasExpired) {
items.add(
ShareMenuItem(
- title: StringsLocalizations.of(context).linkHasExpired,
+ title: context.strings.linkHasExpired,
leading: const Icon(Icons.error_outline_rounded),
isDestructive: true,
isDisabled: true,
@@ -46,28 +46,25 @@ class PublicLinkEnabledActionsWidget extends StatelessWidget {
final GlobalKey effectiveKey = sendLinkButtonKey ?? GlobalKey();
items.addAll([
ShareMenuItem(
- title: StringsLocalizations.of(context).copyLink,
+ title: context.strings.copyLink,
icon: HugeIcons.strokeRoundedCopy01,
showOnlyLoadingState: true,
onTap: () async {
await Clipboard.setData(ClipboardData(text: url));
if (!context.mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).linkCopiedToClipboard,
- );
+ showShortToast(context, context.strings.linkCopiedToClipboard);
},
),
ShareMenuItem(
key: effectiveKey,
- title: StringsLocalizations.of(context).sendLink,
+ title: context.strings.sendLink,
icon: HugeIcons.strokeRoundedSent,
onTap: () async {
await shareAlbumLink(context, url, effectiveKey);
},
),
ShareMenuItem(
- title: StringsLocalizations.of(context).sendQrCode,
+ title: context.strings.sendQrCode,
icon: HugeIcons.strokeRoundedQrCode,
onTap: () async {
await showDialog<void>(
@@ -80,8 +77,8 @@ class PublicLinkEnabledActionsWidget extends StatelessWidget {
shareFileName: 'ente_qr_${collection.displayName}.png',
shareText:
'Scan this QR code to view my ${collection.displayName} album on ente',
- dialogTitle: StringsLocalizations.of(context).qrCode,
- shareButtonText: StringsLocalizations.of(context).share,
+ dialogTitle: context.strings.qrCode,
+ shareButtonText: context.strings.share,
logoAssetPath: 'assets/qr_logo.png',
branding: const QrTextBranding(
text: 'ente',
diff --git a/mobile/apps/photos/lib/ui/sharing/share_collection_page.dart b/mobile/apps/photos/lib/ui/sharing/share_collection_page.dart
index 7f081df962..181a5368a3 100644
--- a/mobile/apps/photos/lib/ui/sharing/share_collection_page.dart
+++ b/mobile/apps/photos/lib/ui/sharing/share_collection_page.dart
@@ -103,9 +103,9 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
final bool canManageParticipants = isOwner;
final children = <Widget>[
ShareSectionTitle(
- StringsLocalizations.of(
- context,
- ).shareWithPeopleSectionTitle(numberOfPeople: _sharees.length),
+ context.strings.shareWithPeopleSectionTitle(
+ numberOfPeople: _sharees.length,
+ ),
),
EmailItemWidget(_collection, onTap: _navigateToManageUser),
];
@@ -114,7 +114,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
children.addAll([
if (_sharees.isNotEmpty) const SizedBox(height: Spacing.sm),
ShareMenuItem(
- title: StringsLocalizations.of(context).addAdmin,
+ title: context.strings.addAdmin,
icon: HugeIcons.strokeRoundedCrown,
showChevron: true,
onTap: () async {
@@ -130,7 +130,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
),
const SizedBox(height: Spacing.sm),
ShareMenuItem(
- title: StringsLocalizations.of(context).addCollaborator,
+ title: context.strings.addCollaborator,
icon: HugeIcons.strokeRoundedUserGroup,
showChevron: true,
onTap: () async {
@@ -149,7 +149,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
),
const SizedBox(height: Spacing.sm),
ShareMenuItem(
- title: StringsLocalizations.of(context).addViewer,
+ title: context.strings.addViewer,
icon: HugeIcons.strokeRoundedView,
showChevron: true,
onTap: () async {
@@ -165,7 +165,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
),
if (_sharees.isEmpty && !hasUrl)
ShareSectionDescription(
- StringsLocalizations.of(context).sharedAlbumSectionDescription,
+ context.strings.sharedAlbumSectionDescription,
),
]);
}
@@ -175,8 +175,8 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
const SizedBox(height: Spacing.xxl),
ShareSectionTitle(
hasUrl
- ? StringsLocalizations.of(context).publicLinkEnabled
- : StringsLocalizations.of(context).shareALink,
+ ? context.strings.publicLinkEnabled
+ : context.strings.shareALink,
),
]);
if (hasUrl) {
@@ -186,7 +186,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
sendLinkButtonKey: sendLinkButtonKey,
additionalItems: [
ShareMenuItem(
- title: StringsLocalizations.of(context).manageLink,
+ title: context.strings.manageLink,
icon: HugeIcons.strokeRoundedSetting07,
showChevron: true,
onTap: () async {
@@ -206,8 +206,8 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
} else {
children.addAll([
ShareMenuItem(
- title: StringsLocalizations.of(context).createPublicLink,
- subtitle: StringsLocalizations.of(context).shareWithNonenteUsers,
+ title: context.strings.createPublicLink,
+ subtitle: context.strings.shareWithNonenteUsers,
icon: HugeIcons.strokeRoundedLink04,
showChevron: true,
showOnlyLoadingState: true,
@@ -222,12 +222,10 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
},
),
const SizedBox(height: Spacing.xxl),
- ShareSectionTitle(StringsLocalizations.of(context).collectPhotos),
+ ShareSectionTitle(context.strings.collectPhotos),
ShareMenuItem(
- title: StringsLocalizations.of(context).createCollaborativeLink,
- subtitle: StringsLocalizations.of(
- context,
- ).collabLinkSectionDescription,
+ title: context.strings.createCollaborativeLink,
+ subtitle: context.strings.collabLinkSectionDescription,
icon: HugeIcons.strokeRoundedUserGroup,
showChevron: true,
showOnlyLoadingState: true,
@@ -283,10 +281,10 @@ class EmailItemWidget extends StatelessWidget {
final limit = total > 2 ? 1 : 2;
return ShareMenuItem(
- title: StringsLocalizations.of(context).manageParticipants,
- subtitle: StringsLocalizations.of(
- context,
- ).albumParticipantsCount(count: sharees.length + 1),
+ title: context.strings.manageParticipants,
+ subtitle: context.strings.albumParticipantsCount(
+ count: sharees.length + 1,
+ ),
leading: SizedBox(
height: avatarSize,
child: AlbumSharesIcons(
diff --git a/mobile/apps/photos/lib/ui/sharing/verify_identity_dialog.dart b/mobile/apps/photos/lib/ui/sharing/verify_identity_dialog.dart
index 2863f5b4e0..b255f4fc73 100644
--- a/mobile/apps/photos/lib/ui/sharing/verify_identity_dialog.dart
+++ b/mobile/apps/photos/lib/ui/sharing/verify_identity_dialog.dart
@@ -23,7 +23,7 @@ Future<void> showVerifyIdentitySheet(
}) {
return showBaseBottomSheet<void>(
context,
- title: title ?? StringsLocalizations.of(context).verify,
+ title: title ?? context.strings.verify,
headerSpacing: 20,
child: _VerifyIdentitySheetContent(self: self, email: email),
);
@@ -53,15 +53,11 @@ class _VerifyIdentitySheetContentState
@override
Widget build(BuildContext context) {
final String subTitle = widget.self
- ? StringsLocalizations.of(context).thisIsYourVerificationId
- : StringsLocalizations.of(
- context,
- ).thisIsPersonVerificationId(email: widget.email);
+ ? context.strings.thisIsYourVerificationId
+ : context.strings.thisIsPersonVerificationId(email: widget.email);
final String bottomText = widget.self
- ? StringsLocalizations.of(
- context,
- ).someoneSharingAlbumsWithYouShouldSeeTheSameId
- : StringsLocalizations.of(context).howToViewShareeVerificationID;
+ ? context.strings.someoneSharingAlbumsWithYouShouldSeeTheSameId
+ : context.strings.howToViewShareeVerificationID;
final colorScheme = getEnteColorScheme(context);
final textStyle = getEnteTextTheme(context);
@@ -76,21 +72,17 @@ class _VerifyIdentitySheetContentState
mainAxisSize: MainAxisSize.min,
children: [
Text(
- StringsLocalizations.of(
- context,
- ).emailNoEnteAccountPhotos(email: widget.email),
+ context.strings.emailNoEnteAccountPhotos(email: widget.email),
style: textStyle.small.copyWith(color: colorScheme.textMuted),
),
const SizedBox(height: 20),
ButtonWidget(
buttonType: ButtonType.neutral,
icon: Icons.adaptive.share,
- labelText: StringsLocalizations.of(context).sendInvite,
+ labelText: context.strings.sendInvite,
onTap: () async {
await shareText(
- StringsLocalizations.of(
- context,
- ).shareTextRecommendUsingEnteForPhotos,
+ context.strings.shareTextRecommendUsingEnteForPhotos,
);
},
),
@@ -120,7 +112,7 @@ class _VerifyIdentitySheetContentState
"VerificationID",
).severe("failed to end userID", snapshot.error);
return Text(
- StringsLocalizations.of(context).somethingWentWrong,
+ context.strings.somethingWentWrong,
style: textStyle.bodyMuted,
);
}
@@ -182,12 +174,10 @@ class _VerifyIdentitySheetContentState
if (!context.mounted) return;
await shareText(
widget.self
- ? StringsLocalizations.of(
- context,
- ).shareMyVerificationID(verificationID: verificationID)
- : StringsLocalizations.of(
- context,
- ).shareTextConfirmOthersVerificationID(
+ ? context.strings.shareMyVerificationID(
+ verificationID: verificationID,
+ )
+ : context.strings.shareTextConfirmOthersVerificationID(
verificationID: verificationID,
),
);
diff --git a/mobile/apps/photos/lib/ui/social/comment_likes_bottom_sheet.dart b/mobile/apps/photos/lib/ui/social/comment_likes_bottom_sheet.dart
index 85a585ab71..6568fdd340 100644
--- a/mobile/apps/photos/lib/ui/social/comment_likes_bottom_sheet.dart
+++ b/mobile/apps/photos/lib/ui/social/comment_likes_bottom_sheet.dart
@@ -106,7 +106,7 @@ class _CommentLikesBottomSheetState extends State<CommentLikesBottomSheet> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
final mediaQuery = MediaQuery.of(context);
diff --git a/mobile/apps/photos/lib/ui/social/comments_screen.dart b/mobile/apps/photos/lib/ui/social/comments_screen.dart
index 2dafc9eb0f..ee0897d94d 100644
--- a/mobile/apps/photos/lib/ui/social/comments_screen.dart
+++ b/mobile/apps/photos/lib/ui/social/comments_screen.dart
@@ -751,7 +751,7 @@ class _FileCommentsBottomSheetState extends State<FileCommentsBottomSheet> {
}
Widget _buildHeader(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final textTheme = getEnteTextTheme(context);
return SingleChildScrollView(
controller: widget.dragController,
diff --git a/mobile/apps/photos/lib/ui/social/feed_screen.dart b/mobile/apps/photos/lib/ui/social/feed_screen.dart
index 1314d994b5..a91631f7eb 100644
--- a/mobile/apps/photos/lib/ui/social/feed_screen.dart
+++ b/mobile/apps/photos/lib/ui/social/feed_screen.dart
@@ -564,7 +564,7 @@ class _FeedScreenState extends State<FeedScreen> {
)
: null,
title: Text(
- StringsLocalizations.of(context).feed,
+ context.strings.feed,
style: widget.showBackButton
? TextStyles.display3.copyWith(color: textTheme.h4Bold.color)
: TextStyles.display1.copyWith(color: textTheme.h4Bold.color),
diff --git a/mobile/apps/photos/lib/ui/social/like_collection_selector_sheet.dart b/mobile/apps/photos/lib/ui/social/like_collection_selector_sheet.dart
index 01c1187ccb..90b3d20411 100644
--- a/mobile/apps/photos/lib/ui/social/like_collection_selector_sheet.dart
+++ b/mobile/apps/photos/lib/ui/social/like_collection_selector_sheet.dart
@@ -140,10 +140,7 @@ class _LikeCollectionSelectorSheetState
if (mounted) {
setState(() => state.isLiked = previousState);
if (flagService.internalUser || kDebugMode) {
- showShortToast(
- context,
- StringsLocalizations.of(context).failedToUpdateLike,
- );
+ showShortToast(context, context.strings.failedToUpdateLike);
}
}
}
@@ -196,9 +193,7 @@ class _LikeCollectionSelectorSheetState
});
showShortToast(
context,
- StringsLocalizations.of(
- context,
- ).failedToLikeAlbums(count: failed.length),
+ context.strings.failedToLikeAlbums(count: failed.length),
);
// Don't close sheet - let user retry
return;
@@ -311,7 +306,7 @@ class _LikeCollectionSelectorSheetState
}
Widget _buildErrorState() {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final textTheme = getEnteTextTheme(context);
return Padding(
@@ -338,7 +333,7 @@ class _AlbumsHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final textTheme = getEnteTextTheme(context);
final colorScheme = getEnteColorScheme(context);
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
@@ -386,7 +381,7 @@ class _TitleSection extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final textTheme = getEnteTextTheme(context);
final colorScheme = getEnteColorScheme(context);
diff --git a/mobile/apps/photos/lib/ui/social/likes_bottom_sheet.dart b/mobile/apps/photos/lib/ui/social/likes_bottom_sheet.dart
index e8274e31c6..2b961a70c2 100644
--- a/mobile/apps/photos/lib/ui/social/likes_bottom_sheet.dart
+++ b/mobile/apps/photos/lib/ui/social/likes_bottom_sheet.dart
@@ -286,7 +286,7 @@ class _LikesHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final textTheme = getEnteTextTheme(context);
return Padding(
@@ -322,7 +322,7 @@ class _EmptyState extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final textTheme = getEnteTextTheme(context);
return Padding(
@@ -341,7 +341,7 @@ class _ErrorState extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final textTheme = getEnteTextTheme(context);
return Padding(
@@ -391,7 +391,7 @@ class _LikesList extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return ListView.builder(
shrinkWrap: likes.length <= _shrinkWrapThreshold,
diff --git a/mobile/apps/photos/lib/ui/social/widgets/comment_actions_popup.dart b/mobile/apps/photos/lib/ui/social/widgets/comment_actions_popup.dart
index 519a1bb7da..e322eaed10 100644
--- a/mobile/apps/photos/lib/ui/social/widgets/comment_actions_popup.dart
+++ b/mobile/apps/photos/lib/ui/social/widgets/comment_actions_popup.dart
@@ -21,7 +21,7 @@ class CommentActionsPopup extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
diff --git a/mobile/apps/photos/lib/ui/social/widgets/comment_bubble_widget.dart b/mobile/apps/photos/lib/ui/social/widgets/comment_bubble_widget.dart
index 95085a9bf6..f334e86882 100644
--- a/mobile/apps/photos/lib/ui/social/widgets/comment_bubble_widget.dart
+++ b/mobile/apps/photos/lib/ui/social/widgets/comment_bubble_widget.dart
@@ -230,10 +230,7 @@ class _CommentBubbleWidgetState extends State<CommentBubbleWidget>
_isLiked = previousState;
_optimisticLikeDelta = previousDelta;
});
- showShortToast(
- context,
- StringsLocalizations.of(context).failedToLikeComment,
- );
+ showShortToast(context, context.strings.failedToLikeComment);
}
return;
}
@@ -327,10 +324,7 @@ class _CommentBubbleWidgetState extends State<CommentBubbleWidget>
} catch (e) {
_logger.severe("Failed to delete comment", e);
if (mounted) {
- showShortToast(
- context,
- StringsLocalizations.of(context).failedToDeleteComment,
- );
+ showShortToast(context, context.strings.failedToDeleteComment);
}
}
}
@@ -627,7 +621,7 @@ class _InlineParentQuote extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final textTheme = getEnteTextTheme(context);
if (isLoading) {
diff --git a/mobile/apps/photos/lib/ui/social/widgets/comment_input_widget.dart b/mobile/apps/photos/lib/ui/social/widgets/comment_input_widget.dart
index dcf70aeba5..7d98eae4ae 100644
--- a/mobile/apps/photos/lib/ui/social/widgets/comment_input_widget.dart
+++ b/mobile/apps/photos/lib/ui/social/widgets/comment_input_widget.dart
@@ -86,7 +86,7 @@ class _CommentInputWidgetState extends State<CommentInputWidget>
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final colorScheme = getEnteColorScheme(context);
final componentColors = context.componentColors;
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
diff --git a/mobile/apps/photos/lib/ui/social/widgets/delete_comment_confirmation_dialog.dart b/mobile/apps/photos/lib/ui/social/widgets/delete_comment_confirmation_dialog.dart
index 867a75f14d..4bc4a89e0f 100644
--- a/mobile/apps/photos/lib/ui/social/widgets/delete_comment_confirmation_dialog.dart
+++ b/mobile/apps/photos/lib/ui/social/widgets/delete_comment_confirmation_dialog.dart
@@ -32,7 +32,7 @@ class _DeleteCommentConfirmationSheet extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final textTheme = getEnteTextTheme(context);
final colorScheme = getEnteColorScheme(context);
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
diff --git a/mobile/apps/photos/lib/ui/social/widgets/feed_empty_state.dart b/mobile/apps/photos/lib/ui/social/widgets/feed_empty_state.dart
index 0b3114bf5f..569234cf02 100644
--- a/mobile/apps/photos/lib/ui/social/widgets/feed_empty_state.dart
+++ b/mobile/apps/photos/lib/ui/social/widgets/feed_empty_state.dart
@@ -20,7 +20,7 @@ class FeedEmptyState extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colors = context.componentColors;
- final strings = StringsLocalizations.of(context);
+ final strings = context.strings;
final bottomPadding = 64 + MediaQuery.paddingOf(context).bottom + 32;
final content = _content(context, strings);
diff --git a/mobile/apps/photos/lib/ui/social/widgets/feed_item_widget.dart b/mobile/apps/photos/lib/ui/social/widgets/feed_item_widget.dart
index e0f9e71602..40f32fb5b4 100644
--- a/mobile/apps/photos/lib/ui/social/widgets/feed_item_widget.dart
+++ b/mobile/apps/photos/lib/ui/social/widgets/feed_item_widget.dart
@@ -576,8 +576,8 @@ class _FeedTextContent extends StatelessWidget {
// Multiple users: "Username and X others"
final othersCount = feedItem.additionalActorCount;
final othersText = othersCount == 1
- ? StringsLocalizations.of(context).and1Other
- : StringsLocalizations.of(context).andXOthers(count: othersCount);
+ ? context.strings.and1Other
+ : context.strings.andXOthers(count: othersCount);
return Text.rich(
TextSpan(
@@ -607,7 +607,7 @@ class _FeedTextContent extends StatelessWidget {
BuildContext context,
TextStyle baseStyle,
) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final isOwn = feedItem.isOwnedByCurrentUser;
switch (feedItem.type) {
case FeedItemType.photoLike:
@@ -655,7 +655,7 @@ class _FeedTextContent extends StatelessWidget {
BuildContext context,
TextStyle baseStyle,
) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final count = feedItem.sharedFileCount;
final albumName = feedItem.collectionName ?? l10n.albums;
diff --git a/mobile/apps/photos/lib/ui/social/widgets/file_social_overlay.dart b/mobile/apps/photos/lib/ui/social/widgets/file_social_overlay.dart
index 248696fe35..c8796cd7d5 100644
--- a/mobile/apps/photos/lib/ui/social/widgets/file_social_overlay.dart
+++ b/mobile/apps/photos/lib/ui/social/widgets/file_social_overlay.dart
@@ -330,10 +330,7 @@ class _FileSocialOverlayState extends State<FileSocialOverlay> {
void _showFailedToUpdateLikeToast() {
if (flagService.internalUser || kDebugMode) {
- showShortToast(
- context,
- StringsLocalizations.of(context).failedToUpdateLike,
- );
+ showShortToast(context, context.strings.failedToUpdateLike);
}
}
@@ -470,7 +467,7 @@ class _FileSocialOverlayState extends State<FileSocialOverlay> {
mainAxisSize: MainAxisSize.min,
children: [
Tooltip(
- message: StringsLocalizations.of(context).like,
+ message: context.strings.like,
child: GestureDetector(
onLongPress: _showLikes,
child: SizedBox.square(
@@ -493,7 +490,7 @@ class _FileSocialOverlayState extends State<FileSocialOverlay> {
),
const SizedBox(height: 10),
Tooltip(
- message: StringsLocalizations.of(context).comments,
+ message: context.strings.comments,
child: SizedBox.square(
dimension: _socialControlsSize,
child: IconButton(
diff --git a/mobile/apps/photos/lib/ui/social/widgets/reply_preview_widget.dart b/mobile/apps/photos/lib/ui/social/widgets/reply_preview_widget.dart
index ff14737e46..dd7f75b59e 100644
--- a/mobile/apps/photos/lib/ui/social/widgets/reply_preview_widget.dart
+++ b/mobile/apps/photos/lib/ui/social/widgets/reply_preview_widget.dart
@@ -21,7 +21,7 @@ class ReplyPreviewWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
diff --git a/mobile/apps/photos/lib/ui/tabs/albums/albums_manage_sheet.dart b/mobile/apps/photos/lib/ui/tabs/albums/albums_manage_sheet.dart
index 4b95974a96..adaa79daf2 100644
--- a/mobile/apps/photos/lib/ui/tabs/albums/albums_manage_sheet.dart
+++ b/mobile/apps/photos/lib/ui/tabs/albums/albums_manage_sheet.dart
@@ -18,7 +18,7 @@ import "package:photos/ui/viewer/gallery/trash_page.dart";
import "package:photos/ui/viewer/gallery/uncategorized_page.dart";
Future<void> showAlbumsManageSheet(BuildContext context) {
- final strings = StringsLocalizations.of(context);
+ final strings = context.strings;
return showBottomSheetComponent<void>(
context: context,
builder: (sheetContext) {
diff --git a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_device_empty_state.dart b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_device_empty_state.dart
index bdd9b25881..a57a1baa83 100644
--- a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_device_empty_state.dart
+++ b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_device_empty_state.dart
@@ -30,7 +30,7 @@ class OnDeviceEmptyState extends StatelessWidget {
Widget _buildPermissionState(BuildContext context) {
final colors = context.componentColors;
- final strings = StringsLocalizations.of(context);
+ final strings = context.strings;
final bottomPadding = 64 + MediaQuery.paddingOf(context).bottom + 32;
final features = [
strings.albumsOnDevicePermissionFeatureAllowAccessFaceRecognition,
@@ -92,7 +92,7 @@ class OnDeviceEmptyState extends StatelessWidget {
Widget _buildNoFoldersState(BuildContext context) {
final colors = context.componentColors;
- final strings = StringsLocalizations.of(context);
+ final strings = context.strings;
final bottomPadding = 64 + MediaQuery.paddingOf(context).bottom + 32;
return Padding(
diff --git a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_ente_empty_state.dart b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_ente_empty_state.dart
index 3bde419b65..7a574bbaef 100644
--- a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_ente_empty_state.dart
+++ b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_ente_empty_state.dart
@@ -15,7 +15,7 @@ class OnEnteEmptyState extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colors = context.componentColors;
- final strings = StringsLocalizations.of(context);
+ final strings = context.strings;
final bottomPadding = 64 + MediaQuery.paddingOf(context).bottom + 32;
final features = [
strings.albumsOnEnteEmptyFeatureAccessAnyDevice,
diff --git a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/received_empty_state.dart b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/received_empty_state.dart
index b67bcb0094..fe4d7e031b 100644
--- a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/received_empty_state.dart
+++ b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/received_empty_state.dart
@@ -14,7 +14,7 @@ class ReceivedEmptyState extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colors = context.componentColors;
- final strings = StringsLocalizations.of(context);
+ final strings = context.strings;
final bottomPadding = 64 + MediaQuery.paddingOf(context).bottom + 32;
final features = [
strings.albumsReceivedEmptyFeatureSharedByOthers,
diff --git a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/shared_empty_state.dart b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/shared_empty_state.dart
index 752adb7ae6..3622a5886a 100644
--- a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/shared_empty_state.dart
+++ b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/shared_empty_state.dart
@@ -16,7 +16,7 @@ class SharedEmptyState extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colors = context.componentColors;
- final strings = StringsLocalizations.of(context);
+ final strings = context.strings;
final bottomPadding = 64 + MediaQuery.paddingOf(context).bottom + 32;
final features = [
strings.albumsSharedEmptyFeatureShareLovedOnes,
diff --git a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart b/mobile/apps/photos/lib/ui/tabs/albums_tab.dart
index 9d09b81991..639c4fc8de 100644
--- a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart
+++ b/mobile/apps/photos/lib/ui/tabs/albums_tab.dart
@@ -644,7 +644,7 @@ class _AlbumsTabState extends State<AlbumsTab>
List<EntePopupMenuOption<_AlbumsMenuAction>> _buildAlbumsMenuOptions() {
final colorScheme = getEnteColorScheme(context);
- final strings = StringsLocalizations.of(context);
+ final strings = context.strings;
final isListView = _viewType.value == AlbumViewType.list;
final showSortActions = !_hasSearchQuery;
final currentSortKey = _sortKey.value;
@@ -760,7 +760,7 @@ class _AlbumsTabState extends State<AlbumsTab>
super.build(context);
final componentColors = context.componentColors;
final textTheme = getEnteTextTheme(context);
- final strings = StringsLocalizations.of(context);
+ final strings = context.strings;
final selectedAlbums = widget.selectedAlbums;
final localGalleryMode = _isLocalGalleryMode;
final albumsOptionsButton = Builder(
diff --git a/mobile/apps/photos/lib/ui/tabs/home_widget.dart b/mobile/apps/photos/lib/ui/tabs/home_widget.dart
index 3a1d2c805b..f5c3870a96 100644
--- a/mobile/apps/photos/lib/ui/tabs/home_widget.dart
+++ b/mobile/apps/photos/lib/ui/tabs/home_widget.dart
@@ -411,8 +411,8 @@ class _HomeWidgetState extends State<HomeWidget> {
if (publicUrl.passwordEnabled) {
await showTextInputDialog(
context,
- title: StringsLocalizations.of(context).enterPassword,
- submitButtonLabel: StringsLocalizations.of(context).ok,
+ title: context.strings.enterPassword,
+ submitButtonLabel: context.strings.ok,
alwaysShowSuccessState: false,
popnavAfterSubmission: false,
onSubmit: (String text) async {
@@ -513,12 +513,12 @@ class _HomeWidgetState extends State<HomeWidget> {
Future<void> _autoLogoutAlert() async {
final AlertDialog alert = AlertDialog(
- title: Text(StringsLocalizations.of(context).sessionExpired),
- content: Text(StringsLocalizations.of(context).pleaseLoginAgain),
+ title: Text(context.strings.sessionExpired),
+ content: Text(context.strings.pleaseLoginAgain),
actions: [
TextButton(
child: Text(
- StringsLocalizations.of(context).ok,
+ context.strings.ok,
style: TextStyle(
color: Theme.of(context).colorScheme.greenAlternative,
),
@@ -528,7 +528,7 @@ class _HomeWidgetState extends State<HomeWidget> {
Navigator.of(context).popUntil((route) => route.isFirst);
final dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).loggingOut,
+ context.strings.loggingOut,
);
await dialog.show();
await Configuration.instance.logout();
@@ -626,7 +626,7 @@ class _HomeWidgetState extends State<HomeWidget> {
actions: [
const SizedBox(height: 24),
ButtonWidget(
- labelText: StringsLocalizations.of(context).openFile,
+ labelText: context.strings.openFile,
buttonType: ButtonType.primary,
onTap: () async {
Navigator.of(context).pop(true);
@@ -635,7 +635,7 @@ class _HomeWidgetState extends State<HomeWidget> {
const SizedBox(height: 12),
ButtonWidget(
buttonType: ButtonType.secondary,
- labelText: StringsLocalizations.of(context).backupFile,
+ labelText: context.strings.backupFile,
onTap: () async {
Navigator.of(context).pop(false);
},
diff --git a/mobile/apps/photos/lib/ui/tabs/section_title.dart b/mobile/apps/photos/lib/ui/tabs/section_title.dart
index 5a8e48d6c1..faee1e4df1 100644
--- a/mobile/apps/photos/lib/ui/tabs/section_title.dart
+++ b/mobile/apps/photos/lib/ui/tabs/section_title.dart
@@ -92,7 +92,7 @@ Widget getOnEnteSection(BuildContext context) {
);
return StyledText(
- text: StringsLocalizations.of(context).onEnte,
+ text: context.strings.onEnte,
style: style,
tags: {'branding': StyledTextTag(style: style)},
);
diff --git a/mobile/apps/photos/lib/ui/tabs/shared/all_links_page.dart b/mobile/apps/photos/lib/ui/tabs/shared/all_links_page.dart
index 88eee45a0b..eeaf3f5953 100644
--- a/mobile/apps/photos/lib/ui/tabs/shared/all_links_page.dart
+++ b/mobile/apps/photos/lib/ui/tabs/shared/all_links_page.dart
@@ -91,20 +91,20 @@ class _AllLinksPageState extends State<AllLinksPage> {
if (!_hasSelection) {
await showErrorDialog(
context,
- StringsLocalizations.of(context).deleteLinkQuestion,
- StringsLocalizations.of(context).pleaseSelectQuickLinksToRemove,
+ context.strings.deleteLinkQuestion,
+ context.strings.pleaseSelectQuickLinksToRemove,
);
return;
}
final result = await showAlertBottomSheet<ButtonResult>(
context,
- title: StringsLocalizations.of(context).removePublicLinks,
- message: StringsLocalizations.of(context).deleteMemoryLinkMessage,
+ title: context.strings.removePublicLinks,
+ message: context.strings.deleteMemoryLinkMessage,
assetPath: "assets/warning-grey.png",
buttons: [
ButtonWidgetV2(
buttonType: ButtonTypeV2.critical,
- labelText: StringsLocalizations.of(context).remove,
+ labelText: context.strings.remove,
isInAlert: true,
buttonAction: ButtonAction.first,
onTap: _deleteSelectedLinks,
@@ -144,7 +144,7 @@ class _AllLinksPageState extends State<AllLinksPage> {
Future<void> _openMemoryLink(MemoryShare share) async {
final title =
MemoryShareService.instance.getMemoryShareTitle(share) ??
- StringsLocalizations.of(context).memoryLink;
+ context.strings.memoryLink;
final deleted = await showMemoryLinkDetailsSheet(
context,
shareUrl: share.url,
@@ -167,8 +167,8 @@ class _AllLinksPageState extends State<AllLinksPage> {
return Scaffold(
backgroundColor: colors.backgroundBase,
body: AppBarComponent(
- title: StringsLocalizations.of(context).links,
- subtitle: StringsLocalizations.of(context).itemCount(count: linksCount),
+ title: context.strings.links,
+ subtitle: context.strings.itemCount(count: linksCount),
physics: const BouncingScrollPhysics(),
actions: [
AnimatedSwitcher(
@@ -224,7 +224,7 @@ class _AllLinksPageState extends State<AllLinksPage> {
final share = item as MemoryShare;
final title =
MemoryShareService.instance.getMemoryShareTitle(share) ??
- StringsLocalizations.of(context).memoryLink;
+ context.strings.memoryLink;
return MemoryLinkAlbumItem(
title: title,
fileCount: share.fileCount,
@@ -250,9 +250,7 @@ class _AllLinksPageState extends State<AllLinksPage> {
hasScrollBody: false,
child: EmptyStateComponent(
assetPath: "assets/empty_state_links.png",
- title: StringsLocalizations.of(
- context,
- ).activeLinksWillShowUpHere,
+ title: context.strings.activeLinksWillShowUpHere,
),
),
],
diff --git a/mobile/apps/photos/lib/ui/tabs/shared/memory_link_item.dart b/mobile/apps/photos/lib/ui/tabs/shared/memory_link_item.dart
index 7f8404d69a..3f5265ae84 100644
--- a/mobile/apps/photos/lib/ui/tabs/shared/memory_link_item.dart
+++ b/mobile/apps/photos/lib/ui/tabs/shared/memory_link_item.dart
@@ -126,9 +126,7 @@ class MemoryLinkAlbumItem extends StatelessWidget {
),
const SizedBox(height: 4),
Text(
- StringsLocalizations.of(
- context,
- ).itemCount(count: fileCount ?? 0),
+ context.strings.itemCount(count: fileCount ?? 0),
style: TextStyles.mini.copyWith(
color: colors.textLight,
),
diff --git a/mobile/apps/photos/lib/ui/tabs/shared/quick_link_album_item.dart b/mobile/apps/photos/lib/ui/tabs/shared/quick_link_album_item.dart
index 391c0e1ae2..32e3614fa6 100644
--- a/mobile/apps/photos/lib/ui/tabs/shared/quick_link_album_item.dart
+++ b/mobile/apps/photos/lib/ui/tabs/shared/quick_link_album_item.dart
@@ -113,9 +113,7 @@ class QuickLinkAlbumItem extends StatelessWidget {
builder: (context, snapshot) {
if (snapshot.hasData) {
return Text(
- StringsLocalizations.of(
- context,
- ).itemCount(count: snapshot.data!),
+ context.strings.itemCount(count: snapshot.data!),
style: TextStyles.mini.copyWith(
color: colors.textLight,
),
diff --git a/mobile/apps/photos/lib/ui/tools/collage/collage_app_bar.dart b/mobile/apps/photos/lib/ui/tools/collage/collage_app_bar.dart
index 67041c2678..d058cb6fbd 100644
--- a/mobile/apps/photos/lib/ui/tools/collage/collage_app_bar.dart
+++ b/mobile/apps/photos/lib/ui/tools/collage/collage_app_bar.dart
@@ -28,15 +28,12 @@ class CollageAppBar extends StatelessWidget implements PreferredSizeWidget {
children: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
- child: Text(
- StringsLocalizations.of(context).cancel,
- style: textTheme.body,
- ),
+ child: Text(context.strings.cancel, style: textTheme.body),
),
TextButton(
onPressed: isSaveEnabled ? onSave : null,
child: Text(
- StringsLocalizations.of(context).saveCollage,
+ context.strings.saveCollage,
style: textTheme.body.copyWith(
color: isSaveEnabled
? colorScheme.primary500
diff --git a/mobile/apps/photos/lib/ui/tools/collage/collage_common_widgets.dart b/mobile/apps/photos/lib/ui/tools/collage/collage_common_widgets.dart
index cd083bd203..60d324d4f3 100644
--- a/mobile/apps/photos/lib/ui/tools/collage/collage_common_widgets.dart
+++ b/mobile/apps/photos/lib/ui/tools/collage/collage_common_widgets.dart
@@ -12,7 +12,7 @@ class CollageLayoutHeading extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.fromLTRB(8, 20, 0, 4),
child: Text(
- StringsLocalizations.of(context).collageLayout,
+ context.strings.collageLayout,
style: TextStyle(color: getEnteColorScheme(context).textBase),
),
),
diff --git a/mobile/apps/photos/lib/ui/tools/collage/collage_creator_page.dart b/mobile/apps/photos/lib/ui/tools/collage/collage_creator_page.dart
index 06c8bdeb1d..65d5268b85 100644
--- a/mobile/apps/photos/lib/ui/tools/collage/collage_creator_page.dart
+++ b/mobile/apps/photos/lib/ui/tools/collage/collage_creator_page.dart
@@ -83,7 +83,7 @@ class _CollageCreatorPageState extends State<CollageCreatorPage> {
final newFile = fileFromAsset("ente Collages", newAsset);
SyncService.instance.sync().ignore();
if (!mounted) return;
- showShortToast(context, StringsLocalizations.of(context).collageSaved);
+ showShortToast(context, context.strings.collageSaved);
replacePage(
context,
DetailPage(DetailPageConfiguration([newFile], 0, "collage")),
@@ -92,10 +92,7 @@ class _CollageCreatorPageState extends State<CollageCreatorPage> {
} catch (e, s) {
_logger.severe("Failed to create collage", e, s);
if (!mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
} finally {
if (mounted) {
setState(() {
diff --git a/mobile/apps/photos/lib/ui/tools/debug/app_storage_viewer.dart b/mobile/apps/photos/lib/ui/tools/debug/app_storage_viewer.dart
index 9c32b31b20..2a87715953 100644
--- a/mobile/apps/photos/lib/ui/tools/debug/app_storage_viewer.dart
+++ b/mobile/apps/photos/lib/ui/tools/debug/app_storage_viewer.dart
@@ -57,28 +57,25 @@ class _AppStorageViewerState extends State<AppStorageViewer> {
paths.addAll([
PathStorageItem.name(
imageCachePath,
- StringsLocalizations.of(context).remoteImages,
+ context.strings.remoteImages,
allowCacheClear: true,
),
PathStorageItem.name(
videoCachePath,
- StringsLocalizations.of(context).remoteVideos,
+ context.strings.remoteVideos,
allowCacheClear: true,
),
PathStorageItem.name(
cacheDirectory,
- StringsLocalizations.of(context).remoteThumbnails,
+ context.strings.remoteThumbnails,
allowCacheClear: true,
),
- PathStorageItem.name(
- tempDownload,
- StringsLocalizations.of(context).pendingSync,
- ),
+ PathStorageItem.name(tempDownload, context.strings.pendingSync),
PathStorageItem.name(
Platform.isAndroid
? androidGlideCacheDirectory
: iOSPhotoManagerInAppCacheDirectory,
- StringsLocalizations.of(context).localGallery,
+ context.strings.localGallery,
allowCacheClear: true,
),
]);
@@ -130,7 +127,7 @@ class _AppStorageViewerState extends State<AppStorageViewer> {
debugPrint("$runtimeType building");
return SettingsPageScaffold(
- title: StringsLocalizations.of(context).manageDeviceStorage,
+ title: context.strings.manageDeviceStorage,
children: [
Padding(
padding: const EdgeInsets.only(
@@ -141,7 +138,7 @@ class _AppStorageViewerState extends State<AppStorageViewer> {
child: Align(
alignment: Alignment.centerLeft,
child: Text(
- StringsLocalizations.of(context).cachedData,
+ context.strings.cachedData,
style: TextStyles.mini.copyWith(
color: context.componentColors.textLight,
),
@@ -160,7 +157,7 @@ class _AppStorageViewerState extends State<AppStorageViewer> {
),
const SizedBox(height: Spacing.xl),
ButtonComponent(
- label: StringsLocalizations.of(context).clearCaches,
+ label: context.strings.clearCaches,
variant: ButtonComponentVariant.neutral,
onTap: () async {
for (var pathItem in paths) {
diff --git a/mobile/apps/photos/lib/ui/tools/debug/log_file_viewer.dart b/mobile/apps/photos/lib/ui/tools/debug/log_file_viewer.dart
index d7ca4a3bea..7318d96ca1 100644
--- a/mobile/apps/photos/lib/ui/tools/debug/log_file_viewer.dart
+++ b/mobile/apps/photos/lib/ui/tools/debug/log_file_viewer.dart
@@ -34,10 +34,7 @@ class _LogFileViewerState extends State<LogFileViewer> {
@override
Widget build(BuildContext context) {
return Scaffold(
- appBar: AppBar(
- elevation: 0,
- title: Text(StringsLocalizations.of(context).todaysLogs),
- ),
+ appBar: AppBar(elevation: 0, title: Text(context.strings.todaysLogs)),
body: FutureBuilder<List<String>>(
future: _logsFuture,
builder: (context, snapshot) {
diff --git a/mobile/apps/photos/lib/ui/tools/debug/path_storage_viewer.dart b/mobile/apps/photos/lib/ui/tools/debug/path_storage_viewer.dart
index 6557d6387f..84679fc99d 100644
--- a/mobile/apps/photos/lib/ui/tools/debug/path_storage_viewer.dart
+++ b/mobile/apps/photos/lib/ui/tools/debug/path_storage_viewer.dart
@@ -114,7 +114,7 @@ class _PathStorageViewerState extends State<PathStorageViewer> {
}
},
onLongPress: () async {
- if (widget.item.title == StringsLocalizations.of(context).pendingSync) {
+ if (widget.item.title == context.strings.pendingSync) {
await Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const PendingSyncInfoScreen(),
diff --git a/mobile/apps/photos/lib/ui/tools/deduplicate_page.dart b/mobile/apps/photos/lib/ui/tools/deduplicate_page.dart
index 4aa0332d18..0c697b9d6a 100644
--- a/mobile/apps/photos/lib/ui/tools/deduplicate_page.dart
+++ b/mobile/apps/photos/lib/ui/tools/deduplicate_page.dart
@@ -69,7 +69,7 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
return Scaffold(
appBar: AppBar(
elevation: 0,
- title: Text(StringsLocalizations.of(context).deduplicateFiles),
+ title: Text(context.strings.deduplicateFiles),
actions: _duplicates.isNotEmpty ? [_getSortMenu()] : null,
),
body: _getBody(),
@@ -146,10 +146,10 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
String text = key.toString();
switch (key) {
case SortKey.count:
- text = StringsLocalizations.of(context).count;
+ text = context.strings.count;
break;
case SortKey.size:
- text = StringsLocalizations.of(context).totalSize;
+ text = context.strings.totalSize;
break;
}
return Text(text, style: textTheme.miniBold);
@@ -225,7 +225,7 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
width: double.infinity,
child: ButtonWidget(
labelText:
- "${StringsLocalizations.of(context).deleteItemCount(count: fileCount)} (${formatBytes(totalSize)})",
+ "${context.strings.deleteItemCount(count: fileCount)} (${formatBytes(totalSize)})",
buttonType: ButtonType.critical,
onTap: () async {
try {
@@ -245,7 +245,7 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
SizedBox(
width: double.infinity,
child: ButtonWidget(
- labelText: StringsLocalizations.of(context).unselectAll,
+ labelText: context.strings.unselectAll,
buttonType: ButtonType.secondary,
onTap: () async {
setState(() {
@@ -336,7 +336,7 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
- StringsLocalizations.of(context).duplicateItemsGroup(
+ context.strings.duplicateItemsGroup(
count: duplicates.files.length,
formattedSize: formatBytes(duplicates.size),
),
diff --git a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_app_bar.dart b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_app_bar.dart
index 9add61eb8d..463622404f 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_app_bar.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_app_bar.dart
@@ -43,17 +43,14 @@ class ImageEditorAppBar extends StatelessWidget implements PreferredSizeWidget {
onPressed: () {
enableUndo ? close() : Navigator.of(context).pop();
},
- child: Text(
- StringsLocalizations.of(context).cancel,
- style: actionTextStyle,
- ),
+ child: Text(context.strings.cancel, style: actionTextStyle),
),
if (undo != null && redo != null)
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
IconButton(
- tooltip: StringsLocalizations.of(context).undo,
+ tooltip: context.strings.undo,
onPressed: () {
undo != null ? undo!() : null;
},
@@ -64,7 +61,7 @@ class ImageEditorAppBar extends StatelessWidget implements PreferredSizeWidget {
),
const SizedBox(width: 12),
IconButton(
- tooltip: StringsLocalizations.of(context).redo,
+ tooltip: context.strings.redo,
onPressed: () {
redo != null ? redo!() : null;
},
@@ -83,9 +80,7 @@ class ImageEditorAppBar extends StatelessWidget implements PreferredSizeWidget {
key: ValueKey(isMainEditor ? 'save_copy' : 'done'),
onPressed: done,
child: Text(
- isMainEditor
- ? StringsLocalizations.of(context).saveCopy
- : StringsLocalizations.of(context).done,
+ isMainEditor ? context.strings.saveCopy : context.strings.done,
style: actionTextStyle.copyWith(
color: isMainEditor
? (enableUndo ? colors.primary : colors.textLight)
diff --git a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_crop_rotate.dart b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_crop_rotate.dart
index 55cda798da..bbc4d716d8 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_crop_rotate.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_crop_rotate.dart
@@ -111,7 +111,7 @@ class _ImageEditorCropRotateBarState extends State<ImageEditorCropRotateBar>
children: [
CircularIconButton(
hugeIcon: HugeIcons.strokeRoundedRotateCrop,
- label: StringsLocalizations.of(context).rotate,
+ label: context.strings.rotate,
onTap: () {
widget.editor.rotate();
},
@@ -119,7 +119,7 @@ class _ImageEditorCropRotateBarState extends State<ImageEditorCropRotateBar>
const SizedBox(width: 6),
CircularIconButton(
hugeIcon: HugeIcons.strokeRoundedFlipLeft,
- label: StringsLocalizations.of(context).flip,
+ label: context.strings.flip,
onTap: () {
widget.editor.flip();
},
diff --git a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_main_bottom_bar.dart b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_main_bottom_bar.dart
index 62d9d51a7e..18818df496 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_main_bottom_bar.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_main_bottom_bar.dart
@@ -87,35 +87,35 @@ class ImageEditorMainBottomBarState extends State<ImageEditorMainBottomBar>
children: <Widget>[
CircularIconButton(
hugeIcon: HugeIcons.strokeRoundedCrop,
- label: StringsLocalizations.of(context).crop,
+ label: context.strings.crop,
onTap: () {
widget.editor.openCropRotateEditor();
},
),
CircularIconButton(
hugeIcon: HugeIcons.strokeRoundedFilter,
- label: StringsLocalizations.of(context).filter,
+ label: context.strings.filter,
onTap: () {
widget.editor.openFilterEditor();
},
),
CircularIconButton(
hugeIcon: HugeIcons.strokeRoundedSlidersHorizontal,
- label: StringsLocalizations.of(context).adjust,
+ label: context.strings.adjust,
onTap: () {
widget.editor.openTuneEditor();
},
),
CircularIconButton(
hugeIcon: HugeIcons.strokeRoundedPaintBrush01,
- label: StringsLocalizations.of(context).draw,
+ label: context.strings.draw,
onTap: () {
widget.editor.openPaintEditor();
},
),
CircularIconButton(
hugeIcon: HugeIcons.strokeRoundedSticker,
- label: StringsLocalizations.of(context).sticker,
+ label: context.strings.sticker,
onTap: () {
widget.editor.openEmojiEditor();
},
diff --git a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart
index 87d40ceed8..d4bdf8af09 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart
@@ -89,7 +89,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
}
Future<void> saveImage(ProImageEditorState editorState) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final dialog = createProgressDialog(context, l10n.saving);
await dialog.show();
@@ -186,7 +186,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
}
Future<void> _showExitConfirmationDialog(BuildContext context) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final actionResult = await showActionSheet(
context: context,
title: l10n.discardEditsQuestion,
diff --git a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_paint_bar.dart b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_paint_bar.dart
index 6ca1042834..31ac42b8db 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_paint_bar.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_paint_bar.dart
@@ -60,7 +60,7 @@ class _ImageEditorPaintBarState extends State<ImageEditorPaintBar>
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: Text(
- StringsLocalizations.of(context).brushColor,
+ context.strings.brushColor,
style: TextStyles.large.copyWith(color: colors.textBase),
),
),
diff --git a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_text_bar.dart b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_text_bar.dart
index 8b7888bad6..fde18279a4 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_text_bar.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_text_bar.dart
@@ -71,7 +71,7 @@ class _ImageEditorTextBarState extends State<ImageEditorTextBar>
children: [
CircularIconButton(
hugeIcon: HugeIcons.strokeRoundedTextColor,
- label: StringsLocalizations.of(context).color,
+ label: context.strings.color,
isSelected: selectedActionIndex == 0,
onTap: () {
_selectAction(0);
@@ -79,7 +79,7 @@ class _ImageEditorTextBarState extends State<ImageEditorTextBar>
),
CircularIconButton(
hugeIcon: HugeIcons.strokeRoundedTextFont,
- label: StringsLocalizations.of(context).font,
+ label: context.strings.font,
isSelected: selectedActionIndex == 1,
onTap: () {
_selectAction(1);
@@ -87,7 +87,7 @@ class _ImageEditorTextBarState extends State<ImageEditorTextBar>
),
CircularIconButton(
hugeIcon: HugeIcons.strokeRoundedTextSquare,
- label: StringsLocalizations.of(context).background,
+ label: context.strings.background,
isSelected: selectedActionIndex == 2,
onTap: () {
setState(() {
@@ -97,7 +97,7 @@ class _ImageEditorTextBarState extends State<ImageEditorTextBar>
),
CircularIconButton(
hugeIcon: HugeIcons.strokeRoundedTextAlignLeft,
- label: StringsLocalizations.of(context).align,
+ label: context.strings.align,
isSelected: selectedActionIndex == 3,
onTap: () {
setState(() {
diff --git a/mobile/apps/photos/lib/ui/tools/editor/video_crop_page.dart b/mobile/apps/photos/lib/ui/tools/editor/video_crop_page.dart
index 0c0c75da17..3a1abd02c1 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/video_crop_page.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/video_crop_page.dart
@@ -65,7 +65,7 @@ class _VideoCropPageState extends State<VideoCropPage> {
backgroundColor: colorScheme.backgroundColour,
appBar: VideoEditorAppBar(
onCancel: () => Navigator.pop(context),
- primaryActionLabel: StringsLocalizations.of(context).done,
+ primaryActionLabel: context.strings.done,
onPrimaryAction: () {
widget.controller.applyCacheCrop();
Navigator.pop(context);
diff --git a/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_app_bar.dart b/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_app_bar.dart
index 9899db4a02..056ed6965a 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_app_bar.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_app_bar.dart
@@ -34,10 +34,7 @@ class VideoEditorAppBar extends StatelessWidget implements PreferredSizeWidget {
children: [
TextButton(
onPressed: onCancel,
- child: Text(
- StringsLocalizations.of(context).cancel,
- style: textTheme.body,
- ),
+ child: Text(context.strings.cancel, style: textTheme.body),
),
TextButton(
onPressed: isPrimaryEnabled ? onPrimaryAction : null,
diff --git a/mobile/apps/photos/lib/ui/tools/editor/video_editor_page.dart b/mobile/apps/photos/lib/ui/tools/editor/video_editor_page.dart
index d3689e99e8..45af37a7c4 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/video_editor_page.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/video_editor_page.dart
@@ -155,7 +155,7 @@ class _VideoEditorPageState extends State<VideoEditorPage> {
if (isExporting) return;
replacePage(context, DetailPage(widget.detailPageConfig));
},
- primaryActionLabel: StringsLocalizations.of(context).saveCopy,
+ primaryActionLabel: context.strings.saveCopy,
onPrimaryAction: exportVideo,
isPrimaryEnabled: isReady && !isExporting,
),
@@ -236,7 +236,7 @@ class _VideoEditorPageState extends State<VideoEditorPage> {
VideoEditorMainActions(
children: [
VideoEditorBottomAction(
- label: StringsLocalizations.of(context).trim,
+ label: context.strings.trim,
svgPath:
"assets/video-editor/video-editor-trim-action.svg",
onPressed: () => _openSubEditor(
@@ -245,7 +245,7 @@ class _VideoEditorPageState extends State<VideoEditorPage> {
),
const SizedBox(width: 24),
VideoEditorBottomAction(
- label: StringsLocalizations.of(context).crop,
+ label: context.strings.crop,
svgPath:
"assets/video-editor/video-editor-crop-action.svg",
onPressed: () => _openSubEditor(
@@ -254,7 +254,7 @@ class _VideoEditorPageState extends State<VideoEditorPage> {
),
const SizedBox(width: 24),
VideoEditorBottomAction(
- label: StringsLocalizations.of(context).rotate,
+ label: context.strings.rotate,
svgPath:
"assets/video-editor/video-editor-rotate-action.svg",
onPressed: () => _openSubEditor(
@@ -286,7 +286,7 @@ class _VideoEditorPageState extends State<VideoEditorPage> {
final dialogKey = GlobalKey<LinearProgressDialogState>();
final dialog = LinearProgressDialog(
- StringsLocalizations.of(context).savingEdits,
+ context.strings.savingEdits,
key: dialogKey,
);
@@ -315,10 +315,7 @@ class _VideoEditorPageState extends State<VideoEditorPage> {
}
if (!mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
}
}
@@ -599,7 +596,7 @@ class _VideoEditorPageState extends State<VideoEditorPage> {
SyncService.instance.sync().ignore();
if (!mounted) return;
- showShortToast(context, StringsLocalizations.of(context).editsSaved);
+ showShortToast(context, context.strings.editsSaved);
final files = List<EnteFile>.of(widget.detailPageConfig.files);
// the index could be -1 if the files fetched doesn't contain the newly
diff --git a/mobile/apps/photos/lib/ui/tools/editor/video_rotate_page.dart b/mobile/apps/photos/lib/ui/tools/editor/video_rotate_page.dart
index a1a7484a2f..bd55398c13 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/video_rotate_page.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/video_rotate_page.dart
@@ -25,7 +25,7 @@ class VideoRotatePage extends StatelessWidget {
}
Navigator.pop(context);
},
- primaryActionLabel: StringsLocalizations.of(context).done,
+ primaryActionLabel: context.strings.done,
onPrimaryAction: () {
Navigator.pop(context);
},
@@ -61,14 +61,14 @@ class VideoRotatePage extends StatelessWidget {
VideoEditorMainActions(
children: [
VideoEditorBottomAction(
- label: StringsLocalizations.of(context).left,
+ label: context.strings.left,
onPressed: () =>
controller.rotate90Degrees(RotateDirection.left),
icon: Icons.rotate_left,
),
const SizedBox(width: 24),
VideoEditorBottomAction(
- label: StringsLocalizations.of(context).right,
+ label: context.strings.right,
onPressed: () =>
controller.rotate90Degrees(RotateDirection.right),
icon: Icons.rotate_right,
diff --git a/mobile/apps/photos/lib/ui/tools/editor/video_trim_page.dart b/mobile/apps/photos/lib/ui/tools/editor/video_trim_page.dart
index aa48df254c..9ea81231df 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/video_trim_page.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/video_trim_page.dart
@@ -30,7 +30,7 @@ class _VideoTrimPageState extends State<VideoTrimPage> {
widget.controller.updateTrim(minTrim, maxTrim);
Navigator.pop(context);
},
- primaryActionLabel: StringsLocalizations.of(context).done,
+ primaryActionLabel: context.strings.done,
onPrimaryAction: () {
Navigator.pop(context);
},
diff --git a/mobile/apps/photos/lib/ui/tools/free_space_page.dart b/mobile/apps/photos/lib/ui/tools/free_space_page.dart
index acd26796a3..0328a537cf 100644
--- a/mobile/apps/photos/lib/ui/tools/free_space_page.dart
+++ b/mobile/apps/photos/lib/ui/tools/free_space_page.dart
@@ -30,7 +30,7 @@ class _FreeSpacePageState extends State<FreeSpacePage> {
return Scaffold(
backgroundColor: context.componentColors.backgroundBase,
body: AppBarComponent(
- title: StringsLocalizations.of(context).freeUpDeviceSpace,
+ title: context.strings.freeUpDeviceSpace,
backgroundColor: context.componentColors.backgroundBase,
slivers: [
SliverSafeArea(
@@ -53,7 +53,7 @@ class _FreeSpacePageState extends State<FreeSpacePage> {
final count = status.localIDs.length;
final formattedCount = NumberFormat().format(count);
final formattedSize = formatBytes(status.size);
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final colors = context.componentColors;
return Padding(
@@ -124,7 +124,7 @@ class _FreeSpacePageState extends State<FreeSpacePage> {
Navigator.of(context).pop(true);
} else {
if (!mounted) return;
- showToast(context, StringsLocalizations.of(context).couldNotFreeUpSpace);
+ showToast(context, context.strings.couldNotFreeUpSpace);
}
}
@@ -132,7 +132,7 @@ class _FreeSpacePageState extends State<FreeSpacePage> {
BuildContext context,
FreeableSpaceInfo status,
) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
await showBottomSheetComponent(
context: context,
builder: (_) => BottomSheetComponent(
diff --git a/mobile/apps/photos/lib/ui/tools/similar_images_page.dart b/mobile/apps/photos/lib/ui/tools/similar_images_page.dart
index 4af3b9c3a9..c5e498fbb3 100644
--- a/mobile/apps/photos/lib/ui/tools/similar_images_page.dart
+++ b/mobile/apps/photos/lib/ui/tools/similar_images_page.dart
@@ -129,7 +129,7 @@ class _SimilarImagesPageState extends State<SimilarImagesPage>
return Scaffold(
appBar: AppBar(
elevation: 0,
- title: Text(StringsLocalizations.of(context).similarImages),
+ title: Text(context.strings.similarImages),
actions: _pageState == SimilarImagesPageState.results
? [_getSortMenu()]
: null,
@@ -188,7 +188,7 @@ class _SimilarImagesPageState extends State<SimilarImagesPage>
),
const SizedBox(width: 8),
Text(
- StringsLocalizations.of(context).deletingDash,
+ context.strings.deletingDash,
style: textTheme.small.copyWith(color: Colors.white),
),
Text(
@@ -230,7 +230,7 @@ class _SimilarImagesPageState extends State<SimilarImagesPage>
),
const SizedBox(height: 32),
Text(
- StringsLocalizations.of(context).findSimilarImages,
+ context.strings.findSimilarImages,
style: textTheme.h3Bold,
textAlign: TextAlign.center,
),
@@ -304,7 +304,7 @@ class _SimilarImagesPageState extends State<SimilarImagesPage>
),
const SizedBox(height: 32),
ButtonWidget(
- labelText: StringsLocalizations.of(context).findSimilarImages,
+ labelText: context.strings.findSimilarImages,
buttonType: ButtonType.primary,
onTap: () async {
await _findSimilarImages();
@@ -333,13 +333,10 @@ class _SimilarImagesPageState extends State<SimilarImagesPage>
color: colorScheme.primary500,
),
const SizedBox(height: 16),
- Text(
- StringsLocalizations.of(context).noSimilarImagesFound,
- style: textTheme.h3Bold,
- ),
+ Text(context.strings.noSimilarImagesFound, style: textTheme.h3Bold),
const SizedBox(height: 8),
Text(
- StringsLocalizations.of(context).yourPhotosLookUnique,
+ context.strings.yourPhotosLookUnique,
style: textTheme.bodyMuted,
),
],
@@ -364,7 +361,7 @@ class _SimilarImagesPageState extends State<SimilarImagesPage>
),
const SizedBox(height: 16),
Text(
- StringsLocalizations.of(context).nothingToTidyUpHere,
+ context.strings.nothingToTidyUpHere,
textAlign: TextAlign.center,
style: textTheme.bodyMuted,
),
@@ -406,21 +403,21 @@ class _SimilarImagesPageState extends State<SimilarImagesPage>
children: [
_buildTabButton(
TabFilter.close,
- StringsLocalizations.of(context).closeBy,
+ context.strings.closeBy,
colorScheme,
textTheme,
),
const SizedBox(width: crossAxisSpacing),
_buildTabButton(
TabFilter.similar,
- StringsLocalizations.of(context).similar,
+ context.strings.similar,
colorScheme,
textTheme,
),
const SizedBox(width: crossAxisSpacing),
_buildTabButton(
TabFilter.related,
- StringsLocalizations.of(context).related,
+ context.strings.related,
colorScheme,
textTheme,
),
@@ -541,13 +538,12 @@ class _SimilarImagesPageState extends State<SimilarImagesPage>
SizedBox(
width: double.infinity,
child: ButtonWidget(
- labelText: StringsLocalizations.of(context)
- .deletePhotosWithSize(
- count: NumberFormat().format(
- selectedFilteredFiles.length,
- ),
- size: formatBytes(totalSize),
- ),
+ labelText: context.strings.deletePhotosWithSize(
+ count: NumberFormat().format(
+ selectedFilteredFiles.length,
+ ),
+ size: formatBytes(totalSize),
+ ),
buttonType: ButtonType.critical,
shouldSurfaceExecutionStates: false,
shouldShowSuccessConfirmation: false,
@@ -569,8 +565,8 @@ class _SimilarImagesPageState extends State<SimilarImagesPage>
width: double.infinity,
child: ButtonWidget(
labelText: allFilteredSelected
- ? StringsLocalizations.of(context).unselectAll
- : StringsLocalizations.of(context).selectAll,
+ ? context.strings.unselectAll
+ : context.strings.selectAll,
buttonType: ButtonType.secondary,
shouldSurfaceExecutionStates: false,
shouldShowSuccessConfirmation: false,
@@ -748,9 +744,9 @@ class _SimilarImagesPageState extends State<SimilarImagesPage>
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
- StringsLocalizations.of(
- context,
- ).similarImagesCount(count: similarFiles.files.length) +
+ context.strings.similarImagesCount(
+ count: similarFiles.files.length,
+ ) +
(kDebugMode
? " (I: d: ${similarFiles.furthestDistance.toStringAsFixed(3)})"
: ""),
@@ -945,9 +941,7 @@ class _SimilarImagesPageState extends State<SimilarImagesPage>
Icon(Icons.delete_outline, size: 12, color: colorScheme.warning500),
const SizedBox(width: 4),
Text(
- StringsLocalizations.of(
- context,
- ).deleteWithCount(count: files.length),
+ context.strings.deleteWithCount(count: files.length),
style: textTheme.smallBold.copyWith(
color: colorScheme.warning500,
),
@@ -968,9 +962,9 @@ class _SimilarImagesPageState extends State<SimilarImagesPage>
if (showDialog) {
final _ = await showChoiceActionSheet(
context,
- title: StringsLocalizations.of(context).deleteFiles,
- body: StringsLocalizations.of(context).areYouSureDeleteFiles,
- firstButtonLabel: StringsLocalizations.of(context).delete,
+ title: context.strings.deleteFiles,
+ body: context.strings.areYouSureDeleteFiles,
+ firstButtonLabel: context.strings.delete,
isCritical: true,
firstButtonOnTap: () async {
try {
@@ -1187,15 +1181,15 @@ class _SimilarImagesPageState extends State<SimilarImagesPage>
SvgPicture.asset("assets/ducky_cleaning_static.svg", height: 160),
const SizedBox(height: 16),
Text(
- StringsLocalizations.of(context).hoorayyyy,
+ context.strings.hoorayyyy,
style: textTheme.h2Bold.copyWith(color: colorScheme.primary500),
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
Text(
- StringsLocalizations.of(
- context,
- ).cleanedUpSimilarImages(size: formatBytes(totalSize)),
+ context.strings.cleanedUpSimilarImages(
+ size: formatBytes(totalSize),
+ ),
style: textTheme.body,
textAlign: TextAlign.center,
),
@@ -1203,7 +1197,7 @@ class _SimilarImagesPageState extends State<SimilarImagesPage>
SizedBox(
width: double.infinity,
child: ButtonWidget(
- labelText: StringsLocalizations.of(context).done,
+ labelText: context.strings.done,
buttonType: ButtonType.primary,
onTap: () async => Navigator.of(context).pop(),
),
@@ -1223,13 +1217,13 @@ class _SimilarImagesPageState extends State<SimilarImagesPage>
String text;
switch (key) {
case SortKey.size:
- text = StringsLocalizations.of(context).totalSize;
+ text = context.strings.totalSize;
break;
case SortKey.recent:
- text = StringsLocalizations.of(context).recent;
+ text = context.strings.recent;
break;
case SortKey.count:
- text = StringsLocalizations.of(context).count;
+ text = context.strings.count;
break;
}
return Text(text, style: textTheme.miniBold);
@@ -1322,11 +1316,11 @@ class _LoadingScreenState extends State<_LoadingScreen> {
final textTheme = getEnteTextTheme(context);
_loadingTexts = [
- StringsLocalizations.of(context).analyzingPhotosLocally,
- StringsLocalizations.of(context).lookingForVisualSimilarities,
- StringsLocalizations.of(context).comparingImageDetails,
- StringsLocalizations.of(context).findingSimilarImages,
- StringsLocalizations.of(context).almostDone,
+ context.strings.analyzingPhotosLocally,
+ context.strings.lookingForVisualSimilarities,
+ context.strings.comparingImageDetails,
+ context.strings.findingSimilarImages,
+ context.strings.almostDone,
];
return Center(
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart b/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart
index 9e9ecd1acb..6dce031cfa 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart
@@ -74,14 +74,14 @@ class _AlbumSelectionActionWidgetState
widget.sectionType == UISectionType.outgoingCollections) {
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).share,
+ labelText: context.strings.share,
hugeIcon: HugeIcons.strokeRoundedShare03,
onTap: _shareCollection,
),
);
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).pin,
+ labelText: context.strings.pin,
hugeIcon: HugeIcons.strokeRoundedPin,
onTap: _onPinClick,
shouldShow: hasUnpinnedAlbum,
@@ -90,7 +90,7 @@ class _AlbumSelectionActionWidgetState
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).unpin,
+ labelText: context.strings.unpin,
hugeIcon: HugeIcons.strokeRoundedPinOff,
onTap: _onUnpinClick,
shouldShow: hasPinnedAlbum,
@@ -99,7 +99,7 @@ class _AlbumSelectionActionWidgetState
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).delete,
+ labelText: context.strings.delete,
hugeIcon: HugeIcons.strokeRoundedDelete01,
onTap: _trashCollection,
isCritical: true,
@@ -107,7 +107,7 @@ class _AlbumSelectionActionWidgetState
);
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).hide,
+ labelText: context.strings.hide,
hugeIcon: HugeIcons.strokeRoundedViewOffSlash,
onTap: _onHideOrUnHideClick,
),
@@ -118,14 +118,14 @@ class _AlbumSelectionActionWidgetState
// For archived albums: show unarchive and delete
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).unarchive,
+ labelText: context.strings.unarchive,
hugeIcon: HugeIcons.strokeRoundedUnarchive03,
onTap: _archiveClick,
),
);
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).delete,
+ labelText: context.strings.delete,
hugeIcon: HugeIcons.strokeRoundedDelete01,
onTap: _trashCollection,
isCritical: true,
@@ -135,14 +135,14 @@ class _AlbumSelectionActionWidgetState
// For hidden albums: show unhide and delete
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).unhide,
+ labelText: context.strings.unhide,
hugeIcon: HugeIcons.strokeRoundedView,
onTap: _onHideOrUnHideClick,
),
);
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).delete,
+ labelText: context.strings.delete,
hugeIcon: HugeIcons.strokeRoundedDelete01,
onTap: _trashCollection,
isCritical: true,
@@ -151,7 +151,7 @@ class _AlbumSelectionActionWidgetState
} else {
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).archive,
+ labelText: context.strings.archive,
hugeIcon: HugeIcons.strokeRoundedArchive03,
onTap: _archiveClick,
),
@@ -171,7 +171,7 @@ class _AlbumSelectionActionWidgetState
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).pin,
+ labelText: context.strings.pin,
hugeIcon: HugeIcons.strokeRoundedPin,
onTap: _onPinClickForSharee,
shouldShow: hasShareeUnpinnedAlbum,
@@ -180,7 +180,7 @@ class _AlbumSelectionActionWidgetState
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).unpin,
+ labelText: context.strings.unpin,
hugeIcon: HugeIcons.strokeRoundedPinOff,
onTap: _onUnpinClickForSharee,
shouldShow: hasShareePinnedAlbum,
@@ -191,7 +191,7 @@ class _AlbumSelectionActionWidgetState
// Hide option for incoming collections (uses sharee metadata)
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).hide,
+ labelText: context.strings.hide,
hugeIcon: HugeIcons.strokeRoundedViewOffSlash,
onTap: _onHideOrUnHideClick,
),
@@ -199,7 +199,7 @@ class _AlbumSelectionActionWidgetState
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).leaveAlbum,
+ labelText: context.strings.leaveAlbum,
hugeIcon: HugeIcons.strokeRoundedLogout05,
onTap: _leaveAlbum,
),
@@ -367,9 +367,7 @@ class _AlbumSelectionActionWidgetState
final isUnhiding = collections.first.isHidden();
final dialog = createProgressDialog(
context,
- isUnhiding
- ? StringsLocalizations.of(context).unhiding
- : StringsLocalizations.of(context).hiding,
+ isUnhiding ? context.strings.unhiding : context.strings.hiding,
);
await dialog.show();
@@ -398,8 +396,8 @@ class _AlbumSelectionActionWidgetState
showShortToast(
context,
isUnhiding
- ? StringsLocalizations.of(context).successfullyUnhid
- : StringsLocalizations.of(context).successfullyHid,
+ ? context.strings.successfullyUnhid
+ : context.strings.successfullyHid,
);
} catch (e, s) {
_logger.warning("failed to change visibility", e, s);
@@ -435,9 +433,7 @@ class _AlbumSelectionActionWidgetState
: collections.first.isArchived();
final dialog = createProgressDialog(
context,
- isUnarchiving
- ? StringsLocalizations.of(context).unarchiving
- : StringsLocalizations.of(context).archiving,
+ isUnarchiving ? context.strings.unarchiving : context.strings.archiving,
);
await dialog.show();
@@ -484,8 +480,8 @@ class _AlbumSelectionActionWidgetState
showShortToast(
context,
isUnarchiving
- ? StringsLocalizations.of(context).successfullyUnarchived
- : StringsLocalizations.of(context).successfullyArchived,
+ ? context.strings.successfullyUnarchived
+ : context.strings.successfullyArchived,
);
} catch (e, s) {
_logger.warning("failed to change archive state", e, s);
@@ -514,7 +510,7 @@ class _AlbumSelectionActionWidgetState
shouldStickToDarkTheme: true,
buttonAction: ButtonAction.first,
shouldSurfaceExecutionStates: true,
- labelText: StringsLocalizations.of(context).leaveAlbum,
+ labelText: context.strings.leaveAlbum,
onTap: () async {
for (final collection in widget.selectedAlbums.albums) {
await CollectionsService.instance.leaveAlbum(collection);
@@ -527,13 +523,11 @@ class _AlbumSelectionActionWidgetState
buttonAction: ButtonAction.cancel,
isInAlert: true,
shouldStickToDarkTheme: true,
- labelText: StringsLocalizations.of(context).cancel,
+ labelText: context.strings.cancel,
),
],
- title: StringsLocalizations.of(context).leaveSharedAlbum,
- body: StringsLocalizations.of(
- context,
- ).photosAddedByYouWillBeRemovedFromTheAlbum,
+ title: context.strings.leaveSharedAlbum,
+ body: context.strings.photosAddedByYouWillBeRemovedFromTheAlbum,
);
if (actionResult?.action != null && mounted) {
if (actionResult!.action == ButtonAction.error) {
@@ -559,7 +553,7 @@ class _AlbumSelectionActionWidgetState
void _showFavToast() {
showShortToast(
context,
- StringsLocalizations.of(context).actionNotSupportedOnFavouritesAlbum,
+ context.strings.actionNotSupportedOnFavouritesAlbum,
);
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/album_selection_overlay_bar.dart b/mobile/apps/photos/lib/ui/viewer/actions/album_selection_overlay_bar.dart
index 6e507b0080..5035ae7e1f 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/album_selection_overlay_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/album_selection_overlay_bar.dart
@@ -142,7 +142,7 @@ class _SelectAllAlbumsButtonState extends State<SelectAllAlbumsButton> {
mainAxisSize: MainAxisSize.min,
children: [
Text(
- StringsLocalizations.of(context).selectAllShort,
+ context.strings.selectAllShort,
style: components.TextStyles.mini.copyWith(
color: colors.textBase,
),
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/delete_empty_albums.dart b/mobile/apps/photos/lib/ui/viewer/actions/delete_empty_albums.dart
index bb0873d64a..4019409c5c 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/delete_empty_albums.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/delete_empty_albums.dart
@@ -43,7 +43,7 @@ class _DeleteEmptyAlbumsState extends State<DeleteEmptyAlbums> {
child: Padding(
padding: widget.padding,
child: Text(
- StringsLocalizations.of(context).deleteEmptyAlbums,
+ context.strings.deleteEmptyAlbums,
style: TextStyles.body.copyWith(
color: colors.textLight,
decoration: TextDecoration.underline,
@@ -56,7 +56,7 @@ class _DeleteEmptyAlbumsState extends State<DeleteEmptyAlbums> {
}
Future<void> _confirmAndDeleteEmptyAlbums() async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
await showBottomSheetComponent<void>(
context: context,
isDismissible: true,
@@ -126,7 +126,7 @@ class _DeleteEmptyAlbumsState extends State<DeleteEmptyAlbums> {
'0',
);
- _deleteProgress.value = StringsLocalizations.of(context).deleteProgress(
+ _deleteProgress.value = context.strings.deleteProgress(
currentlyDeleting: currentlyDeleting,
totalCount: totalCount,
);
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart
index 588bc7346c..e1d963e42a 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart
@@ -171,14 +171,14 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedRestoreBin,
- labelText: StringsLocalizations.of(context).restore,
+ labelText: context.strings.restore,
onTap: _restore,
),
);
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedDelete01,
- labelText: StringsLocalizations.of(context).permanentlyDelete,
+ labelText: context.strings.permanentlyDelete,
onTap: _permanentlyDelete,
isCritical: true,
),
@@ -187,7 +187,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedDelete01,
- labelText: StringsLocalizations.of(context).deleteFromDevice,
+ labelText: context.strings.deleteFromDevice,
onTap: _deleteSelectedFromDevice,
isCritical: true,
),
@@ -196,7 +196,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedDelete01,
- labelText: StringsLocalizations.of(context).delete,
+ labelText: context.strings.delete,
onTap: split.ownedByCurrentUser.isNotEmpty ? _onDeleteClick : null,
isCritical: true,
),
@@ -204,7 +204,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedCancel01,
- labelText: StringsLocalizations.of(context).rejectSuggestions,
+ labelText: context.strings.rejectSuggestions,
onTap: widget.selectedFiles.files.isNotEmpty
? _rejectDeleteSuggestions
: null,
@@ -216,7 +216,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedCopy01,
- labelText: StringsLocalizations.of(context).copyLink,
+ labelText: context.strings.copyLink,
onTap: anyUploadedFiles ? _sendLink : null,
),
);
@@ -224,7 +224,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedNavigation03,
- labelText: StringsLocalizations.of(context).sendLink,
+ labelText: context.strings.sendLink,
onTap: anyUploadedFiles ? _onSendLinkTapped : null,
shouldShow: ownedFilesCount > 0,
key: sendLinkButtonKey,
@@ -236,9 +236,9 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedUserRemove01,
- labelText: StringsLocalizations.of(
- context,
- ).notPersonLabel(name: widget.person!.data.name),
+ labelText: context.strings.notPersonLabel(
+ name: widget.person!.data.name,
+ ),
onTap: _onNotpersonClicked,
),
);
@@ -246,7 +246,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedImage01,
- labelText: StringsLocalizations.of(context).useAsCover,
+ labelText: context.strings.useAsCover,
onTap: anyUploadedFiles ? _setPersonCover : null,
),
);
@@ -256,7 +256,7 @@ class _FileSelectionActionsWidgetState
if (widget.type == GalleryType.cluster && widget.clusterID != null) {
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).notThisPerson,
+ labelText: context.strings.notThisPerson,
hugeIcon: HugeIcons.strokeRoundedUserRemove01,
onTap: _onRemoveFromClusterClicked,
),
@@ -271,7 +271,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedCloudUpload,
- labelText: StringsLocalizations.of(context).addToEnte,
+ labelText: context.strings.addToEnte,
onTap: _addToAlbum,
),
);
@@ -279,7 +279,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedImageAdd01,
- labelText: StringsLocalizations.of(context).addToAlbum,
+ labelText: context.strings.addToAlbum,
onTap: _addToAlbum,
),
);
@@ -290,7 +290,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedImageAdd01,
- labelText: StringsLocalizations.of(context).addToAlbum,
+ labelText: context.strings.addToAlbum,
onTap: _addToHiddenAlbum,
),
);
@@ -300,7 +300,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedArrowRight01,
- labelText: StringsLocalizations.of(context).moveToAlbum,
+ labelText: context.strings.moveToAlbum,
onTap: anyUploadedFiles ? _moveFiles : null,
shouldShow: ownedFilesCount > 0,
),
@@ -311,7 +311,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedArrowRight01,
- labelText: StringsLocalizations.of(context).moveToAlbum,
+ labelText: context.strings.moveToAlbum,
onTap: _moveFilesToHiddenAlbum,
),
);
@@ -321,7 +321,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedDelete01,
- labelText: StringsLocalizations.of(context).delete,
+ labelText: context.strings.delete,
onTap: anyOwnedFiles ? _onDeleteClick : null,
shouldShow: allOwnedFiles,
isCritical: true,
@@ -333,7 +333,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedRemove01,
- labelText: StringsLocalizations.of(context).removeFromAlbum,
+ labelText: context.strings.removeFromAlbum,
onTap: removeCount > 0 ? _removeFilesFromAlbum : null,
shouldShow: removeCount > 0,
),
@@ -344,7 +344,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedFlag01,
- labelText: StringsLocalizations.of(context).suggestDeletion,
+ labelText: context.strings.suggestDeletion,
onTap: _onSuggestDelete,
),
);
@@ -354,7 +354,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedRemove01,
- labelText: StringsLocalizations.of(context).removeFromAlbum,
+ labelText: context.strings.removeFromAlbum,
onTap: _removeFilesFromHiddenAlbum,
),
);
@@ -364,7 +364,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedFavourite,
- labelText: StringsLocalizations.of(context).favorite,
+ labelText: context.strings.favorite,
onTap: anyUploadedFiles ? _onFavoriteClick : null,
shouldShow: ownedFilesCount > 0,
),
@@ -373,7 +373,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedHeartRemove,
- labelText: StringsLocalizations.of(context).removeFromFavorite,
+ labelText: context.strings.removeFromFavorite,
onTap: _onUnFavoriteClick,
shouldShow: ownedFilesCount > 0,
),
@@ -382,7 +382,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedIncognito,
- labelText: StringsLocalizations.of(context).guestView,
+ labelText: context.strings.guestView,
onTap: _onGuestViewClick,
),
);
@@ -392,7 +392,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedUserAdd01,
- labelText: StringsLocalizations.of(context).addToPerson,
+ labelText: context.strings.addToPerson,
onTap: hasUploadedFileIDs ? _onAddFilesToPerson : null,
shouldShow: hasUploadedFileIDs,
),
@@ -402,7 +402,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedGridView,
- labelText: StringsLocalizations.of(context).createCollage,
+ labelText: context.strings.createCollage,
onTap: _onCreateCollageClicked,
shouldShow: showCollageOption,
),
@@ -413,7 +413,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedViewOffSlash,
- labelText: StringsLocalizations.of(context).hide,
+ labelText: context.strings.hide,
onTap: anyUploadedFiles ? _onHideClick : null,
shouldShow: ownedFilesCount > 0,
),
@@ -422,7 +422,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedView,
- labelText: StringsLocalizations.of(context).unhide,
+ labelText: context.strings.unhide,
onTap: _onUnhideClick,
shouldShow: ownedFilesCount > 0,
),
@@ -432,7 +432,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedArchive03,
- labelText: StringsLocalizations.of(context).archive,
+ labelText: context.strings.archive,
onTap: anyUploadedFiles ? _onArchiveClick : null,
shouldShow: ownedFilesCount > 0,
),
@@ -441,7 +441,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedUnarchive03,
- labelText: StringsLocalizations.of(context).unarchive,
+ labelText: context.strings.unarchive,
onTap: _onUnArchiveClick,
shouldShow: ownedFilesCount > 0,
),
@@ -452,7 +452,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedRestoreBin,
- labelText: StringsLocalizations.of(context).restore,
+ labelText: context.strings.restore,
onTap: _restore,
),
);
@@ -462,7 +462,7 @@ class _FileSelectionActionsWidgetState
items.add(
SelectionActionButton(
hugeIcon: HugeIcons.strokeRoundedDelete01,
- labelText: StringsLocalizations.of(context).permanentlyDelete,
+ labelText: context.strings.permanentlyDelete,
onTap: _permanentlyDelete,
isCritical: true,
),
@@ -475,7 +475,7 @@ class _FileSelectionActionsWidgetState
shouldShow: widget.selectedFiles.files.every(
(element) => (element.ownerID == currentUserID),
),
- labelText: StringsLocalizations.of(context).editTime,
+ labelText: context.strings.editTime,
hugeIcon: HugeIcons.strokeRoundedDateTime,
onTap: () async {
final newDate = await showEditDateSheet(
@@ -496,7 +496,7 @@ class _FileSelectionActionsWidgetState
shouldShow: widget.selectedFiles.files.any(
(element) => (element.ownerID == currentUserID),
),
- labelText: StringsLocalizations.of(context).editLocation,
+ labelText: context.strings.editLocation,
hugeIcon: HugeIcons.strokeRoundedMapsEditing,
onTap: _editLocation,
),
@@ -506,7 +506,7 @@ class _FileSelectionActionsWidgetState
if (showDownloadOption) {
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).download,
+ labelText: context.strings.download,
hugeIcon: HugeIcons.strokeRoundedDownload01,
onTap: () => _download(widget.selectedFiles.files.toList()),
),
@@ -515,7 +515,7 @@ class _FileSelectionActionsWidgetState
if (widget.type != GalleryType.sharedPublicCollection) {
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).share,
+ labelText: context.strings.share,
hugeIcon: HugeIcons.strokeRoundedShare03,
key: shareButtonKey,
onTap: _shareSelectedFiles,
@@ -754,7 +754,7 @@ class _FileSelectionActionsWidgetState
if (filesWithIds.isEmpty) {
showShortToast(
context,
- StringsLocalizations.of(context).onlyUploadedFilesCanBeAddedToPerson,
+ context.strings.onlyUploadedFilesCanBeAddedToPerson,
);
return;
}
@@ -795,7 +795,7 @@ class _FileSelectionActionsWidgetState
if (!mounted) return;
showToast(
context,
- StringsLocalizations.of(context).addedFilesToPerson(
+ context.strings.addedFilesToPerson(
count: addedCount,
personName: result.person.data.name,
),
@@ -811,7 +811,7 @@ class _FileSelectionActionsWidgetState
if (!mounted) return;
showShortToast(
context,
- StringsLocalizations.of(context).filesAlreadyLinkedToPerson(
+ context.strings.filesAlreadyLinkedToPerson(
count: alreadyCount,
personName: result.person.data.name,
),
@@ -841,8 +841,8 @@ class _FileSelectionActionsWidgetState
} else {
await showErrorDialog(
context,
- StringsLocalizations.of(context).noSystemLockFound,
- StringsLocalizations.of(context).guestViewEnablePreSteps,
+ context.strings.noSystemLockFound,
+ context.strings.guestViewEnablePreSteps,
);
}
if (!mounted) return;
@@ -907,13 +907,13 @@ class _FileSelectionActionsWidgetState
if (split.ownedByCurrentUser.isEmpty) {
showShortToast(
context,
- StringsLocalizations.of(context).canOnlyCreateLinkForFilesOwnedByYou,
+ context.strings.canOnlyCreateLinkForFilesOwnedByYou,
);
return;
}
final dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).creatingLink,
+ context.strings.creatingLink,
isDismissible: true,
);
await dialog.show();
@@ -967,10 +967,10 @@ class _FileSelectionActionsWidgetState
try {
final actionResult = await showActionSheet(
context: context,
- title: StringsLocalizations.of(context).removeFromPersonQuestion,
+ title: context.strings.removeFromPersonQuestion,
buttons: [
ButtonWidget(
- labelText: StringsLocalizations.of(context).yesRemove,
+ labelText: context.strings.yesRemove,
buttonType: ButtonType.neutral,
buttonSize: ButtonSize.large,
shouldStickToDarkTheme: true,
@@ -978,7 +978,7 @@ class _FileSelectionActionsWidgetState
isInAlert: true,
),
ButtonWidget(
- labelText: StringsLocalizations.of(context).cancel,
+ labelText: context.strings.cancel,
buttonType: ButtonType.secondary,
buttonSize: ButtonSize.large,
buttonAction: ButtonAction.second,
@@ -986,9 +986,7 @@ class _FileSelectionActionsWidgetState
isInAlert: true,
),
],
- body: StringsLocalizations.of(
- context,
- ).selectedItemsWillBeRemovedFromThisPerson,
+ body: context.strings.selectedItemsWillBeRemovedFromThisPerson,
actionSheetType: ActionSheetType.defaultActionSheet,
);
if (actionResult?.action != null) {
@@ -1015,10 +1013,10 @@ class _FileSelectionActionsWidgetState
}
final actionResult = await showActionSheet(
context: context,
- title: StringsLocalizations.of(context).removeFromPersonQuestion,
+ title: context.strings.removeFromPersonQuestion,
buttons: [
ButtonWidget(
- labelText: StringsLocalizations.of(context).yesRemove,
+ labelText: context.strings.yesRemove,
buttonType: ButtonType.neutral,
buttonSize: ButtonSize.large,
shouldStickToDarkTheme: true,
@@ -1026,7 +1024,7 @@ class _FileSelectionActionsWidgetState
isInAlert: true,
),
ButtonWidget(
- labelText: StringsLocalizations.of(context).cancel,
+ labelText: context.strings.cancel,
buttonType: ButtonType.secondary,
buttonSize: ButtonSize.large,
buttonAction: ButtonAction.second,
@@ -1034,9 +1032,7 @@ class _FileSelectionActionsWidgetState
isInAlert: true,
),
],
- body: StringsLocalizations.of(
- context,
- ).selectedItemsWillBeRemovedFromThisPerson,
+ body: context.strings.selectedItemsWillBeRemovedFromThisPerson,
actionSheetType: ActionSheetType.defaultActionSheet,
);
if (actionResult?.action != null) {
@@ -1083,7 +1079,7 @@ class _FileSelectionActionsWidgetState
Future<void> _deleteSelectedFromDevice() async {
final filesToDelete = widget.selectedFiles.files.toList();
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final actionResult = await showActionSheet(
context: context,
@@ -1134,7 +1130,7 @@ class _FileSelectionActionsWidgetState
return;
}
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final existingLocalFolderNames = await Future.wait(
files.map((file) => getExistingLocalFolderNameForDownloadSkipToast(file)),
);
@@ -1246,7 +1242,7 @@ class _FileSelectionActionsWidgetState
addedToQueueCount > 0) {
showToast(
context,
- StringsLocalizations.of(context).filesSavedToGallery,
+ context.strings.filesSavedToGallery,
iosLongToastLengthInSec: 4,
);
}
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_overlay_bar.dart b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_overlay_bar.dart
index 9fa6274bb2..bba9d0f862 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_overlay_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_overlay_bar.dart
@@ -296,7 +296,7 @@ class _SelectAllButtonState extends State<SelectAllButton> {
mainAxisSize: MainAxisSize.min,
children: [
Text(
- StringsLocalizations.of(context).selectAllShort,
+ context.strings.selectAllShort,
style: components.TextStyles.mini.copyWith(
color: colors.textBase,
),
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/people_selection_action_widget.dart b/mobile/apps/photos/lib/ui/viewer/actions/people_selection_action_widget.dart
index 4443f890f9..2004646a7e 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/people_selection_action_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/people_selection_action_widget.dart
@@ -190,7 +190,7 @@ class _PeopleSelectionActionWidgetState
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).edit,
+ labelText: context.strings.edit,
hugeIcon: HugeIcons.strokeRoundedPencilEdit01,
onTap: _onEditPerson,
shouldShow: showEditAction,
@@ -198,7 +198,7 @@ class _PeopleSelectionActionWidgetState
);
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).review,
+ labelText: context.strings.review,
hugeIcon: HugeIcons.strokeRoundedSearch01,
onTap: _onReviewSuggestion,
shouldShow: showReviewAction,
@@ -206,7 +206,7 @@ class _PeopleSelectionActionWidgetState
);
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).ignore,
+ labelText: context.strings.ignore,
hugeIcon: HugeIcons.strokeRoundedImageNotFound01,
onTap: _onIgnore,
shouldShow: showIgnoreAction,
@@ -214,7 +214,7 @@ class _PeopleSelectionActionWidgetState
);
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).merge,
+ labelText: context.strings.merge,
hugeIcon: HugeIcons.strokeRoundedGitMerge,
onTap: _onMerge,
shouldShow: showMergeAction,
@@ -222,7 +222,7 @@ class _PeopleSelectionActionWidgetState
);
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).reset,
+ labelText: context.strings.reset,
hugeIcon: HugeIcons.strokeRoundedRemove01,
onTap: _onResetPerson,
shouldShow: showResetAction,
@@ -230,7 +230,7 @@ class _PeopleSelectionActionWidgetState
);
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).showPerson,
+ labelText: context.strings.showPerson,
hugeIcon: HugeIcons.strokeRoundedView,
onTap: _onShowPerson,
shouldShow: showShowPersonAction,
@@ -238,7 +238,7 @@ class _PeopleSelectionActionWidgetState
);
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).pin,
+ labelText: context.strings.pin,
hugeIcon: HugeIcons.strokeRoundedPin,
onTap: () => _updatePinState(true),
shouldShow: showPinAction,
@@ -246,7 +246,7 @@ class _PeopleSelectionActionWidgetState
);
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).unpin,
+ labelText: context.strings.unpin,
hugeIcon: HugeIcons.strokeRoundedPinOff,
onTap: () => _updatePinState(false),
shouldShow: showUnpinAction,
@@ -254,7 +254,7 @@ class _PeopleSelectionActionWidgetState
);
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).hideFromMemories,
+ labelText: context.strings.hideFromMemories,
hugeIcon: HugeIcons.strokeRoundedViewOffSlash,
onTap: () => _updateHideFromMemoriesState(true),
shouldShow: showHideFromMemoriesAction,
@@ -270,7 +270,7 @@ class _PeopleSelectionActionWidgetState
);
items.add(
SelectionActionButton(
- labelText: StringsLocalizations.of(context).autoAddToAlbum,
+ labelText: context.strings.autoAddToAlbum,
iconWidget: Image.asset(
"assets/auto-add-people.png",
width: 22,
@@ -414,11 +414,9 @@ class _PeopleSelectionActionWidgetState
if (!mounted) return;
await showChoiceDialog(
context,
- title: StringsLocalizations.of(
- context,
- ).areYouSureYouWantToResetThisPerson,
- body: StringsLocalizations.of(context).allPersonGroupingWillReset,
- firstButtonLabel: StringsLocalizations.of(context).yesResetPerson,
+ title: context.strings.areYouSureYouWantToResetThisPerson,
+ body: context.strings.allPersonGroupingWillReset,
+ firstButtonLabel: context.strings.yesResetPerson,
firstButtonOnTap: () async {
try {
await PersonService.instance.deletePerson(person.remoteID);
@@ -441,16 +439,12 @@ class _PeopleSelectionActionWidgetState
final result = await showChoiceDialog(
context,
title: multiple
- ? StringsLocalizations.of(
- context,
- ).areYouSureYouWantToIgnoreThesePersons
- : StringsLocalizations.of(
- context,
- ).areYouSureYouWantToIgnoreThisPerson,
+ ? context.strings.areYouSureYouWantToIgnoreThesePersons
+ : context.strings.areYouSureYouWantToIgnoreThisPerson,
body: multiple
- ? StringsLocalizations.of(context).thePersonGroupsWillNotBeDisplayed
- : StringsLocalizations.of(context).thePersonWillNotBeDisplayed,
- firstButtonLabel: StringsLocalizations.of(context).yesIgnore,
+ ? context.strings.thePersonGroupsWillNotBeDisplayed
+ : context.strings.thePersonWillNotBeDisplayed,
+ firstButtonLabel: context.strings.yesIgnore,
);
if (!mounted || result?.action != ButtonAction.first) {
return;
@@ -472,7 +466,7 @@ class _PeopleSelectionActionWidgetState
required List<String> selectedPersonIds,
required List<String> selectedClusterIds,
}) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final personIdsToIgnore = selectedPersonIds.where((personID) {
final person = personMap[personID];
return person != null && !person.data.isIgnored;
@@ -562,15 +556,15 @@ class _PeopleSelectionActionWidgetState
await showChoiceDialog(
context,
title: multiple
- ? StringsLocalizations.of(
- context,
- ).areYouSureYouWantToShowThesePeopleInPeopleSectionAgain
- : StringsLocalizations.of(
- context,
- ).areYouSureYouWantToShowThisPersonInPeopleSectionAgain,
+ ? context
+ .strings
+ .areYouSureYouWantToShowThesePeopleInPeopleSectionAgain
+ : context
+ .strings
+ .areYouSureYouWantToShowThisPersonInPeopleSectionAgain,
firstButtonLabel: multiple
- ? StringsLocalizations.of(context).yesShowPeople
- : StringsLocalizations.of(context).yesShowPerson,
+ ? context.strings.yesShowPeople
+ : context.strings.yesShowPerson,
firstButtonOnTap: () async {
try {
for (final personID in ignoredSelectedPersonIds) {
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/smart_albums_status_widget.dart b/mobile/apps/photos/lib/ui/viewer/actions/smart_albums_status_widget.dart
index bac982b6f9..e8e2a14b68 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/smart_albums_status_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/smart_albums_status_widget.dart
@@ -97,8 +97,8 @@ class _SmartAlbumsStatusWidgetState extends State<SmartAlbumsStatusWidget>
const SizedBox(width: 8),
Text(
(_syncingCollection?.$2 ?? true)
- ? StringsLocalizations.of(context).addingPhotos
- : StringsLocalizations.of(context).gettingReady,
+ ? context.strings.addingPhotos
+ : context.strings.gettingReady,
style: textTheme.small.copyWith(color: Colors.white),
),
],
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/suggest_delete_sheet.dart b/mobile/apps/photos/lib/ui/viewer/actions/suggest_delete_sheet.dart
index 0bb39f4e2e..8cdb181776 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/suggest_delete_sheet.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/suggest_delete_sheet.dart
@@ -30,7 +30,7 @@ Future<bool> showSuggestDeleteSheet({
required BuildContext context,
required SuggestDeleteConfirmCallback onConfirm,
}) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final actionResult = await showActionSheet(
context: context,
title: l10n.suggestDeletion,
diff --git a/mobile/apps/photos/lib/ui/viewer/date/date_time_picker.dart b/mobile/apps/photos/lib/ui/viewer/date/date_time_picker.dart
index af5cafdaab..9597393796 100644
--- a/mobile/apps/photos/lib/ui/viewer/date/date_time_picker.dart
+++ b/mobile/apps/photos/lib/ui/viewer/date/date_time_picker.dart
@@ -91,8 +91,8 @@ class _DateTimePickerWidgetState extends State<DateTimePickerWidget> {
alignment: Alignment.centerLeft,
child: Text(
_showTimePicker
- ? StringsLocalizations.of(context).selectTime
- : StringsLocalizations.of(context).selectDate,
+ ? context.strings.selectTime
+ : context.strings.selectDate,
style: TextStyle(color: colorScheme.textBase, fontSize: 16),
),
),
@@ -173,8 +173,8 @@ class _DateTimePickerWidgetState extends State<DateTimePickerWidget> {
padding: EdgeInsets.zero,
child: Text(
_showTimePicker
- ? StringsLocalizations.of(context).previous
- : StringsLocalizations.of(context).cancel,
+ ? context.strings.previous
+ : context.strings.cancel,
style: TextStyle(
color: colorScheme.textBase,
fontSize: 14,
@@ -197,8 +197,8 @@ class _DateTimePickerWidgetState extends State<DateTimePickerWidget> {
padding: EdgeInsets.zero,
child: Text(
_showTimePicker
- ? StringsLocalizations.of(context).done
- : StringsLocalizations.of(context).next,
+ ? context.strings.done
+ : context.strings.next,
style: TextStyle(
color: colorScheme.primary700,
fontSize: 14,
diff --git a/mobile/apps/photos/lib/ui/viewer/date/edit_date_sheet.dart b/mobile/apps/photos/lib/ui/viewer/date/edit_date_sheet.dart
index 324221dd85..4d6dc764c2 100644
--- a/mobile/apps/photos/lib/ui/viewer/date/edit_date_sheet.dart
+++ b/mobile/apps/photos/lib/ui/viewer/date/edit_date_sheet.dart
@@ -170,7 +170,7 @@ class _EditDateSheetState extends State<EditDateSheet> {
const SizedBox(height: 16),
ButtonWidget(
buttonType: ButtonType.primary,
- labelText: StringsLocalizations.of(context).confirm,
+ labelText: context.strings.confirm,
buttonSize: ButtonSize.large,
onTap: () async {
final newDate = await _editDates(
@@ -186,7 +186,7 @@ class _EditDateSheetState extends State<EditDateSheet> {
const SizedBox(height: 8),
ButtonWidget(
buttonType: ButtonType.neutral,
- labelText: StringsLocalizations.of(context).cancel,
+ labelText: context.strings.cancel,
buttonSize: ButtonSize.large,
onTap: () async {
Navigator.of(context).pop(null);
@@ -270,10 +270,8 @@ class DateAndTimeWidget extends StatelessWidget {
alignment: Alignment.centerLeft,
child: Text(
selectDate
- ? StringsLocalizations.of(
- context,
- ).selectOneDateAndTimeForAll
- : StringsLocalizations.of(context).selectStartOfRange,
+ ? context.strings.selectOneDateAndTimeForAll
+ : context.strings.selectStartOfRange,
style: TextStyle(color: colorScheme.textBase, fontSize: 16),
),
),
@@ -283,12 +281,8 @@ class DateAndTimeWidget extends StatelessWidget {
alignment: Alignment.centerLeft,
child: Text(
selectDate
- ? StringsLocalizations.of(
- context,
- ).thisWillMakeTheDateAndTimeOfAllSelected
- : StringsLocalizations.of(
- context,
- ).allWillShiftRangeBasedOnFirst,
+ ? context.strings.thisWillMakeTheDateAndTimeOfAllSelected
+ : context.strings.allWillShiftRangeBasedOnFirst,
style: TextStyle(color: colorScheme.textFaint, fontSize: 12),
),
),
@@ -346,7 +340,7 @@ class DateAndTimeWidget extends StatelessWidget {
Align(
alignment: Alignment.centerLeft,
child: Text(
- StringsLocalizations.of(context).newRange,
+ context.strings.newRange,
style: TextStyle(color: colorScheme.textBase, fontSize: 12),
),
),
@@ -443,11 +437,11 @@ class SelectDateOrShiftWidget extends StatelessWidget {
color: colorScheme.textBase,
),
title: Text(
- StringsLocalizations.of(context).selectOneDateAndTime,
+ context.strings.selectOneDateAndTime,
style: TextStyle(color: colorScheme.textBase, fontSize: 16),
),
subtitle: Text(
- StringsLocalizations.of(context).moveSelectedPhotosToOneDate,
+ context.strings.moveSelectedPhotosToOneDate,
style: TextStyle(color: colorScheme.textFaint, fontSize: 12),
),
trailing: Icon(
@@ -469,13 +463,11 @@ class SelectDateOrShiftWidget extends StatelessWidget {
color: colorScheme.textBase,
),
title: Text(
- StringsLocalizations.of(context).shiftDatesAndTime,
+ context.strings.shiftDatesAndTime,
style: TextStyle(color: colorScheme.textBase, fontSize: 16),
),
subtitle: Text(
- StringsLocalizations.of(
- context,
- ).photosKeepRelativeTimeDifference,
+ context.strings.photosKeepRelativeTimeDifference,
style: TextStyle(color: colorScheme.textFaint, fontSize: 12),
),
trailing: Icon(
@@ -533,9 +525,7 @@ class PhotoDateHeaderWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- StringsLocalizations.of(
- context,
- ).photosCount(count: photoCount),
+ context.strings.photosCount(count: photoCount),
style: TextStyle(
color: colorScheme.textBase,
fontSize: 18,
diff --git a/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart b/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
index ab157eb7a2..3c6caa0b56 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
@@ -356,9 +356,7 @@ class _BodyState extends State<_Body> {
child: Align(
alignment: Alignment.center,
child: Tooltip(
- message: StringsLocalizations.of(
- context,
- ).panorama,
+ message: context.strings.panorama,
child: IconButton(
style: IconButton.styleFrom(
backgroundColor: const Color(0xAA252525),
@@ -555,27 +553,19 @@ class _BodyState extends State<_Body> {
// ignore: unawaited_futures
showErrorDialog(
context,
- StringsLocalizations.of(context).sorry,
- StringsLocalizations.of(
- context,
- ).weDontSupportEditingPhotosAndAlbumsThatYouDont,
+ context.strings.sorry,
+ context.strings.weDontSupportEditingPhotosAndAlbumsThatYouDont,
);
return;
}
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).pleaseWait,
- );
+ final dialog = createProgressDialog(context, context.strings.pleaseWait);
await dialog.show();
try {
final ioFile = await getFile(file);
if (ioFile == null) {
if (!mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).failedToFetchOriginalForEdit,
- );
+ showShortToast(context, context.strings.failedToFetchOriginalForEdit);
await dialog.hide();
return;
}
diff --git a/mobile/apps/photos/lib/ui/viewer/file/exif_info_dialog.dart b/mobile/apps/photos/lib/ui/viewer/file/exif_info_dialog.dart
index 468551aa6e..96f9350e00 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/exif_info_dialog.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/exif_info_dialog.dart
@@ -16,7 +16,7 @@ class ExifInfoDialog extends StatelessWidget {
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(StringsLocalizations.of(context).exif, style: textTheme.h3Bold),
+ Text(context.strings.exif, style: textTheme.h3Bold),
Text(file.title!, style: textTheme.smallMuted),
],
),
@@ -26,10 +26,7 @@ class ExifInfoDialog extends StatelessWidget {
),
actions: [
TextButton(
- child: Text(
- StringsLocalizations.of(context).close,
- style: textTheme.body,
- ),
+ child: Text(context.strings.close, style: textTheme.body),
onPressed: () {
Navigator.of(context).pop('dialog');
},
@@ -48,7 +45,7 @@ class ExifInfoDialog extends StatelessWidget {
.map((entry) => "${entry.key}: ${entry.value}")
.join("\n");
if (data.isEmpty) {
- data = StringsLocalizations.of(context).noExifData;
+ data = context.strings.noExifData;
}
return Container(
padding: const EdgeInsets.all(2),
diff --git a/mobile/apps/photos/lib/ui/viewer/file/file_app_bar.dart b/mobile/apps/photos/lib/ui/viewer/file/file_app_bar.dart
index 2aa13c6da9..30fca77ccb 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/file_app_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/file_app_bar.dart
@@ -271,7 +271,7 @@ class FileAppBarState extends State<FileAppBar> {
onPressed: () {
showShortToast(
context,
- StringsLocalizations.of(context).pressAndHoldToPlayVideoDetailed,
+ context.strings.pressAndHoldToPlayVideoDetailed,
);
},
),
@@ -293,7 +293,7 @@ class FileAppBarState extends State<FileAppBar> {
if (restrictFileActions) {
items.add(
_fileMenuOption(
- StringsLocalizations.of(context).info,
+ context.strings.info,
value: 12,
hugeIcon: HugeIcons.strokeRoundedInformationCircle,
),
@@ -302,7 +302,7 @@ class FileAppBarState extends State<FileAppBar> {
if (isFileUploaded) {
items.add(
_fileMenuOption(
- StringsLocalizations.of(context).download,
+ context.strings.download,
value: 1,
hugeIcon: HugeIcons.strokeRoundedDownload01,
),
@@ -310,7 +310,7 @@ class FileAppBarState extends State<FileAppBar> {
if (isOwnedByUser && !isFileHidden) {
items.add(
_fileMenuOption(
- StringsLocalizations.of(context).sendLink,
+ context.strings.sendLink,
value: 14,
hugeIcon: HugeIcons.strokeRoundedNavigation03,
),
@@ -324,7 +324,7 @@ class FileAppBarState extends State<FileAppBar> {
widget.file.fileType == FileType.video)) {
items.add(
_fileMenuOption(
- StringsLocalizations.of(context).edit,
+ context.strings.edit,
value: 11,
hugeIcon: HugeIcons.strokeRoundedSlidersHorizontal,
),
@@ -336,9 +336,7 @@ class FileAppBarState extends State<FileAppBar> {
widget.file.magicMetadata.visibility == archiveVisibility;
items.add(
_fileMenuOption(
- isArchived
- ? StringsLocalizations.of(context).unarchive
- : StringsLocalizations.of(context).archive,
+ isArchived ? context.strings.unarchive : context.strings.archive,
value: 2,
hugeIcon: isArchived
? HugeIcons.strokeRoundedUnarchive03
@@ -352,7 +350,7 @@ class FileAppBarState extends State<FileAppBar> {
Platform.isAndroid) {
items.add(
_fileMenuOption(
- StringsLocalizations.of(context).setAs,
+ context.strings.setAs,
value: 3,
hugeIcon: HugeIcons.strokeRoundedImage01,
),
@@ -362,7 +360,7 @@ class FileAppBarState extends State<FileAppBar> {
if (!isFileHidden) {
items.add(
_fileMenuOption(
- StringsLocalizations.of(context).hide,
+ context.strings.hide,
value: 4,
hugeIcon: HugeIcons.strokeRoundedViewOffSlash,
),
@@ -370,7 +368,7 @@ class FileAppBarState extends State<FileAppBar> {
} else {
items.add(
_fileMenuOption(
- StringsLocalizations.of(context).unhide,
+ context.strings.unhide,
value: 5,
hugeIcon: HugeIcons.strokeRoundedView,
),
@@ -380,7 +378,7 @@ class FileAppBarState extends State<FileAppBar> {
items.add(
_fileMenuOption(
- StringsLocalizations.of(context).guestView,
+ context.strings.guestView,
value: 6,
hugeIcon: HugeIcons.strokeRoundedIncognito,
),
@@ -389,7 +387,7 @@ class FileAppBarState extends State<FileAppBar> {
if (canSuggestDeleteAction) {
items.add(
_fileMenuOption(
- StringsLocalizations.of(context).suggestDeletion,
+ context.strings.suggestDeletion,
value: 13,
hugeIcon: HugeIcons.strokeRoundedFlag01,
),
@@ -398,7 +396,7 @@ class FileAppBarState extends State<FileAppBar> {
items.add(
_fileMenuOption(
- StringsLocalizations.of(context).info,
+ context.strings.info,
value: 12,
hugeIcon: HugeIcons.strokeRoundedInformationCircle,
),
@@ -410,7 +408,7 @@ class FileAppBarState extends State<FileAppBar> {
if (_shouldShowCreateStreamOption()) {
items.add(
_fileMenuOption(
- StringsLocalizations.of(context).createStream,
+ context.strings.createStream,
value: 8,
hugeIcon: HugeIcons.strokeRoundedVideoReplay,
),
@@ -420,7 +418,7 @@ class FileAppBarState extends State<FileAppBar> {
if (_shouldShowRecreateStreamOption()) {
items.add(
_fileMenuOption(
- StringsLocalizations.of(context).recreateStream,
+ context.strings.recreateStream,
value: 9,
hugeIcon: HugeIcons.strokeRoundedRefresh,
),
@@ -430,8 +428,8 @@ class FileAppBarState extends State<FileAppBar> {
items.add(
_fileMenuOption(
shouldLoopVideo
- ? StringsLocalizations.of(context).loopVideoOn
- : StringsLocalizations.of(context).loopVideoOff,
+ ? context.strings.loopVideoOn
+ : context.strings.loopVideoOff,
value: 7,
hugeIcon: shouldLoopVideo
? HugeIcons.strokeRoundedRepeatOff
@@ -598,7 +596,7 @@ class FileAppBarState extends State<FileAppBar> {
await getExistingLocalFolderNameForDownloadSkipToast(file);
if (existingFolderName != null) {
if (mounted) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
showToast(
context,
l10n.downloadSkippedAlreadyAvailableOnDevice(
@@ -633,7 +631,7 @@ class FileAppBarState extends State<FileAppBar> {
if (!mounted) return;
final dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).downloading,
+ context.strings.downloading,
isDismissible: true,
);
await dialog.show();
@@ -646,7 +644,7 @@ class FileAppBarState extends State<FileAppBar> {
await dialog.hide();
return;
}
- showToast(context, StringsLocalizations.of(context).fileSavedToGallery);
+ showToast(context, context.strings.fileSavedToGallery);
await dialog.hide();
} catch (e) {
_logger.warning("Failed to save file", e);
@@ -661,13 +659,13 @@ class FileAppBarState extends State<FileAppBar> {
if (!file.isUploaded || !file.isOwner) {
showShortToast(
context,
- StringsLocalizations.of(context).canOnlyCreateLinkForFilesOwnedByYou,
+ context.strings.canOnlyCreateLinkForFilesOwnedByYou,
);
return;
}
final dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).creatingLink,
+ context.strings.creatingLink,
isDismissible: true,
);
await dialog.show();
@@ -693,10 +691,7 @@ class FileAppBarState extends State<FileAppBar> {
}
Future<void> _setAs(EnteFile file) async {
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).pleaseWait,
- );
+ final dialog = createProgressDialog(context, context.strings.pleaseWait);
await dialog.show();
try {
final File? fileToSave = await (getFile(file));
@@ -707,10 +702,7 @@ class FileAppBarState extends State<FileAppBar> {
final bool result = await m.setAs("file://${fileToSave.path}", "image/*");
if (result == false) {
if (!mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
}
await dialog.hide();
} catch (e) {
@@ -729,8 +721,8 @@ class FileAppBarState extends State<FileAppBar> {
if (!mounted) return;
await showErrorDialog(
context,
- StringsLocalizations.of(context).noSystemLockFound,
- StringsLocalizations.of(context).guestViewEnablePreSteps,
+ context.strings.noSystemLockFound,
+ context.strings.guestViewEnablePreSteps,
);
}
}
@@ -780,15 +772,12 @@ class FileAppBarState extends State<FileAppBar> {
if (!wasAdded) {
// File was already in queue
if (!mounted) return;
- showToast(
- context,
- StringsLocalizations.of(context).videoAlreadyInQueue,
- );
+ showToast(context, context.strings.videoAlreadyInQueue);
return;
}
if (!mounted) return;
- showToast(context, StringsLocalizations.of(context).addedToQueue);
+ showToast(context, context.strings.addedToQueue);
if (mounted) {
setState(() {
diff --git a/mobile/apps/photos/lib/ui/viewer/file/file_bottom_bar.dart b/mobile/apps/photos/lib/ui/viewer/file/file_bottom_bar.dart
index a33f5f1f87..0b2136aac1 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/file_bottom_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/file_bottom_bar.dart
@@ -118,7 +118,7 @@ class FileBottomBarState extends State<FileBottomBar> {
if (isOwnedByUser) {
children.add(
Tooltip(
- message: StringsLocalizations.of(context).delete,
+ message: context.strings.delete,
child: Padding(
padding: const EdgeInsets.only(top: 12),
child: IconButton(
@@ -149,7 +149,7 @@ class FileBottomBarState extends State<FileBottomBar> {
children.add(
Tooltip(
- message: StringsLocalizations.of(context).share,
+ message: context.strings.share,
child: Padding(
padding: const EdgeInsets.only(top: 12),
child: IconButton(
@@ -171,7 +171,7 @@ class FileBottomBarState extends State<FileBottomBar> {
if (widget.file.isUploaded && !isFileHidden) {
children.add(
Tooltip(
- message: StringsLocalizations.of(context).addToAlbum,
+ message: context.strings.addToAlbum,
child: Padding(
padding: const EdgeInsets.only(top: 12),
child: IconButton(
@@ -248,7 +248,7 @@ class FileBottomBarState extends State<FileBottomBar> {
void _addTrashOptions(List<Widget> children) {
children.add(
Tooltip(
- message: StringsLocalizations.of(context).restore,
+ message: context.strings.restore,
child: Padding(
padding: const EdgeInsets.only(top: 12),
child: IconButton(
@@ -269,7 +269,7 @@ class FileBottomBarState extends State<FileBottomBar> {
children.add(
Tooltip(
- message: StringsLocalizations.of(context).delete,
+ message: context.strings.delete,
child: Padding(
padding: const EdgeInsets.only(top: 12),
child: IconButton(
@@ -293,7 +293,7 @@ class FileBottomBarState extends State<FileBottomBar> {
Widget _buildSuggestDeleteButton(Collection collection) {
return Tooltip(
- message: StringsLocalizations.of(context).suggestDeletion,
+ message: context.strings.suggestDeletion,
child: Padding(
padding: const EdgeInsets.only(top: 12),
child: IconButton(
diff --git a/mobile/apps/photos/lib/ui/viewer/file/file_caption_widget.dart b/mobile/apps/photos/lib/ui/viewer/file/file_caption_widget.dart
index b656887642..57247fab22 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/file_caption_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/file_caption_widget.dart
@@ -37,9 +37,7 @@ class _FileCaptionWidgetState extends State<FileCaptionWidget> {
final _textController = TextEditingController();
final _focusNode = FocusNode();
String? editedCaption;
- late String defaultHintText = StringsLocalizations.of(
- context,
- ).fileInfoAddDescHint;
+ late String defaultHintText = context.strings.fileInfoAddDescHint;
@override
void initState() {
@@ -82,7 +80,7 @@ class _FileCaptionWidgetState extends State<FileCaptionWidget> {
const SizedBox(width: Spacing.sm),
IconButtonComponent(
variant: IconButtonComponentVariant.green,
- tooltip: StringsLocalizations.of(context).done,
+ tooltip: context.strings.done,
icon: const HugeIcon(icon: HugeIcons.strokeRoundedTick02),
onTap: _hasPendingCaptionEdit ? onDoneTap : null,
),
@@ -123,10 +121,7 @@ class _FileCaptionWidgetState extends State<FileCaptionWidget> {
}
return true;
} else {
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
return false;
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/file/file_details_widget.dart b/mobile/apps/photos/lib/ui/viewer/file/file_details_widget.dart
index d741744340..2d6fdc8286 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/file_details_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/file_details_widget.dart
@@ -337,14 +337,14 @@ class _FileDetailsWidgetState extends State<FileDetailsWidget> {
toolbarHeight: 38,
titleSpacing: 0,
title: Text(
- StringsLocalizations.of(context).details,
+ context.strings.details,
style: TextStyles.h2.copyWith(
color: context.componentColors.textBase,
),
),
actions: [
IconButtonComponent(
- tooltip: StringsLocalizations.of(context).close,
+ tooltip: context.strings.close,
variant: IconButtonComponentVariant.circular,
shouldSurfaceExecutionStates: false,
icon: const HugeIcon(
diff --git a/mobile/apps/photos/lib/ui/viewer/file/file_icons_widget.dart b/mobile/apps/photos/lib/ui/viewer/file/file_icons_widget.dart
index 692c811297..bb6327bc02 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/file_icons_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/file_icons_widget.dart
@@ -171,9 +171,7 @@ class TrashedFileOverlayText extends StatelessWidget {
((file.deleteBy - DateTime.now().microsecondsSinceEpoch) /
Duration.microsecondsPerDay)
.ceil();
- final text = StringsLocalizations.of(
- context,
- ).trashDaysLeft(count: daysLeft);
+ final text = context.strings.trashDaysLeft(count: daysLeft);
return FileOverlayText(text);
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/file/panorama_viewer_screen.dart b/mobile/apps/photos/lib/ui/viewer/file/panorama_viewer_screen.dart
index 6293284eb9..29913971ac 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/panorama_viewer_screen.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/panorama_viewer_screen.dart
@@ -190,7 +190,7 @@ class _PanoramaViewerScreenState extends State<PanoramaViewerScreen> {
child: Align(
alignment: Alignment.bottomRight,
child: Tooltip(
- message: StringsLocalizations.of(context).panorama,
+ message: context.strings.panorama,
child: Padding(
padding: const EdgeInsets.only(
top: 12,
diff --git a/mobile/apps/photos/lib/ui/viewer/file/qr_code_content_sheet.dart b/mobile/apps/photos/lib/ui/viewer/file/qr_code_content_sheet.dart
index e72c5ddae8..99c82cce5f 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/qr_code_content_sheet.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/qr_code_content_sheet.dart
@@ -15,7 +15,7 @@ Future<void> showQrCodeContentSheet(
}) {
return showBaseBottomSheet(
context,
- title: StringsLocalizations.of(context).qrCode,
+ title: context.strings.qrCode,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -38,7 +38,7 @@ class _QrContentEntry extends StatelessWidget {
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final uri = Uri.tryParse(content);
final isUrl =
uri != null && (uri.scheme == "http" || uri.scheme == "https");
diff --git a/mobile/apps/photos/lib/ui/viewer/file/video_stream_change.dart b/mobile/apps/photos/lib/ui/viewer/file/video_stream_change.dart
index dee8399930..a7a70b3297 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/video_stream_change.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/video_stream_change.dart
@@ -77,11 +77,11 @@ class _VideoStreamChangeWidgetState extends State<VideoStreamChangeWidget> {
switch (status) {
case PreviewItemStatus.inQueue:
case PreviewItemStatus.retry:
- return StringsLocalizations.of(context).queued;
+ return context.strings.queued;
case PreviewItemStatus.compressing:
case PreviewItemStatus.uploading:
default:
- return StringsLocalizations.of(context).creatingStream;
+ return context.strings.creatingStream;
}
}
@@ -177,8 +177,8 @@ class _VideoStreamChangeWidgetState extends State<VideoStreamChangeWidget> {
const SizedBox(width: 2),
Text(
widget.isPreviewPlayer
- ? StringsLocalizations.of(context).playOriginal
- : StringsLocalizations.of(context).playStream,
+ ? context.strings.playOriginal
+ : context.strings.playStream,
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
diff --git a/mobile/apps/photos/lib/ui/viewer/file/video_widget_media_kit.dart b/mobile/apps/photos/lib/ui/viewer/file/video_widget_media_kit.dart
index 9cb13913fc..b6f3ac3030 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/video_widget_media_kit.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/video_widget_media_kit.dart
@@ -310,10 +310,7 @@ class _VideoWidgetMediaKitState extends State<VideoWidgetMediaKit>
_progressNotifier.value = count / (widget.file.fileSize ?? total);
if (_progressNotifier.value == 1) {
if (mounted) {
- showShortToast(
- context,
- StringsLocalizations.of(context).decryptingVideo,
- );
+ showShortToast(context, context.strings.decryptingVideo);
}
}
},
@@ -327,8 +324,8 @@ class _VideoWidgetMediaKitState extends State<VideoWidgetMediaKit>
if (!mounted) return;
showErrorDialog(
context,
- StringsLocalizations.of(context).error,
- StringsLocalizations.of(context).failedToDownloadVideo,
+ context.strings.error,
+ context.strings.failedToDownloadVideo,
);
});
}
diff --git a/mobile/apps/photos/lib/ui/viewer/file/video_widget_native.dart b/mobile/apps/photos/lib/ui/viewer/file/video_widget_native.dart
index f8f9b05468..3d1f0004f9 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/video_widget_native.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/video_widget_native.dart
@@ -622,10 +622,7 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
_progressNotifier.value = count / (widget.file.fileSize ?? total);
if (_progressNotifier.value == 1) {
if (mounted) {
- showShortToast(
- context,
- StringsLocalizations.of(context).decryptingVideo,
- );
+ showShortToast(context, context.strings.decryptingVideo);
}
}
},
@@ -639,8 +636,8 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
if (!mounted) return;
showErrorDialog(
context,
- StringsLocalizations.of(context).error,
- StringsLocalizations.of(context).failedToDownloadVideo,
+ context.strings.error,
+ context.strings.failedToDownloadVideo,
);
});
}
diff --git a/mobile/apps/photos/lib/ui/viewer/file/zoomable_live_image_new.dart b/mobile/apps/photos/lib/ui/viewer/file/zoomable_live_image_new.dart
index be30fe43b4..3dcff74d30 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/zoomable_live_image_new.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/zoomable_live_image_new.dart
@@ -289,7 +289,7 @@ class _ZoomableLiveImageNewState extends State<ZoomableLiveImageNew>
if (videoFile != null && videoFile.existsSync()) {
await _setVideoController(videoFile.path);
} else if (_enteFile.isLivePhoto) {
- showShortToast(context, StringsLocalizations.of(context).downloadFailed);
+ showShortToast(context, context.strings.downloadFailed);
}
return result.availability;
}
@@ -298,7 +298,7 @@ class _ZoomableLiveImageNewState extends State<ZoomableLiveImageNew>
if (_enteFile.isRemoteOnlyFile &&
!(await isFileCached(_enteFile, liveVideo: true))) {
if (!mounted) return null;
- showShortToast(context, StringsLocalizations.of(context).downloading);
+ showShortToast(context, context.strings.downloading);
}
File? videoFile = await getFile(widget.enteFile, liveVideo: true)
@@ -331,7 +331,7 @@ class _ZoomableLiveImageNewState extends State<ZoomableLiveImageNew>
null,
);
}
- showShortToast(context, StringsLocalizations.of(context).downloading);
+ showShortToast(context, context.strings.downloading);
}
final File? imageFile =
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/added_by_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/added_by_widget.dart
index b93d61a77b..3c000055c5 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/added_by_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/added_by_widget.dart
@@ -48,9 +48,7 @@ class AddedByWidget extends StatelessWidget {
const SizedBox(width: Spacing.sm),
Flexible(
child: Text(
- StringsLocalizations.of(
- context,
- ).addedBy(emailOrName: identity.label),
+ context.strings.addedBy(emailOrName: identity.label),
style: TextStyles.mini.copyWith(color: colors.textLighter),
overflow: TextOverflow.ellipsis,
),
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/albums_item_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/albums_item_widget.dart
index c37c62de0d..21aa651632 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/albums_item_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/albums_item_widget.dart
@@ -39,7 +39,7 @@ class AlbumsItemWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
- Text(StringsLocalizations.of(context).albums, style: TextStyles.h2),
+ Text(context.strings.albums, style: TextStyles.h2),
const SizedBox(height: Spacing.lg),
FutureBuilder<List<Widget>>(
future: chipsFuture,
@@ -89,9 +89,7 @@ class AlbumsItemWidget extends StatelessWidget {
final c = CollectionsService.instance.getCollectionByID(collectionID)!;
chips.add(
FilterChipComponent(
- label: c.isHidden()
- ? StringsLocalizations.of(context).hidden
- : c.displayName,
+ label: c.isHidden() ? context.strings.hidden : c.displayName,
onChanged: (_) {
if (c.isHidden()) {
return;
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/exif_item_widgets.dart b/mobile/apps/photos/lib/ui/viewer/file_details/exif_item_widgets.dart
index bde65fcd4c..8d89c230a8 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/exif_item_widgets.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/exif_item_widgets.dart
@@ -48,7 +48,7 @@ class AllExifItemWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final currentExif = exif;
late final String label;
late final VoidCallback? onTap;
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/favorite_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/favorite_widget.dart
index e6900db11f..f49cf18d58 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/favorite_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/favorite_widget.dart
@@ -128,10 +128,7 @@ class _FavoriteWidgetState extends State<FavoriteWidget> {
_logger.severe("Failed to add file to favorites", e, s);
hasError = true;
if (!mounted) return;
- showToast(
- context,
- StringsLocalizations.of(context).sorryCouldNotAddToFavorites,
- );
+ showToast(context, context.strings.sorryCouldNotAddToFavorites);
_stateMachine?.trigger("Stroke")?.fire();
}
} else {
@@ -147,10 +144,7 @@ class _FavoriteWidgetState extends State<FavoriteWidget> {
_logger.severe("Failed to remove file from favorites", e, s);
hasError = true;
if (!mounted) return;
- showToast(
- context,
- StringsLocalizations.of(context).sorryCouldNotRemoveFromFavorites,
- );
+ showToast(context, context.strings.sorryCouldNotRemoveFromFavorites);
_stateMachine?.trigger("Filled")?.fire();
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/file_info_face_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/file_info_face_widget.dart
index 6fd5d95fce..081dc39d57 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/file_info_face_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/file_info_face_widget.dart
@@ -161,7 +161,7 @@ class _FileInfoFaceWidgetState extends State<FileInfoFaceWidget> {
child: Center(
child: Text(
widget.person!.data.isIgnored
- ? '(' + StringsLocalizations.of(context).ignored + ')'
+ ? '(' + context.strings.ignored + ')'
: widget.person!.data.name.trim(),
style: TextStyles.body,
overflow: TextOverflow.ellipsis,
@@ -288,10 +288,7 @@ class _FileInfoFaceWidgetState extends State<FileInfoFaceWidget> {
}
if (!mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).faceNotClusteredYet,
- );
+ showShortToast(context, context.strings.faceNotClusteredYet);
unawaited(MLService.instance.clusterAllImages(force: true));
return;
}
@@ -323,11 +320,11 @@ class _FileInfoFaceWidgetState extends State<FileInfoFaceWidget> {
if (widget.person == null) return;
final result = await showChoiceActionSheet(
context,
- title: StringsLocalizations.of(context).removePersonLabel,
- body: StringsLocalizations.of(context).areYouSureRemoveThisFaceFromPerson,
- firstButtonLabel: StringsLocalizations.of(context).remove,
+ title: context.strings.removePersonLabel,
+ body: context.strings.areYouSureRemoveThisFaceFromPerson,
+ firstButtonLabel: context.strings.remove,
firstButtonType: ButtonType.critical,
- secondButtonLabel: StringsLocalizations.of(context).cancel,
+ secondButtonLabel: context.strings.cancel,
isCritical: true,
);
if (result?.action == ButtonAction.first) {
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/file_info_faces_item_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/file_info_faces_item_widget.dart
index 01fd0ab664..66014dcd08 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/file_info_faces_item_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/file_info_faces_item_widget.dart
@@ -144,7 +144,7 @@ class _FacesItemWidgetState extends State<FacesItemWidget> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
- Text(StringsLocalizations.of(context).people, style: TextStyles.h2),
+ Text(context.strings.people, style: TextStyles.h2),
_editStateButton(),
],
),
@@ -298,7 +298,7 @@ class _FacesItemWidgetState extends State<FacesItemWidget> {
}
Widget _buildNoFacesWidget() {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final reason = _errorReason ?? NoFacesReason.noFacesFound;
final showManualTagOption =
!isLocalGalleryMode &&
@@ -401,7 +401,7 @@ class _FacesItemWidgetState extends State<FacesItemWidget> {
child: Row(
children: [
Text(
- StringsLocalizations.of(context).otherDetectedFaces,
+ context.strings.otherDetectedFaces,
style: TextStyles.bodyBold,
),
const Spacer(),
@@ -451,7 +451,7 @@ class _FacesItemWidgetState extends State<FacesItemWidget> {
const SizedBox(width: 8),
],
ButtonComponent(
- label: StringsLocalizations.of(context).done,
+ label: context.strings.done,
variant: ButtonComponentVariant.link,
size: ButtonComponentSize.small,
shouldSurfaceExecutionStates: false,
@@ -516,7 +516,7 @@ class _FacesItemWidgetState extends State<FacesItemWidget> {
final selectedFaces = _selectedFaceInfos();
if (selectedFaces.isEmpty) return;
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final multiple = selectedFaces.length > 1;
final result = await showChoiceActionSheet(
context,
@@ -801,11 +801,11 @@ class _FacesItemWidgetState extends State<FacesItemWidget> {
Future<void> _onRemoveManualPerson(PersonEntity person) async {
final result = await showChoiceActionSheet(
context,
- title: StringsLocalizations.of(context).removePersonTag,
- body: StringsLocalizations.of(context).areYouSureRemoveThisPersonTag,
- firstButtonLabel: StringsLocalizations.of(context).remove,
+ title: context.strings.removePersonTag,
+ body: context.strings.areYouSureRemoveThisPersonTag,
+ firstButtonLabel: context.strings.remove,
firstButtonType: ButtonType.critical,
- secondButtonLabel: StringsLocalizations.of(context).cancel,
+ secondButtonLabel: context.strings.cancel,
isCritical: true,
);
if (result?.action == ButtonAction.first) {
@@ -877,7 +877,7 @@ class _ManualPersonTag extends StatelessWidget {
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final displayName = person.data.isIgnored
- ? '(' + StringsLocalizations.of(context).ignored + ')'
+ ? '(' + context.strings.ignored + ')'
: person.data.name.trim();
return Semantics(
@@ -962,14 +962,14 @@ enum NoFacesReason {
String getNoFaceReasonText(BuildContext context, NoFacesReason reason) {
switch (reason) {
case NoFacesReason.fileNotUploaded:
- return StringsLocalizations.of(context).fileNotUploadedYet;
+ return context.strings.fileNotUploadedYet;
case NoFacesReason.fileNotAnalyzed:
- return StringsLocalizations.of(context).imageNotAnalyzed;
+ return context.strings.imageNotAnalyzed;
case NoFacesReason.noFacesFound:
- return StringsLocalizations.of(context).noFacesFound;
+ return context.strings.noFacesFound;
case NoFacesReason.faceThumbnailGenerationFailed:
- return StringsLocalizations.of(context).faceThumbnailGenerationFailed;
+ return context.strings.faceThumbnailGenerationFailed;
case NoFacesReason.fileAnalysisFailed:
- return StringsLocalizations.of(context).fileAnalysisFailed;
+ return context.strings.fileAnalysisFailed;
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/file_info_pets_item_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/file_info_pets_item_widget.dart
index 322637aca0..c843dcaeed 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/file_info_pets_item_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/file_info_pets_item_widget.dart
@@ -178,10 +178,7 @@ class _PetsItemWidgetState extends State<PetsItemWidget> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(
- StringsLocalizations.of(context).discover_pets,
- style: textTheme.small,
- ),
+ Text(context.strings.discover_pets, style: textTheme.small),
const SizedBox(height: 10),
Padding(
padding: const EdgeInsets.only(right: 12.0),
@@ -206,7 +203,7 @@ class _PetsItemWidgetState extends State<PetsItemWidget> {
double thumbnailWidth,
EnteTextTheme textTheme,
) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final speciesLabel = info.species == 0 ? l10n.dog : l10n.cat;
return SizedBox(
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/location_tags_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/location_tags_widget.dart
index b237e6ee01..44995e95ab 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/location_tags_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/location_tags_widget.dart
@@ -68,10 +68,7 @@ class _LocationTagsWidgetState extends State<LocationTagsWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
- Text(
- title ?? StringsLocalizations.of(context).location,
- style: TextStyles.h2,
- ),
+ Text(title ?? context.strings.location, style: TextStyles.h2),
const SizedBox(height: Spacing.lg),
FutureBuilder<List<Widget>>(
future: locationTagChips,
@@ -111,13 +108,13 @@ class _LocationTagsWidgetState extends State<LocationTagsWidget> {
if (locationTags.isEmpty) {
if (mounted) {
setState(() {
- title = StringsLocalizations.of(context).location;
+ title = context.strings.location;
});
}
if (!mounted) return const [];
return [
FilterChipComponent(
- label: StringsLocalizations.of(context).addLocation,
+ label: context.strings.addLocation,
onChanged: (_) =>
showAddLocationSheet(context, widget.file.location!),
),
@@ -125,7 +122,7 @@ class _LocationTagsWidgetState extends State<LocationTagsWidget> {
} else {
if (mounted) {
setState(() {
- title = StringsLocalizations.of(context).location;
+ title = context.strings.location;
});
}
final result = locationTags
@@ -308,17 +305,13 @@ class _InfoMapState extends State<InfoMap> {
if (!context.mounted) return;
showShortToast(
context,
- StringsLocalizations.of(
- context,
- ).somethingWentWrong,
+ context.strings.somethingWentWrong,
);
}
},
child: Center(
child: Text(
- StringsLocalizations.of(
- context,
- ).enableMaps,
+ context.strings.enableMaps,
style: getEnteTextTheme(context).small,
),
),
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/preview_properties_item_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/preview_properties_item_widget.dart
index cfd7c6dcbd..51d4d686ad 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/preview_properties_item_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/preview_properties_item_widget.dart
@@ -89,7 +89,7 @@ class _PreviewPropertiesItemWidgetState
size: IconSizes.small,
color: context.componentColors.textLight,
),
- title: StringsLocalizations.of(context).streamDetails,
+ title: context.strings.streamDetails,
subtitleSection: Future.value(subSectionWidgets),
useMenuStyle: true,
);
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/upload_icon_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/upload_icon_widget.dart
index da8a5a140d..cbd297f7af 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/upload_icon_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/upload_icon_widget.dart
@@ -104,17 +104,17 @@ class _UpdateIconWidgetState extends State<UploadIconWidget> {
if (isIgnored && (kDebugMode || ignoreReason != kIgnoreReasonTrash)) {
showToast(
context,
- StringsLocalizations.of(
- context,
- ).uploadIsIgnoredDueToIgnorereason(ignoreReason: ignoreReason),
+ context.strings.uploadIsIgnoredDueToIgnorereason(
+ ignoreReason: ignoreReason,
+ ),
);
}
return Tooltip(
message: isIgnored
- ? StringsLocalizations.of(
- context,
- ).tapToUploadIsIgnoredDue(ignoreReason: ignoreReason)
- : StringsLocalizations.of(context).tapToUpload,
+ ? context.strings.tapToUploadIsIgnoredDue(
+ ignoreReason: ignoreReason,
+ )
+ : context.strings.tapToUpload,
child: IconButton(
icon: const Icon(Icons.upload_rounded, color: Colors.white),
onPressed: () async {
diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/video_exif_item.dart b/mobile/apps/photos/lib/ui/viewer/file_details/video_exif_item.dart
index 290f810e8e..4835da443b 100644
--- a/mobile/apps/photos/lib/ui/viewer/file_details/video_exif_item.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file_details/video_exif_item.dart
@@ -17,7 +17,7 @@ class VideoExifRowItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final currentProps = props;
late final String label;
late final VoidCallback? onTap;
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dart
index 7c3ce60768..ddf9cb60f7 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dart
@@ -83,7 +83,7 @@ class _ArchivePageState extends State<ArchivePage> {
.getHiddenCollectionIds();
final appBar = GalleryAppBarWidget.sliverConfig(
widget.appBarType,
- StringsLocalizations.of(context).archive,
+ context.strings.archive,
_selectedFiles,
);
final gallery = Gallery(
@@ -127,9 +127,7 @@ class _ArchivePageState extends State<ArchivePage> {
emptyState: _archivedCollections.isEmpty
? EmptyStateComponent(
assetPath: "assets/empty_state_archive.png",
- title: StringsLocalizations.of(
- context,
- ).archivedItemsWillShowUpHere,
+ title: context.strings.archivedItemsWillShowUpHere,
)
: const SizedBox.shrink(),
header: AlbumHorizontalList(
@@ -141,9 +139,7 @@ class _ArchivePageState extends State<ArchivePage> {
CollectionListPage(
_archivedCollections,
sectionType: UISectionType.archivedCollections,
- appTitle: Text(
- StringsLocalizations.of(context).archiveCollectionName,
- ),
+ appTitle: Text(context.strings.archiveCollectionName),
tag: "archived",
),
);
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/cleanup_hidden_files_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/cleanup_hidden_files_widget.dart
index 0bada78e80..4343b1457e 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/cleanup_hidden_files_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/cleanup_hidden_files_widget.dart
@@ -17,7 +17,7 @@ class CleanupHiddenFilesWidget extends StatelessWidget {
child: Column(
children: [
MenuComponent(
- title: StringsLocalizations.of(context).cleanupHiddenFiles,
+ title: context.strings.cleanupHiddenFiles,
leading: const Icon(Icons.cleaning_services_outlined),
shouldSurfaceExecutionStates: true,
shouldShowSuccessConfirmation: true,
@@ -27,9 +27,7 @@ class CleanupHiddenFilesWidget extends StatelessWidget {
},
),
MenuSectionDescriptionWidget(
- content: StringsLocalizations.of(
- context,
- ).cleanupHiddenFilesDescription,
+ content: context.strings.cleanupHiddenFilesDescription,
),
],
),
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/cleanup_hidden_from_device_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/cleanup_hidden_from_device_page.dart
index e357f06e71..83b80a50ca 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/cleanup_hidden_from_device_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/cleanup_hidden_from_device_page.dart
@@ -62,7 +62,7 @@ class _CleanupHiddenFromDevicePageState
final deleteAllButtonHeight = 40.0 + max(bottomPadding, 6.0) + 12.0;
final appBar = GalleryAppBarWidget.sliverConfig(
GalleryType.cleanupHiddenFromDevice,
- StringsLocalizations.of(context).deleteOnDeviceFiles,
+ context.strings.deleteOnDeviceFiles,
_selectedFiles,
);
@@ -78,9 +78,7 @@ class _CleanupHiddenFromDevicePageState
tagPrefix: "cleanup_hidden_from_device",
selectedFiles: _selectedFiles,
enableFileGrouping: false,
- emptyState: EmptyState(
- text: StringsLocalizations.of(context).noHiddenFilesOnDevice,
- ),
+ emptyState: EmptyState(text: context.strings.noHiddenFilesOnDevice),
);
return GalleryBoundariesProvider(
@@ -145,7 +143,7 @@ class _CleanupHiddenFromDevicePageState
horizontal: 16,
),
child: Text(
- StringsLocalizations.of(context).deleteAll,
+ context.strings.deleteAll,
style: Theme.of(context).textTheme.titleSmall!.copyWith(
color: const Color.fromRGBO(255, 101, 101, 1),
),
@@ -165,7 +163,7 @@ class _CleanupHiddenFromDevicePageState
if (allFiles.isEmpty) return;
if (!mounted) return;
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
if (!mounted) return;
final actionResult = await showActionSheet(
context: context,
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/cleanup_hidden_from_device_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/cleanup_hidden_from_device_widget.dart
index d1f680eb05..d6e1b8e75d 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/cleanup_hidden_from_device_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/cleanup_hidden_from_device_widget.dart
@@ -20,7 +20,7 @@ class CleanupHiddenFromDeviceWidget extends StatelessWidget {
child: Column(
children: [
MenuComponent(
- title: StringsLocalizations.of(context).deleteHiddenFilesFromDevice,
+ title: context.strings.deleteHiddenFilesFromDevice,
leading: const Icon(Icons.phone_android_outlined),
trailing: const Icon(Icons.chevron_right),
onTap: () async {
@@ -33,9 +33,7 @@ class CleanupHiddenFromDeviceWidget extends StatelessWidget {
},
),
MenuSectionDescriptionWidget(
- content: StringsLocalizations.of(
- context,
- ).deleteHiddenFilesFromDeviceDescription,
+ content: context.strings.deleteHiddenFilesFromDeviceDescription,
),
],
),
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/component/group/group_header_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/component/group/group_header_widget.dart
index 44bdff56cc..4831a37a4e 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/component/group/group_header_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/component/group/group_header_widget.dart
@@ -100,14 +100,10 @@ class _GroupHeaderWidgetState extends State<GroupHeaderWidget> {
child: Text(
widget.title,
style:
- (widget.title ==
- StringsLocalizations.of(context).dayToday ||
- widget.title ==
- StringsLocalizations.of(context).thisWeek ||
- widget.title ==
- StringsLocalizations.of(context).thisMonth ||
- widget.title ==
- StringsLocalizations.of(context).thisYear)
+ (widget.title == context.strings.dayToday ||
+ widget.title == context.strings.thisWeek ||
+ widget.title == context.strings.thisMonth ||
+ widget.title == context.strings.thisYear)
? textStyle
: textStyle.copyWith(color: colorScheme.textMuted),
maxLines: 1,
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/component/group/type.dart b/mobile/apps/photos/lib/ui/viewer/gallery/component/group/type.dart
index 6dc2a6180f..53dc8b30be 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/component/group/type.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/component/group/type.dart
@@ -28,15 +28,15 @@ extension GroupTypeExtension on GroupType {
String getLocalizedName(BuildContext context) {
switch (this) {
case GroupType.day:
- return StringsLocalizations.of(context).groupByDay;
+ return context.strings.groupByDay;
case GroupType.week:
- return StringsLocalizations.of(context).groupByWeek;
+ return context.strings.groupByWeek;
case GroupType.month:
- return StringsLocalizations.of(context).groupByMonth;
+ return context.strings.groupByMonth;
case GroupType.size:
return "Size";
case GroupType.year:
- return StringsLocalizations.of(context).groupByYear;
+ return context.strings.groupByYear;
case GroupType.none:
return "None";
}
@@ -193,9 +193,9 @@ extension GroupTypeExtension on GroupType {
final now = DateTime.now();
if (date.year == now.year && date.month == now.month) {
if (date.day == now.day) {
- return StringsLocalizations.of(context).dayToday;
+ return context.strings.dayToday;
} else if (date.day == now.day - 1) {
- return StringsLocalizations.of(context).dayYesterday;
+ return context.strings.dayYesterday;
}
}
if (date.year != DateTime.now().year) {
@@ -220,7 +220,7 @@ extension GroupTypeExtension on GroupType {
if (startOfWeek.year == nowStartOfWeek.year &&
startOfWeek.month == nowStartOfWeek.month &&
startOfWeek.day == nowStartOfWeek.day) {
- return StringsLocalizations.of(context).thisWeek;
+ return context.strings.thisWeek;
}
// Check if it's the previous week
@@ -228,7 +228,7 @@ extension GroupTypeExtension on GroupType {
if (startOfWeek.year == lastWeekStart.year &&
startOfWeek.month == lastWeekStart.month &&
startOfWeek.day == lastWeekStart.day) {
- return StringsLocalizations.of(context).lastWeek;
+ return context.strings.lastWeek;
}
// Return formatted week range
@@ -241,7 +241,7 @@ extension GroupTypeExtension on GroupType {
final now = DateTime.now();
if (date.year == now.year && date.month == now.month) {
- return StringsLocalizations.of(context).thisMonth;
+ return context.strings.thisMonth;
}
return DateFormat.yMMM(
@@ -254,7 +254,7 @@ extension GroupTypeExtension on GroupType {
final now = DateTime.now();
if (date.year == now.year) {
- return StringsLocalizations.of(context).thisYear;
+ return context.strings.thisYear;
}
return DateFormat.y(
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/delete_suggestions_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/delete_suggestions_page.dart
index ad9605c2a7..ea25d522a0 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/delete_suggestions_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/delete_suggestions_page.dart
@@ -31,7 +31,7 @@ class DeleteSuggestionsPage extends StatelessWidget {
Widget build(BuildContext context) {
final appBar = GalleryAppBarWidget.sliverConfig(
appBarType,
- StringsLocalizations.of(context).deleteSuggestions,
+ context.strings.deleteSuggestions,
_selectedFiles,
);
final gallery = Gallery(
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/device/backup_header_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/device/backup_header_widget.dart
index ef3a409c51..2dcdb4019f 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/device/backup_header_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/device/backup_header_widget.dart
@@ -71,7 +71,7 @@ class _BackupHeaderWidgetState extends State<BackupHeaderWidget> {
}
Widget _buildBackupRow(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return MenuItemWidgetNew(
title: l10n.backup,
subText: l10n.autoUploadFromThisDeviceFolder,
@@ -88,7 +88,7 @@ class _BackupHeaderWidgetState extends State<BackupHeaderWidget> {
}
Widget _buildSkippedFilesRow(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return FutureBuilder<Set<IgnoredUploadReasonBucket>>(
future: _ignoredUploadBuckets,
builder: (context, snapshot) {
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/device/device_folder_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/device/device_folder_page.dart
index edb10fa877..09af4303fa 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/device/device_folder_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/device/device_folder_page.dart
@@ -63,7 +63,7 @@ class _DeviceFolderPageState extends State<DeviceFolderPage> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final appBar = GalleryAppBarWidget.sliverConfig(
GalleryType.localFolder,
widget.deviceCollection.name,
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/device/ignored_uploads.dart b/mobile/apps/photos/lib/ui/viewer/gallery/device/ignored_uploads.dart
index 9f84c63fdb..344f17ee14 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/device/ignored_uploads.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/device/ignored_uploads.dart
@@ -60,7 +60,7 @@ String ignoredUploadReasonBucketLabel(
BuildContext context,
IgnoredUploadReasonBucket bucket,
) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return switch (bucket) {
IgnoredUploadReasonBucket.iCloudUnavailable => l10n.iCloudUnavailable,
IgnoredUploadReasonBucket.deletedFromEnte => l10n.deletedFromEnte,
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/device/skipped_device_folder_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/device/skipped_device_folder_page.dart
index 2f2ddaa0c3..452143c819 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/device/skipped_device_folder_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/device/skipped_device_folder_page.dart
@@ -93,7 +93,7 @@ class _SkippedDeviceFolderPageState extends State<SkippedDeviceFolderPage> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final appBar = GalleryAppBarWidget.sliverConfig(
GalleryType.localFolder,
l10n.skippedFiles,
@@ -339,13 +339,13 @@ class _ResetIgnoredFilesSection extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- StringsLocalizations.of(context).resetIgnoredFilesDescription,
+ context.strings.resetIgnoredFilesDescription,
style: textTheme.smallMuted,
),
const SizedBox(height: 12),
ButtonComponent(
variant: ButtonComponentVariant.secondary,
- label: StringsLocalizations.of(context).resetIgnoredFiles,
+ label: context.strings.resetIgnoredFiles,
onTap: onResetIgnoredFiles,
),
],
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/empty_album_state.dart b/mobile/apps/photos/lib/ui/viewer/gallery/empty_album_state.dart
index 642bbd2f15..ef4e8fba45 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/empty_album_state.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/empty_album_state.dart
@@ -26,9 +26,7 @@ class EmptyAlbumState extends StatelessWidget {
Image.asset("assets/albums-widget-static.png", height: 160),
const SizedBox(height: 16),
Text(
- StringsLocalizations.of(
- context,
- ).startWithAddingPhotosOrFamiliarFaces,
+ context.strings.startWithAddingPhotosOrFamiliarFaces,
style: TextStyles.display2.copyWith(color: colors.textBase),
textAlign: TextAlign.center,
),
@@ -43,7 +41,7 @@ class EmptyAlbumState extends StatelessWidget {
children: [
ButtonComponent(
variant: ButtonComponentVariant.primary,
- label: StringsLocalizations.of(context).addPhotos,
+ label: context.strings.addPhotos,
shouldSurfaceExecutionStates: false,
onTap: () async {
try {
@@ -57,7 +55,7 @@ class EmptyAlbumState extends StatelessWidget {
const SizedBox(height: 12),
ButtonComponent(
variant: ButtonComponentVariant.neutral,
- label: StringsLocalizations.of(context).autoAddPeople,
+ label: context.strings.autoAddPeople,
shouldSurfaceExecutionStates: false,
onTap: () async {
await routeToPage(
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/empty_state.dart b/mobile/apps/photos/lib/ui/viewer/gallery/empty_state.dart
index ed51410d9c..3c9b47e587 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/empty_state.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/empty_state.dart
@@ -13,7 +13,7 @@ class EmptyState extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
- text ?? StringsLocalizations.of(context).nothingToSeeHere,
+ text ?? context.strings.nothingToSeeHere,
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
index c3206b7623..be792cb622 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
@@ -288,9 +288,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
galleryType != GalleryType.quickLink) {
showToast(
context,
- StringsLocalizations.of(
- context,
- ).typeOfGallerGallerytypeIsNotSupportedForRename(
+ context.strings.typeOfGallerGallerytypeIsNotSupportedForRename(
galleryType: "$galleryType",
),
);
@@ -300,12 +298,12 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
final result = await showTextInputDialog(
context,
title: isQuickLink
- ? StringsLocalizations.of(context).enterAlbumName
- : StringsLocalizations.of(context).renameAlbum,
+ ? context.strings.enterAlbumName
+ : context.strings.renameAlbum,
submitButtonLabel: isQuickLink
- ? StringsLocalizations.of(context).done
- : StringsLocalizations.of(context).rename,
- hintText: StringsLocalizations.of(context).enterAlbumName,
+ ? context.strings.done
+ : context.strings.rename,
+ hintText: context.strings.enterAlbumName,
alwaysShowSuccessState: true,
initialValue: widget.collection?.displayName ?? "",
textCapitalization: TextCapitalization.words,
@@ -348,7 +346,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
shouldStickToDarkTheme: true,
buttonAction: ButtonAction.first,
shouldSurfaceExecutionStates: true,
- labelText: StringsLocalizations.of(context).leaveAlbum,
+ labelText: context.strings.leaveAlbum,
onTap: () async {
await CollectionsService.instance.leaveAlbum(widget.collection!);
},
@@ -358,13 +356,11 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
buttonAction: ButtonAction.cancel,
isInAlert: true,
shouldStickToDarkTheme: true,
- labelText: StringsLocalizations.of(context).cancel,
+ labelText: context.strings.cancel,
),
],
- title: StringsLocalizations.of(context).leaveSharedAlbum,
- body: StringsLocalizations.of(
- context,
- ).photosAddedByYouWillBeRemovedFromTheAlbum,
+ title: context.strings.leaveSharedAlbum,
+ body: context.strings.photosAddedByYouWillBeRemovedFromTheAlbum,
);
if (actionResult?.action != null && mounted) {
if (actionResult!.action == ButtonAction.error) {
@@ -385,10 +381,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
// the space which can be claimed up. This code duplication should be removed
// whenever we move to the new design for free up space.
Future<dynamic> _deleteBackedUpFiles(BuildContext context) async {
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).calculating,
- );
+ final dialog = createProgressDialog(context, context.strings.calculating);
await dialog.show();
FreeableSpaceInfo status;
try {
@@ -407,10 +400,8 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
if (!context.mounted) return null;
await showErrorDialog(
context,
- StringsLocalizations.of(context).allClear,
- StringsLocalizations.of(
- context,
- ).youveNoFilesInThisAlbumThatCanBeDeleted,
+ context.strings.allClear,
+ context.strings.youveNoFilesInThisAlbumThatCanBeDeleted,
);
} else {
if (!context.mounted) return null;
@@ -427,22 +418,19 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
void _showSpaceFreedDialog(FreeableSpaceInfo status) {
showChoiceDialog(
context,
- title: StringsLocalizations.of(context).success,
- body: StringsLocalizations.of(
- context,
- ).youHaveSuccessfullyFreedUp(storageSaved: formatBytes(status.size)),
- firstButtonLabel: StringsLocalizations.of(context).rateUs,
+ title: context.strings.success,
+ body: context.strings.youHaveSuccessfullyFreedUp(
+ storageSaved: formatBytes(status.size),
+ ),
+ firstButtonLabel: context.strings.rateUs,
firstButtonOnTap: () async {
await updateService.launchReviewUrl();
},
firstButtonType: ButtonType.primary,
- secondButtonLabel: StringsLocalizations.of(context).ok,
+ secondButtonLabel: context.strings.ok,
secondButtonOnTap: () async {
if (Platform.isIOS) {
- showToast(
- context,
- StringsLocalizations.of(context).remindToEmptyDeviceTrash,
- );
+ showToast(context, context.strings.remindToEmptyDeviceTrash);
}
},
);
@@ -456,7 +444,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
return actions;
}
- final strings = StringsLocalizations.of(context);
+ final strings = context.strings;
final colorScheme = getEnteColorScheme(context);
if (galleryType == GalleryType.magic) {
@@ -637,10 +625,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
} else if (value == AlbumPopupAction.galleryGuestView) {
await _onGalleryGuestViewClick();
} else {
- showToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showToast(context, context.strings.somethingWentWrong);
}
},
),
@@ -962,9 +947,9 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
final actionResult = await showChoiceActionSheet(
context,
isCritical: true,
- title: StringsLocalizations.of(context).cleanUncategorized,
- firstButtonLabel: StringsLocalizations.of(context).confirm,
- body: StringsLocalizations.of(context).cleanUncategorizedDescription,
+ title: context.strings.cleanUncategorized,
+ firstButtonLabel: context.strings.confirm,
+ body: context.strings.cleanUncategorizedDescription,
);
if (actionResult?.action != null && mounted) {
if (actionResult!.action == ButtonAction.first) {
@@ -994,10 +979,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
await setMapEnabled(true);
} catch (e) {
if (!mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
return;
}
}
@@ -1029,11 +1011,11 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
items: [
PopupMenuItem(
value: false,
- child: Text(StringsLocalizations.of(context).sortNewestFirst),
+ child: Text(context.strings.sortNewestFirst),
),
PopupMenuItem(
value: true,
- child: Text(StringsLocalizations.of(context).sortOldestFirst),
+ child: Text(context.strings.sortOldestFirst),
),
],
);
@@ -1054,7 +1036,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
if (isEmptyCollection) {
final dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).pleaseWaitDeletingAlbum,
+ context.strings.pleaseWaitDeletingAlbum,
);
await dialog.show();
try {
@@ -1151,9 +1133,9 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
final res = await showChoiceDialog(
context,
- title: StringsLocalizations.of(context).openAlbumInBrowserTitle,
- firstButtonLabel: StringsLocalizations.of(context).openAlbumInBrowser,
- secondButtonLabel: StringsLocalizations.of(context).cancel,
+ title: context.strings.openAlbumInBrowserTitle,
+ firstButtonLabel: context.strings.openAlbumInBrowser,
+ secondButtonLabel: context.strings.cancel,
firstButtonType: ButtonType.primary,
);
@@ -1226,13 +1208,13 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
collectionFiles = filesResult.files;
} else {
if (!mounted) return;
- showToast(context, StringsLocalizations.of(context).somethingWentWrong);
+ showToast(context, context.strings.somethingWentWrong);
return;
}
if (collectionFiles.isEmpty) {
if (!mounted) return;
- showToast(context, StringsLocalizations.of(context).nothingToSeeHere);
+ showToast(context, context.strings.nothingToSeeHere);
return;
}
@@ -1255,8 +1237,8 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
if (!mounted) return;
await showErrorDialog(
context,
- StringsLocalizations.of(context).noSystemLockFound,
- StringsLocalizations.of(context).guestViewEnablePreSteps,
+ context.strings.noSystemLockFound,
+ context.strings.guestViewEnablePreSteps,
);
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/hidden_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/hidden_page.dart
index 65472f20c0..1ac64991a1 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/hidden_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/hidden_page.dart
@@ -131,7 +131,7 @@ class _HiddenPageState extends State<HiddenPage> {
}
final appBar = GalleryAppBarWidget.sliverConfig(
widget.appBarType,
- StringsLocalizations.of(context).hidden,
+ context.strings.hidden,
_selectedFiles,
);
final gallery = Gallery(
@@ -173,7 +173,7 @@ class _HiddenPageState extends State<HiddenPage> {
emptyState: _hiddenCollectionsExcludingDefault.isEmpty
? EmptyStateComponent(
assetPath: "assets/empty_state_hidden.png",
- title: StringsLocalizations.of(context).hiddenItemsWillShowUpHere,
+ title: context.strings.hiddenItemsWillShowUpHere,
)
: const SizedBox.shrink(),
header: Column(
@@ -219,7 +219,7 @@ class _HiddenPageState extends State<HiddenPage> {
CollectionListPage(
_hiddenCollectionsExcludingDefault,
sectionType: UISectionType.hiddenCollections,
- appTitle: Text(StringsLocalizations.of(context).hidden),
+ appTitle: Text(context.strings.hidden),
tag: "hidden",
),
);
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/hierarchical_search_gallery.dart b/mobile/apps/photos/lib/ui/viewer/gallery/hierarchical_search_gallery.dart
index 4ee981ccb5..659c9936c6 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/hierarchical_search_gallery.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/hierarchical_search_gallery.dart
@@ -200,10 +200,8 @@ class _HierarchicalSearchGalleryState extends State<HierarchicalSearchGallery> {
clusterID:
_firstUnnamedAppliedFaceFilter!.clusterId,
),
- text: StringsLocalizations.of(context).savePerson,
- subText: StringsLocalizations.of(
- context,
- ).findThemQuickly,
+ text: context.strings.savePerson,
+ subText: context.strings.findThemQuickly,
onTap: _handleSavePerson,
)
: null,
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/pick_cover_photo.dart b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/pick_cover_photo.dart
index f483391c65..2b59c1fe22 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/pick_cover_photo.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/pick_cover_photo.dart
@@ -62,7 +62,7 @@ class PickCoverPhotoWidget extends StatelessWidget {
children: [
BottomOfTitleBarWidget(
title: TitleBarTitleWidget(
- title: StringsLocalizations.of(context).selectCoverPhoto,
+ title: context.strings.selectCoverPhoto,
),
caption: collection.displayName,
showCloseButton: true,
@@ -145,9 +145,7 @@ class PickCoverPhotoWidget extends StatelessWidget {
key: ValueKey(value),
isDisabled: !value,
buttonType: ButtonType.neutral,
- labelText: StringsLocalizations.of(
- context,
- ).useSelectedPhoto,
+ labelText: context.strings.useSelectedPhoto,
onTap: () async {
final selectedFile =
selectedFiles.files.first;
@@ -165,10 +163,8 @@ class PickCoverPhotoWidget extends StatelessWidget {
buttonType: ButtonType.secondary,
buttonAction: ButtonAction.cancel,
labelText: collection.hasCover
- ? StringsLocalizations.of(
- context,
- ).resetToDefault
- : StringsLocalizations.of(context).cancel,
+ ? context.strings.resetToDefault
+ : context.strings.cancel,
icon: collection.hasCover
? Icons.restore_outlined
: null,
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/pick_person_avatar.dart b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/pick_person_avatar.dart
index 6ba3b9fd72..b7b1c4f651 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/pick_person_avatar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/pick_person_avatar.dart
@@ -72,7 +72,7 @@ class PickPersonCoverPhotoWidget extends StatelessWidget {
children: [
BottomOfTitleBarWidget(
title: TitleBarTitleWidget(
- title: StringsLocalizations.of(context).selectCoverPhoto,
+ title: context.strings.selectCoverPhoto,
),
caption: personEntity.data.name,
showCloseButton: true,
@@ -136,9 +136,7 @@ class PickPersonCoverPhotoWidget extends StatelessWidget {
key: ValueKey(value),
isDisabled: !value,
buttonType: ButtonType.neutral,
- labelText: StringsLocalizations.of(
- context,
- ).useSelectedPhoto,
+ labelText: context.strings.useSelectedPhoto,
onTap: () async {
final selectedFile = selectedFiles.files.first;
final result = await PersonService.instance
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/large_files_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/large_files_page.dart
index e7166c36cb..5f50b5c5ef 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/large_files_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/large_files_page.dart
@@ -102,7 +102,7 @@ class _LargeFilesPagePageState extends State<LargeFilesPagePage> {
sortAsyncFn: () => false,
groupType: GroupType.size,
initialFiles: null,
- albumName: StringsLocalizations.of(context).viewLargeFiles,
+ albumName: context.strings.viewLargeFiles,
);
return GalleryBoundariesProvider(
child: GalleryFilesState(
@@ -156,7 +156,7 @@ class _LargeFilesAppBarState extends State<_LargeFilesAppBar>
elevation: 0,
centerTitle: false,
title: Text(
- StringsLocalizations.of(context).viewLargeFiles,
+ context.strings.viewLargeFiles,
style: Theme.of(
context,
).textTheme.headlineSmall!.copyWith(fontSize: 16),
@@ -170,20 +170,20 @@ class _LargeFilesAppBarState extends State<_LargeFilesAppBar>
child: Row(
children: [
_FilterChip(
- label: StringsLocalizations.of(context).all,
+ label: context.strings.all,
isSelected: widget.currentFilter == LargeFileFilter.all,
onTap: () => widget.onFilterChanged(LargeFileFilter.all),
),
const SizedBox(width: 8),
_FilterChip(
- label: StringsLocalizations.of(context).photos,
+ label: context.strings.photos,
icon: Icons.image,
isSelected: widget.currentFilter == LargeFileFilter.photos,
onTap: () => widget.onFilterChanged(LargeFileFilter.photos),
),
const SizedBox(width: 8),
_FilterChip(
- label: StringsLocalizations.of(context).videos,
+ label: context.strings.videos,
icon: Icons.videocam,
isSelected: widget.currentFilter == LargeFileFilter.videos,
onTap: () => widget.onFilterChanged(LargeFileFilter.videos),
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/layout_settings.dart b/mobile/apps/photos/lib/ui/viewer/gallery/layout_settings.dart
index 74b5e60cc7..c0e290d82b 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/layout_settings.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/layout_settings.dart
@@ -63,7 +63,7 @@ class _GalleryLayoutSettingsState extends State<GalleryLayoutSettings> {
onTap: () => _applyLayout(GroupType.month, 5),
),
MenuComponent(
- title: StringsLocalizations.of(context).custom,
+ title: context.strings.custom,
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/shared_public_collection_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/shared_public_collection_page.dart
index 9a44a450f4..9b3c598e39 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/shared_public_collection_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/shared_public_collection_page.dart
@@ -226,7 +226,7 @@ class _SharedPublicCollectionPageState
if (!mounted) return;
final dialog = createProgressDialog(
context,
- StringsLocalizations.of(context).pleaseWait,
+ context.strings.pleaseWait,
isDismissible: true,
);
await dialog.show();
@@ -251,7 +251,7 @@ class _SharedPublicCollectionPageState
logger.severe("Failed to join collection", e, s);
await dialog.hide();
if (!mounted) return;
- showToast(context, StringsLocalizations.of(context).somethingWentWrong);
+ showToast(context, context.strings.somethingWentWrong);
}
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart
index 31e1120518..b1b88abd56 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart
@@ -31,11 +31,11 @@ class TrashPage extends StatelessWidget {
Widget build(BuildContext context) {
final appBar = GalleryAppBarWidget.sliverConfig(
appBarType,
- StringsLocalizations.of(context).trash,
+ context.strings.trash,
_selectedFiles,
- subtitle: StringsLocalizations.of(
- context,
- ).itemsShowTheNumberOfDaysRemainingBeforePermanentDeletion,
+ subtitle: context
+ .strings
+ .itemsShowTheNumberOfDaysRemainingBeforePermanentDeletion,
);
final gallery = Gallery(
@@ -61,9 +61,7 @@ class TrashPage extends StatelessWidget {
initialFiles: null,
emptyState: EmptyStateComponent(
assetPath: "assets/empty_state_trash.png",
- title: StringsLocalizations.of(
- context,
- ).deletedItemsStayHereForThirtyDays,
+ title: context.strings.deletedItemsStayHereForThirtyDays,
),
);
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart
index 8f7ea217c0..e981ce9541 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart
@@ -42,7 +42,7 @@ class UnCategorizedPage extends StatelessWidget {
Widget build(BuildContext context) {
final appBar = GalleryAppBarWidget.sliverConfig(
appBarType,
- StringsLocalizations.of(context).uncategorized,
+ context.strings.uncategorized,
_selectedFiles,
collection: collection,
);
@@ -86,12 +86,10 @@ class UnCategorizedPage extends StatelessWidget {
selectedFiles: _selectedFiles,
sortAsyncFn: () => collection.pubMagicMetadata.asc ?? false,
initialFiles: null,
- albumName: StringsLocalizations.of(context).uncategorized,
+ albumName: context.strings.uncategorized,
emptyState: EmptyStateComponent(
assetPath: "assets/empty-uncategorized.png",
- title: StringsLocalizations.of(
- context,
- ).uncategorizedItemsWillShowUpHere,
+ title: context.strings.uncategorizedItemsWillShowUpHere,
),
);
return GalleryBoundariesProvider(
diff --git a/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/app_bar_filter_chips.dart b/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/app_bar_filter_chips.dart
index c91d488d9b..c247a18608 100644
--- a/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/app_bar_filter_chips.dart
+++ b/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/app_bar_filter_chips.dart
@@ -142,7 +142,7 @@ class _AppBarFilterChipsState extends State<AppBarFilterChips> {
),
variant: IconButtonComponentVariant.primary,
shouldSurfaceExecutionStates: false,
- tooltip: StringsLocalizations.of(context).filter,
+ tooltip: context.strings.filter,
onTap: () => showBottomSheetComponent(
context: context,
builder: (_) =>
diff --git a/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/chip_widgets/only_them_filter_chip.dart b/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/chip_widgets/only_them_filter_chip.dart
index b7e04cf903..5742cba09a 100644
--- a/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/chip_widgets/only_them_filter_chip.dart
+++ b/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/chip_widgets/only_them_filter_chip.dart
@@ -24,7 +24,7 @@ class OnlyThemFilterChip extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FilterChipComponent(
- label: StringsLocalizations.of(context).onlyThem,
+ label: context.strings.onlyThem,
avatar: _OnlyThemFilterThumbnail(faceFilters: faceFilters),
state: isApplied
? FilterChipComponentState.selected
diff --git a/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/filter_options_bottom_sheet.dart b/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/filter_options_bottom_sheet.dart
index b88f0f3203..694ba3b077 100644
--- a/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/filter_options_bottom_sheet.dart
+++ b/mobile/apps/photos/lib/ui/viewer/hierarchicial_search/filter_options_bottom_sheet.dart
@@ -31,7 +31,7 @@ class _FilterOptionsBottomSheetState extends State<FilterOptionsBottomSheet> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final filterGroups = _filterGroups(context);
return BottomSheetComponent(
@@ -103,7 +103,7 @@ class _FilterOptionsBottomSheetState extends State<FilterOptionsBottomSheet> {
}
List<_FilterGroup> _filterGroups(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final peopleFilters = _peopleFilters;
final groups = [
_FilterGroup(
diff --git a/mobile/apps/photos/lib/ui/viewer/location/add_location_sheet.dart b/mobile/apps/photos/lib/ui/viewer/location/add_location_sheet.dart
index ecd306cfae..45f01fa0ca 100644
--- a/mobile/apps/photos/lib/ui/viewer/location/add_location_sheet.dart
+++ b/mobile/apps/photos/lib/ui/viewer/location/add_location_sheet.dart
@@ -105,9 +105,7 @@ class _AddLocationSheetState extends State<AddLocationSheet> {
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: BottomOfTitleBarWidget(
- title: TitleBarTitleWidget(
- title: StringsLocalizations.of(context).addLocation,
- ),
+ title: TitleBarTitleWidget(title: context.strings.addLocation),
),
),
Expanded(
@@ -126,9 +124,7 @@ class _AddLocationSheetState extends State<AddLocationSheet> {
children: [
Expanded(
child: TextInputWidget(
- hintText: StringsLocalizations.of(
- context,
- ).locationName,
+ hintText: context.strings.locationName,
focusNode: _focusNode,
submitNotifier: _submitNotifer,
cancelNotifier: _cancelNotifier,
@@ -152,9 +148,8 @@ class _AddLocationSheetState extends State<AddLocationSheet> {
key: ValueKey(value),
buttonType: ButtonType.secondary,
buttonSize: ButtonSize.small,
- labelText: StringsLocalizations.of(
- context,
- ).addLocationButton,
+ labelText:
+ context.strings.addLocationButton,
isDisabled: value,
onTap: () async {
_focusNode.unfocus();
@@ -171,9 +166,7 @@ class _AddLocationSheetState extends State<AddLocationSheet> {
if (widget.name.isEmpty) const SizedBox(height: 16),
if (widget.name.isEmpty)
Text(
- StringsLocalizations.of(
- context,
- ).locationTagFeatureDescription,
+ context.strings.locationTagFeatureDescription,
style: textTheme.smallMuted,
),
],
@@ -204,7 +197,7 @@ class _AddLocationSheetState extends State<AddLocationSheet> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- StringsLocalizations.of(context).memoryCount(
+ context.strings.memoryCount(
count: value,
formattedCount: NumberFormat().format(
value,
@@ -216,9 +209,7 @@ class _AddLocationSheetState extends State<AddLocationSheet> {
Padding(
padding: const EdgeInsets.only(top: 2),
child: Text(
- StringsLocalizations.of(
- context,
- ).galleryMemoryLimitInfo,
+ context.strings.galleryMemoryLimitInfo,
style: textTheme.miniMuted,
),
),
diff --git a/mobile/apps/photos/lib/ui/viewer/location/edit_center_point_tile_widget.dart b/mobile/apps/photos/lib/ui/viewer/location/edit_center_point_tile_widget.dart
index d231bafb0d..5722fcca0a 100644
--- a/mobile/apps/photos/lib/ui/viewer/location/edit_center_point_tile_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/location/edit_center_point_tile_widget.dart
@@ -36,10 +36,7 @@ class EditCenterPointTileWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(
- StringsLocalizations.of(context).centerPoint,
- style: textTheme.body,
- ),
+ Text(context.strings.centerPoint, style: textTheme.body),
const SizedBox(height: 4),
Text(
"${centerPointInDMS![0]}, ${centerPointInDMS[1]}",
diff --git a/mobile/apps/photos/lib/ui/viewer/location/edit_location_sheet.dart b/mobile/apps/photos/lib/ui/viewer/location/edit_location_sheet.dart
index e68bb30a95..d97d8417be 100644
--- a/mobile/apps/photos/lib/ui/viewer/location/edit_location_sheet.dart
+++ b/mobile/apps/photos/lib/ui/viewer/location/edit_location_sheet.dart
@@ -96,9 +96,7 @@ class _EditLocationSheetState extends State<EditLocationSheet> {
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: BottomOfTitleBarWidget(
- title: TitleBarTitleWidget(
- title: StringsLocalizations.of(context).editLocation,
- ),
+ title: TitleBarTitleWidget(title: context.strings.editLocation),
),
),
Expanded(
@@ -117,9 +115,7 @@ class _EditLocationSheetState extends State<EditLocationSheet> {
children: [
Expanded(
child: TextInputWidget(
- hintText: StringsLocalizations.of(
- context,
- ).locationName,
+ hintText: context.strings.locationName,
focusNode: _focusNode,
submitNotifier: _submitNotifer,
cancelNotifier: _cancelNotifier,
@@ -148,9 +144,7 @@ class _EditLocationSheetState extends State<EditLocationSheet> {
key: ValueKey(value),
buttonType: ButtonType.secondary,
buttonSize: ButtonSize.small,
- labelText: StringsLocalizations.of(
- context,
- ).save,
+ labelText: context.strings.save,
isDisabled: value,
onTap: () async {
_focusNode.unfocus();
@@ -195,7 +189,7 @@ class _EditLocationSheetState extends State<EditLocationSheet> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- StringsLocalizations.of(context).memoryCount(
+ context.strings.memoryCount(
count: value,
formattedCount: NumberFormat().format(
value,
@@ -207,9 +201,7 @@ class _EditLocationSheetState extends State<EditLocationSheet> {
Padding(
padding: const EdgeInsets.only(top: 2),
child: Text(
- StringsLocalizations.of(
- context,
- ).galleryMemoryLimitInfo,
+ context.strings.galleryMemoryLimitInfo,
style: textTheme.miniMuted,
),
),
diff --git a/mobile/apps/photos/lib/ui/viewer/location/pick_center_point_widget.dart b/mobile/apps/photos/lib/ui/viewer/location/pick_center_point_widget.dart
index 641b264b5b..31cd710347 100644
--- a/mobile/apps/photos/lib/ui/viewer/location/pick_center_point_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/location/pick_center_point_widget.dart
@@ -65,11 +65,9 @@ class PickCenterPointWidget extends StatelessWidget {
children: [
BottomOfTitleBarWidget(
title: TitleBarTitleWidget(
- title: StringsLocalizations.of(context).pickCenterPoint,
+ title: context.strings.pickCenterPoint,
),
- caption:
- locationTagName ??
- StringsLocalizations.of(context).newLocation,
+ caption: locationTagName ?? context.strings.newLocation,
showCloseButton: true,
),
Expanded(
@@ -107,7 +105,7 @@ class PickCenterPointWidget extends StatelessWidget {
header: Padding(
padding: const EdgeInsets.all(10),
child: NotificationTipWidget(
- StringsLocalizations.of(context).locationPickerTip,
+ context.strings.locationPickerTip,
),
),
disablePinnedGroupHeader: true,
@@ -144,9 +142,7 @@ class PickCenterPointWidget extends StatelessWidget {
key: ValueKey(value),
isDisabled: !value,
buttonType: ButtonType.neutral,
- labelText: StringsLocalizations.of(
- context,
- ).useSelectedPhoto,
+ labelText: context.strings.useSelectedPhoto,
onTap: () async {
final selectedLocation =
selectedFiles.files.first.location;
diff --git a/mobile/apps/photos/lib/ui/viewer/location/radius_picker_widget.dart b/mobile/apps/photos/lib/ui/viewer/location/radius_picker_widget.dart
index 6d162f279c..96d0058164 100644
--- a/mobile/apps/photos/lib/ui/viewer/location/radius_picker_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/location/radius_picker_widget.dart
@@ -92,7 +92,7 @@ class _RadiusPickerWidgetState extends State<RadiusPickerWidget> {
Expanded(
flex: 5,
child: Text(
- StringsLocalizations.of(context).kiloMeterUnit,
+ context.strings.kiloMeterUnit,
style: textTheme.miniMuted,
),
),
@@ -109,10 +109,7 @@ class _RadiusPickerWidgetState extends State<RadiusPickerWidget> {
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 4),
- Text(
- StringsLocalizations.of(context).radius,
- style: textTheme.body,
- ),
+ Text(context.strings.radius, style: textTheme.body),
const SizedBox(height: 16),
SizedBox(
height: 16,
@@ -179,7 +176,7 @@ class _RadiusPickerWidgetState extends State<RadiusPickerWidget> {
Future<void> _customRadiusOnTap() async {
final result = await showTextInputDialog(
context,
- title: StringsLocalizations.of(context).setRadius,
+ title: context.strings.setRadius,
onSubmit: (customRadius) async {
final radius = double.tryParse(customRadius);
if (radius != null) {
@@ -194,10 +191,10 @@ class _RadiusPickerWidgetState extends State<RadiusPickerWidget> {
throw Exception("Radius is null");
}
},
- submitButtonLabel: StringsLocalizations.of(context).setLabel,
+ submitButtonLabel: context.strings.setLabel,
textInputFormatter: [NumberWithDecimalInputFormatter(maxValue: 10000)],
textInputType: const TextInputType.numberWithOptions(decimal: true),
- message: StringsLocalizations.of(context).distanceInKMUnit,
+ message: context.strings.distanceInKMUnit,
alignMessage: Alignment.centerRight,
);
if (result is Exception) {
diff --git a/mobile/apps/photos/lib/ui/viewer/location/update_location_data_widget.dart b/mobile/apps/photos/lib/ui/viewer/location/update_location_data_widget.dart
index 88cbc28ee1..c7a070cd14 100644
--- a/mobile/apps/photos/lib/ui/viewer/location/update_location_data_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/location/update_location_data_widget.dart
@@ -151,7 +151,7 @@ class _UpdateLocationDataWidgetState extends State<UpdateLocationDataWidget> {
if (selectedLocation.value == null) {
showShortToast(
context,
- StringsLocalizations.of(context).selectALocationFirst,
+ context.strings.selectALocationFirst,
);
return;
}
@@ -251,13 +251,11 @@ class _UpdateLocationInfoState extends State<UpdateLocationInfo> {
? CrossFadeState.showFirst
: CrossFadeState.showSecond,
firstChild: Text(
- StringsLocalizations.of(context).selectALocation,
+ context.strings.selectALocation,
style: getEnteTextTheme(context).mini,
),
secondChild: Text(
- StringsLocalizations.of(
- context,
- ).editsToLocationWillOnlyBeSeenWithinEnte,
+ context.strings.editsToLocationWillOnlyBeSeenWithinEnte,
style: getEnteTextTheme(context).mini,
),
layoutBuilder: (topChild, topChildKey, bottomChild, bottomChildKey) {
diff --git a/mobile/apps/photos/lib/ui/viewer/people/add_files_to_person_page.dart b/mobile/apps/photos/lib/ui/viewer/people/add_files_to_person_page.dart
index 3f8d15c656..674189afda 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/add_files_to_person_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/add_files_to_person_page.dart
@@ -62,7 +62,7 @@ class AddFilesToPersonPage extends StatefulWidget {
if (persons.isEmpty) {
showShortToast(
context,
- StringsLocalizations.of(context).pleaseNamePersonInPeopleSectionFirst,
+ context.strings.pleaseNamePersonInPeopleSectionFirst,
);
}
return persons;
@@ -208,7 +208,7 @@ class _AddFilesToPersonPageState extends State<AddFilesToPersonPage> {
builder: (context, snapshot) {
final slivers = <Widget>[
SearchableAppBar(
- title: Text(StringsLocalizations.of(context).addPerson),
+ title: Text(context.strings.addPerson),
onSearch: _updateSearchQuery,
onSearchClosed: _clearSearchQuery,
centerTitle: false,
@@ -254,9 +254,7 @@ class _AddFilesToPersonPageState extends State<AddFilesToPersonPage> {
if (results.isEmpty) {
slivers.add(
SliverFillRemaining(
- child: Center(
- child: Text(StringsLocalizations.of(context).noResultsFound),
- ),
+ child: Center(child: Text(context.strings.noResultsFound)),
),
);
return CustomScrollView(slivers: slivers);
@@ -324,7 +322,7 @@ class _AddFilesToPersonPageState extends State<AddFilesToPersonPage> {
),
child: GestureDetector(
onTapDown: (TapDownDetails details) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
const sortKeys = PeopleSortKey.values;
final PeopleSortKey? selectedKey = await showMenu<PeopleSortKey>(
color: colorScheme.backgroundElevated,
@@ -472,15 +470,12 @@ class _AddFilesToPersonPageState extends State<AddFilesToPersonPage> {
if (uploadIds.isEmpty) {
showShortToast(
context,
- StringsLocalizations.of(context).onlyUploadedFilesCanBeAddedToPerson,
+ context.strings.onlyUploadedFilesCanBeAddedToPerson,
);
return;
}
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).saving,
- );
+ final dialog = createProgressDialog(context, context.strings.saving);
await dialog.show();
try {
final result = await PersonService.instance.addManualFileAssignments(
diff --git a/mobile/apps/photos/lib/ui/viewer/people/cluster_app_bar.dart b/mobile/apps/photos/lib/ui/viewer/people/cluster_app_bar.dart
index ed323463e9..6460203a1a 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/cluster_app_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/cluster_app_bar.dart
@@ -139,7 +139,7 @@ class _AppBarWidgetState extends State<ClusterAppBar> {
final List<EntePopupMenuOption<ClusterPopupAction>> items = [
EntePopupMenuOption(
value: ClusterPopupAction.ignore,
- label: StringsLocalizations.of(context).ignorePerson,
+ label: context.strings.ignorePerson,
leadingWidget: galleryAppBarMenuIcon(
HugeIcons.strokeRoundedUserBlock01,
iconColor,
@@ -147,7 +147,7 @@ class _AppBarWidgetState extends State<ClusterAppBar> {
),
EntePopupMenuOption(
value: ClusterPopupAction.breakupCluster,
- label: StringsLocalizations.of(context).mixedGrouping,
+ label: context.strings.mixedGrouping,
leadingWidget: galleryAppBarMenuIcon(
HugeIcons.strokeRoundedUserMultiple,
iconColor,
@@ -166,7 +166,7 @@ class _AppBarWidgetState extends State<ClusterAppBar> {
actions.add(
galleryAppBarPopupMenuAction<ClusterPopupAction>(
- tooltip: StringsLocalizations.of(context).more,
+ tooltip: context.strings.more,
icon: const HugeIcon(icon: HugeIcons.strokeRoundedMoreVertical),
optionsBuilder: () => items,
onSelected: (ClusterPopupAction value) async {
@@ -187,11 +187,9 @@ class _AppBarWidgetState extends State<ClusterAppBar> {
Future<void> _onIgnoredClusterClicked(BuildContext context) async {
final result = await showChoiceDialog(
context,
- title: StringsLocalizations.of(
- context,
- ).areYouSureYouWantToIgnoreThisPerson,
- body: StringsLocalizations.of(context).thePersonGroupsWillNotBeDisplayed,
- firstButtonLabel: StringsLocalizations.of(context).confirm,
+ title: context.strings.areYouSureYouWantToIgnoreThisPerson,
+ body: context.strings.thePersonGroupsWillNotBeDisplayed,
+ firstButtonLabel: context.strings.confirm,
firstButtonOnTap: () async {
try {
await ClusterFeedbackService.instance.ignoreCluster(widget.clusterID);
@@ -216,11 +214,9 @@ class _AppBarWidgetState extends State<ClusterAppBar> {
String biggestClusterID = '';
await showChoiceDialog(
context,
- title: StringsLocalizations.of(context).doesGroupContainMultiplePeople,
- body: StringsLocalizations.of(
- context,
- ).automaticallyAnalyzeAndSplitGrouping,
- firstButtonLabel: StringsLocalizations.of(context).confirm,
+ title: context.strings.doesGroupContainMultiplePeople,
+ body: context.strings.automaticallyAnalyzeAndSplitGrouping,
+ firstButtonLabel: context.strings.confirm,
firstButtonOnTap: () async {
try {
final breakupResult = await ClusterFeedbackService.instance
@@ -313,10 +309,8 @@ class _AppBarWidgetState extends State<ClusterAppBar> {
if (!context.mounted) return;
await Navigator.of(context).push(
MaterialPageRoute(
- builder: (context) => ClusterBreakupPage(
- newClusterIDToFiles,
- StringsLocalizations.of(context).analysis,
- ),
+ builder: (context) =>
+ ClusterBreakupPage(newClusterIDToFiles, context.strings.analysis),
),
);
}
diff --git a/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dart b/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dart
index 253f83a2d0..33cd54c3e1 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dart
@@ -195,8 +195,8 @@ class _ClusterPageState extends State<ClusterPage> {
? const NameFaceBanner()
: SavePersonBanner(
faceWidget: PersonFaceWidget(clusterID: widget.clusterID),
- text: StringsLocalizations.of(context).savePerson,
- subText: StringsLocalizations.of(context).findThemQuickly,
+ text: context.strings.savePerson,
+ subText: context.strings.findThemQuickly,
onTap: _handleSavePerson,
)
: null,
diff --git a/mobile/apps/photos/lib/ui/viewer/people/merge_clusters_to_person_sheet.dart b/mobile/apps/photos/lib/ui/viewer/people/merge_clusters_to_person_sheet.dart
index cb7d3d5bc6..a682798b83 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/merge_clusters_to_person_sheet.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/merge_clusters_to_person_sheet.dart
@@ -243,7 +243,7 @@ class _MergeClustersToPersonPageState extends State<MergeClustersToPersonPage> {
builder: (context, snapshot) {
final slivers = <Widget>[
SearchableAppBar(
- title: Text(StringsLocalizations.of(context).addToPerson),
+ title: Text(context.strings.addToPerson),
onSearch: _updateSearchQuery,
onSearchClosed: _clearSearchQuery,
centerTitle: false,
@@ -289,9 +289,7 @@ class _MergeClustersToPersonPageState extends State<MergeClustersToPersonPage> {
if (results.isEmpty && !_showNewPersonTile) {
slivers.add(
SliverFillRemaining(
- child: Center(
- child: Text(StringsLocalizations.of(context).noResultsFound),
- ),
+ child: Center(child: Text(context.strings.noResultsFound)),
),
);
return CustomScrollView(slivers: slivers);
@@ -367,7 +365,7 @@ class _MergeClustersToPersonPageState extends State<MergeClustersToPersonPage> {
),
child: GestureDetector(
onTapDown: (TapDownDetails details) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final sortKeys = _canUseSimilaritySort
? _MergeSortKey.values
: _MergeSortKey.values
@@ -697,7 +695,7 @@ class _AddNewPersonGridTile extends StatelessWidget {
child: Padding(
padding: EdgeInsets.only(top: labelTopPadding),
child: Text(
- StringsLocalizations.of(context).addPerson,
+ context.strings.addPerson,
maxLines: 1,
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
diff --git a/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart b/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
index 198c1c22a9..de6b135ef5 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
@@ -301,7 +301,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
items.addAll([
EntePopupMenuOption(
value: PeoplePopupAction.rename,
- label: StringsLocalizations.of(context).edit,
+ label: context.strings.edit,
leadingWidget: galleryAppBarMenuIcon(
HugeIcons.strokeRoundedPencilEdit01,
iconColor,
@@ -310,7 +310,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
if (hasAssignedCluster)
EntePopupMenuOption(
value: PeoplePopupAction.reviewSuggestions,
- label: StringsLocalizations.of(context).review,
+ label: context.strings.review,
leadingWidget: galleryAppBarMenuIcon(
HugeIcons.strokeRoundedSearch01,
iconColor,
@@ -319,7 +319,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
if (hasAssignedCluster)
EntePopupMenuOption(
value: PeoplePopupAction.setCover,
- label: StringsLocalizations.of(context).setCover,
+ label: context.strings.setCover,
leadingWidget: galleryAppBarMenuIcon(
HugeIcons.strokeRoundedImage01,
iconColor,
@@ -363,7 +363,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
),
EntePopupMenuOption(
value: PeoplePopupAction.ignore,
- label: StringsLocalizations.of(context).ignore,
+ label: context.strings.ignore,
leadingWidget: galleryAppBarMenuIcon(
HugeIcons.strokeRoundedUserBlock01,
iconColor,
@@ -371,7 +371,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
),
EntePopupMenuOption(
value: PeoplePopupAction.removeLabel,
- label: StringsLocalizations.of(context).remove,
+ label: context.strings.remove,
leadingWidget: galleryAppBarMenuIcon(
HugeIcons.strokeRoundedDelete01,
iconColor,
@@ -382,7 +382,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
items.addAll([
EntePopupMenuOption(
value: PeoplePopupAction.rename,
- label: StringsLocalizations.of(context).edit,
+ label: context.strings.edit,
leadingWidget: galleryAppBarMenuIcon(
HugeIcons.strokeRoundedPencilEdit01,
iconColor,
@@ -391,7 +391,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
if (hasAssignedCluster)
EntePopupMenuOption(
value: PeoplePopupAction.reviewSuggestions,
- label: StringsLocalizations.of(context).review,
+ label: context.strings.review,
leadingWidget: galleryAppBarMenuIcon(
HugeIcons.strokeRoundedSearch01,
iconColor,
@@ -399,7 +399,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
),
EntePopupMenuOption(
value: PeoplePopupAction.unignore,
- label: StringsLocalizations.of(context).showPerson,
+ label: context.strings.showPerson,
leadingWidget: galleryAppBarMenuIcon(
HugeIcons.strokeRoundedView,
iconColor,
@@ -410,7 +410,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
actions.add(
galleryAppBarPopupMenuAction<PeoplePopupAction>(
- tooltip: StringsLocalizations.of(context).more,
+ tooltip: context.strings.more,
icon: const HugeIcon(icon: HugeIcons.strokeRoundedMoreVertical),
optionsBuilder: () => items,
onSelected: (PeoplePopupAction value) async {
@@ -500,11 +500,9 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
Future<void> _resetPerson(BuildContext context) async {
await showChoiceDialog(
context,
- title: StringsLocalizations.of(
- context,
- ).areYouSureYouWantToResetThisPerson,
- body: StringsLocalizations.of(context).allPersonGroupingWillReset,
- firstButtonLabel: StringsLocalizations.of(context).yesResetPerson,
+ title: context.strings.areYouSureYouWantToResetThisPerson,
+ body: context.strings.allPersonGroupingWillReset,
+ firstButtonLabel: context.strings.yesResetPerson,
firstButtonOnTap: () async {
try {
await PersonService.instance.deletePerson(person.remoteID);
@@ -527,11 +525,9 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
Future<void> _ignorePerson(BuildContext context) async {
final result = await showChoiceDialog(
context,
- title: StringsLocalizations.of(
- context,
- ).areYouSureYouWantToIgnoreThisPerson,
- body: StringsLocalizations.of(context).thePersonWillNotBeDisplayed,
- firstButtonLabel: StringsLocalizations.of(context).yesIgnore,
+ title: context.strings.areYouSureYouWantToIgnoreThisPerson,
+ body: context.strings.thePersonWillNotBeDisplayed,
+ firstButtonLabel: context.strings.yesIgnore,
firstButtonOnTap: () async {
try {
final updatedPerson = await PersonService.instance.updateAttributes(
@@ -558,10 +554,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
return;
}
if (!context.mounted) return;
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrongPleaseTryAgain,
- );
+ showShortToast(context, context.strings.somethingWentWrongPleaseTryAgain);
}
Future<void> _showPerson(BuildContext context) async {
@@ -569,10 +562,9 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
var shouldCloseDetailPage = false;
final result = await showChoiceDialog(
context,
- title: StringsLocalizations.of(
- context,
- ).areYouSureYouWantToShowThisPersonInPeopleSectionAgain,
- firstButtonLabel: StringsLocalizations.of(context).yesShowPerson,
+ title:
+ context.strings.areYouSureYouWantToShowThisPersonInPeopleSectionAgain,
+ firstButtonLabel: context.strings.yesShowPerson,
isDismissible: false,
firstButtonOnTap: () async {
try {
diff --git a/mobile/apps/photos/lib/ui/viewer/people/people_page.dart b/mobile/apps/photos/lib/ui/viewer/people/people_page.dart
index 2ed4d8e6c8..0417b44bbd 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/people_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/people_page.dart
@@ -225,7 +225,7 @@ class _PeoplePageState extends State<PeoplePage> {
}
if (_shouldShowMemoryCountTitleForIgnoredPerson()) {
final memoryCount = files?.length ?? 0;
- return StringsLocalizations.of(context).memoryCount(
+ return context.strings.memoryCount(
count: memoryCount,
formattedCount: NumberFormat().format(memoryCount),
);
diff --git a/mobile/apps/photos/lib/ui/viewer/people/person_cluster_suggestion.dart b/mobile/apps/photos/lib/ui/viewer/people/person_cluster_suggestion.dart
index 57059a2308..5e66b85e72 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/person_cluster_suggestion.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/person_cluster_suggestion.dart
@@ -102,9 +102,9 @@ class _PersonClustersState extends State<PersonReviewClusterSuggestion> {
_peopleChangedEvent = null;
return Center(
child: Text(
- StringsLocalizations.of(
- context,
- ).noSuggestionsForPerson(personName: widget.person.data.name),
+ context.strings.noSuggestionsForPerson(
+ personName: widget.person.data.name,
+ ),
style: getEnteTextTheme(context).largeMuted,
),
);
@@ -240,9 +240,7 @@ class _PersonClustersState extends State<PersonReviewClusterSuggestion> {
horizontal: 32,
),
child: Text(
- StringsLocalizations.of(
- context,
- ).saveAsAnotherPerson,
+ context.strings.saveAsAnotherPerson,
style: getEnteTextTheme(context).mini.copyWith(
color: getEnteColorScheme(context).textMuted,
decoration: TextDecoration.underline,
@@ -447,7 +445,7 @@ class _PersonClustersState extends State<PersonReviewClusterSuggestion> {
);
} else if (snapshot.hasError) {
// log the error
- return Center(child: Text(StringsLocalizations.of(context).error));
+ return Center(child: Text(context.strings.error));
} else {
canGiveFeedback = false;
return const Center(child: CircularProgressIndicator());
diff --git a/mobile/apps/photos/lib/ui/viewer/people/person_clusters_page.dart b/mobile/apps/photos/lib/ui/viewer/people/person_clusters_page.dart
index 7a44dba051..e4a6100496 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/person_clusters_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/person_clusters_page.dart
@@ -86,9 +86,9 @@ class _PersonClustersPageState extends State<PersonClustersPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
- StringsLocalizations.of(
- context,
- ).photosCount(count: files.length),
+ context.strings.photosCount(
+ count: files.length,
+ ),
style: getEnteTextTheme(context).body,
),
(index != 0)
@@ -133,7 +133,7 @@ class _PersonClustersPageState extends State<PersonClustersPage> {
);
} else if (snapshot.hasError) {
_logger.warning("Failed to get cluster", snapshot.error);
- return Center(child: Text(StringsLocalizations.of(context).error));
+ return Center(child: Text(context.strings.error));
} else {
return const Center(child: CircularProgressIndicator());
}
@@ -212,7 +212,7 @@ class _PersonClustersWidgetState extends State<PersonClustersWidget> {
);
} else if (snapshot.hasError) {
_logger.warning("Failed to get cluster", snapshot.error);
- return Center(child: Text(StringsLocalizations.of(context).error));
+ return Center(child: Text(context.strings.error));
} else {
return const Center(child: CircularProgressIndicator());
}
diff --git a/mobile/apps/photos/lib/ui/viewer/people/person_gallery_suggestion.dart b/mobile/apps/photos/lib/ui/viewer/people/person_gallery_suggestion.dart
index 622f6ab3ed..a633c17ec5 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/person_gallery_suggestion.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/person_gallery_suggestion.dart
@@ -470,25 +470,17 @@ class _PersonGallerySuggestionState extends State<PersonGallerySuggestion>
text: TextSpan(
style: textTheme.body,
children: [
- TextSpan(
- text: StringsLocalizations.of(
- context,
- ).areThey,
- ),
+ TextSpan(text: context.strings.areThey),
TextSpan(
text: relevantPerson.data.name,
style: textTheme.bodyBold,
),
- TextSpan(
- text: StringsLocalizations.of(
- context,
- ).questionmark,
- ),
+ TextSpan(text: context.strings.questionmark),
],
),
)
: Text(
- StringsLocalizations.of(context).sameperson,
+ context.strings.sameperson,
style: textTheme.body,
textAlign: TextAlign.center,
),
@@ -527,7 +519,7 @@ class _PersonGallerySuggestionState extends State<PersonGallerySuggestion>
),
const SizedBox(width: 8),
Text(
- StringsLocalizations.of(context).no,
+ context.strings.no,
style:
(personPage
? textTheme.bodyBold
@@ -566,7 +558,7 @@ class _PersonGallerySuggestionState extends State<PersonGallerySuggestion>
),
const SizedBox(width: 8),
Text(
- StringsLocalizations.of(context).yes,
+ context.strings.yes,
style:
(personPage
? textTheme.bodyBold
@@ -593,9 +585,7 @@ class _PersonGallerySuggestionState extends State<PersonGallerySuggestion>
horizontal: 32,
),
child: Text(
- StringsLocalizations.of(
- context,
- ).saveAsAnotherPerson,
+ context.strings.saveAsAnotherPerson,
style: textTheme.mini.copyWith(
color: colorScheme.textMuted,
decoration: TextDecoration.underline,
diff --git a/mobile/apps/photos/lib/ui/viewer/people/reassign_me_selection_page.dart b/mobile/apps/photos/lib/ui/viewer/people/reassign_me_selection_page.dart
index c5d88d0e9a..972491eecf 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/reassign_me_selection_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/reassign_me_selection_page.dart
@@ -73,11 +73,7 @@ class _ReassignMeSelectionPageState extends State<ReassignMeSelectionPage> {
);
return const Center(child: Icon(Icons.error_outline_rounded));
} else if (!snapshot.hasData || snapshot.data!.isEmpty) {
- return Center(
- child: Text(
- StringsLocalizations.of(context).noResultsFound + '.',
- ),
- );
+ return Center(child: Text(context.strings.noResultsFound + '.'));
} else {
final results = snapshot.data!;
final screenWidth = MediaQuery.of(context).size.width;
diff --git a/mobile/apps/photos/lib/ui/viewer/people/save_or_edit_person.dart b/mobile/apps/photos/lib/ui/viewer/people/save_or_edit_person.dart
index 382db7c4bf..b42830cbf6 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/save_or_edit_person.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/save_or_edit_person.dart
@@ -536,7 +536,7 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {
buttons: [
ButtonWidget(
buttonType: ButtonType.neutral,
- labelText: StringsLocalizations.of(context).save,
+ labelText: context.strings.save,
isInAlert: true,
buttonAction: ButtonAction.first,
shouldStickToDarkTheme: true,
@@ -567,7 +567,7 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {
),
ButtonWidget(
buttonType: ButtonType.secondary,
- labelText: StringsLocalizations.of(context).cancel,
+ labelText: context.strings.cancel,
isInAlert: true,
buttonAction: ButtonAction.cancel,
shouldStickToDarkTheme: true,
@@ -629,10 +629,7 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {
final bool extraPhotosFound = await ClusterFeedbackService.instance
.checkAndDoAutomaticMerges(personEntity, personClusterID: clusterID);
if (extraPhotosFound && context.mounted) {
- showShortToast(
- context,
- StringsLocalizations.of(context).extraPhotosFound,
- );
+ showShortToast(context, context.strings.extraPhotosFound);
}
Bus.instance.fire(
PeopleChangedEvent(
@@ -1010,7 +1007,7 @@ class _MergePersonConfirmationSheet extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final textTheme = getEnteTextTheme(context);
return BottomSheetComponent(
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/contact_person_picker_page.dart b/mobile/apps/photos/lib/ui/viewer/search/result/contact_person_picker_page.dart
index aba718a9bb..e604b9cdcc 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/contact_person_picker_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/contact_person_picker_page.dart
@@ -106,7 +106,7 @@ class _ContactPersonPickerPageState extends State<ContactPersonPickerPage> {
@override
Widget build(BuildContext context) {
final colors = context.componentColors;
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final personCandidates =
widget.candidates
.whereType<ContactPersonPickerPersonCandidate>()
@@ -170,7 +170,7 @@ class _ContactPersonPickerPageState extends State<ContactPersonPickerPage> {
Widget _buildSearchRow(BuildContext context) {
final colors = context.componentColors;
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return Row(
children: [
Expanded(
@@ -203,7 +203,7 @@ class _ContactPersonPickerPageState extends State<ContactPersonPickerPage> {
}
Future<void> _showSortMenu(BuildContext context) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final selected = await showEntePopupMenu<bool>(
context: context,
options: [
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/contact_photo_adjust_page.dart b/mobile/apps/photos/lib/ui/viewer/search/result/contact_photo_adjust_page.dart
index 71474b23c8..a96a6d64ca 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/contact_photo_adjust_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/contact_photo_adjust_page.dart
@@ -73,7 +73,7 @@ class _ContactPhotoAdjustPageState extends State<ContactPhotoAdjustPage> {
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(
- StringsLocalizations.of(context).cancel,
+ context.strings.cancel,
style: actionTextStyle,
),
),
@@ -88,7 +88,7 @@ class _ContactPhotoAdjustPageState extends State<ContactPhotoAdjustPage> {
await editor.done();
},
child: Text(
- StringsLocalizations.of(context).useSelectedPhoto,
+ context.strings.useSelectedPhoto,
style: actionTextStyle.copyWith(
color: _isReturningBytes
? colors.textLight
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/contact_photo_picker_sheet.dart b/mobile/apps/photos/lib/ui/viewer/search/result/contact_photo_picker_sheet.dart
index 790668ae8c..e6e8e2b13b 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/contact_photo_picker_sheet.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/contact_photo_picker_sheet.dart
@@ -59,7 +59,7 @@ class _ContactPhotoPickerSheetState extends State<_ContactPhotoPickerSheet> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final screenHeight = MediaQuery.sizeOf(context).height;
final sheetHeight = math.min(screenHeight * 0.78, screenHeight - 80);
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/contact_result_page.dart b/mobile/apps/photos/lib/ui/viewer/search/result/contact_result_page.dart
index 1c672cd8eb..4adecb2cf6 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/contact_result_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/contact_result_page.dart
@@ -438,7 +438,7 @@ class _AlbumsSection extends StatelessWidget {
Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 12),
child: Text(
- StringsLocalizations.of(context).albums,
+ context.strings.albums,
style: getEnteTextTheme(context).largeBold,
),
),
@@ -477,7 +477,7 @@ class _UnsavedContactHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 8),
child: SizedBox(
@@ -529,7 +529,7 @@ class _UnsavedContactEmptyState extends StatelessWidget {
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return Padding(
padding: const EdgeInsets.fromLTRB(36, 32, 36, 0),
child: Column(
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/edit_contact_page.dart b/mobile/apps/photos/lib/ui/viewer/search/result/edit_contact_page.dart
index 4775bcd70a..47e6e32f25 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/edit_contact_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/edit_contact_page.dart
@@ -102,7 +102,7 @@ class _EditContactPageState extends State<EditContactPage> {
@override
Widget build(BuildContext context) {
final colors = context.componentColors;
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
return PopScope(
canPop: !_isSaving && !_hasUnsavedChanges,
@@ -454,10 +454,7 @@ class _EditContactPageState extends State<EditContactPage> {
_isLoadingPhoto = false;
});
if (showError) {
- showShortToast(
- context,
- StringsLocalizations.of(context).couldNotLoadSelectedPhoto,
- );
+ showShortToast(context, context.strings.couldNotLoadSelectedPhoto);
}
return;
}
@@ -497,10 +494,7 @@ class _EditContactPageState extends State<EditContactPage> {
_isLoadingPhoto = false;
});
if (sourceBytes == null) {
- showShortToast(
- context,
- StringsLocalizations.of(context).couldNotLoadSelectedPhoto,
- );
+ showShortToast(context, context.strings.couldNotLoadSelectedPhoto);
return;
}
final croppedBytes = await routeToPage(
@@ -660,7 +654,7 @@ class _EditContactPageState extends State<EditContactPage> {
Future<ButtonAction?> _showExitConfirmationDialog(
BuildContext context,
) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
if (_canSave) {
final actionResult = await showActionSheet(
context: context,
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/go_to_map_widget.dart b/mobile/apps/photos/lib/ui/viewer/search/result/go_to_map_widget.dart
index 027d5de8ed..c0ae44013d 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/go_to_map_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/go_to_map_widget.dart
@@ -30,7 +30,7 @@ class GoToMap extends StatelessWidget {
),
const SizedBox(height: 10),
Text(
- StringsLocalizations.of(context).yourMap,
+ context.strings.yourMap,
maxLines: 2,
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/no_result_widget.dart b/mobile/apps/photos/lib/ui/viewer/search/result/no_result_widget.dart
index dedc76a572..7f24943a39 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/no_result_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/no_result_widget.dart
@@ -90,15 +90,13 @@ class _NoResultWidgetState extends State<NoResultWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- StringsLocalizations.of(context).noResultsFound,
+ context.strings.noResultsFound,
style: textTheme.largeBold,
),
const SizedBox(height: 6),
searchTypeToQuerySuggestion.isNotEmpty
? Text(
- StringsLocalizations.of(
- context,
- ).modifyYourQueryOrTrySearchingFor,
+ context.strings.modifyYourQueryOrTrySearchingFor,
style: textTheme.smallMuted,
)
: const SizedBox.shrink(),
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/people_section_all_page.dart b/mobile/apps/photos/lib/ui/viewer/search/result/people_section_all_page.dart
index 213c215462..ca5074ad10 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/people_section_all_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/people_section_all_page.dart
@@ -690,9 +690,7 @@ class _PeopleSectionAllWidgetState extends State<PeopleSectionAllWidget> {
slivers.add(
SliverFillRemaining(
child: Center(
- child: Text(
- StringsLocalizations.of(context).noResultsFound + '.',
- ),
+ child: Text(context.strings.noResultsFound + '.'),
),
),
);
@@ -978,7 +976,7 @@ class _PeopleSectionAllWidgetState extends State<PeopleSectionAllWidget> {
return TextInputComponent(
controller: _searchController,
focusNode: _searchFocusNode,
- hintText: StringsLocalizations.of(context).search,
+ hintText: context.strings.search,
autofocus: true,
shouldUnfocusOnClearOrSubmit: true,
prefix: HugeIcon(
@@ -1006,7 +1004,7 @@ class _PeopleSectionAllWidgetState extends State<PeopleSectionAllWidget> {
shouldSurfaceExecutionStates: false,
icon: const HugeIcon(icon: HugeIcons.strokeRoundedFilterHorizontal),
onTapDown: (details) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
const sortKeys = PeopleSortKey.values;
final PeopleSortKey? selectedKey = await showMenu<PeopleSortKey>(
color: colorScheme.backgroundElevated,
@@ -1214,8 +1212,8 @@ class _PeopleSectionAllWidgetState extends State<PeopleSectionAllWidget> {
children: [
Text(
_showingAllFaces
- ? StringsLocalizations.of(context).showLessFaces
- : StringsLocalizations.of(context).showMoreFaces,
+ ? context.strings.showLessFaces
+ : context.strings.showMoreFaces,
style: getEnteTextTheme(
context,
).small.copyWith(color: Theme.of(context).colorScheme.primary),
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/search_result_widget.dart b/mobile/apps/photos/lib/ui/viewer/search/result/search_result_widget.dart
index b6fb49c710..ed6e50bf52 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/search_result_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/search_result_widget.dart
@@ -109,7 +109,7 @@ class SearchResultWidget extends StatelessWidget {
}
String? _resultTypeLabel(BuildContext context, ResultType type) {
- final localizations = StringsLocalizations.of(context);
+ final localizations = context.strings;
switch (type) {
case ResultType.file:
return localizations.searchResultFileName;
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/search_section_all_page.dart b/mobile/apps/photos/lib/ui/viewer/search/result/search_section_all_page.dart
index 7bcc023f15..bc0c9682d7 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/search_section_all_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/search_section_all_page.dart
@@ -167,9 +167,7 @@ class _SearchSectionAllPageState extends State<SearchSectionAllPage> {
slivers.add(
SliverFillRemaining(
child: Center(
- child: Text(
- StringsLocalizations.of(context).noResultsFound + '.',
- ),
+ child: Text(context.strings.noResultsFound + '.'),
),
),
);
@@ -360,7 +358,7 @@ class _SearchSectionAllPageState extends State<SearchSectionAllPage> {
return TextInputComponent(
controller: _searchController,
focusNode: _searchFocusNode,
- hintText: StringsLocalizations.of(context).search,
+ hintText: context.strings.search,
autofocus: true,
shouldUnfocusOnClearOrSubmit: true,
prefix: HugeIcon(
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/searchable_item.dart b/mobile/apps/photos/lib/ui/viewer/search/result/searchable_item.dart
index 208152e7f0..de2d8deef0 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/searchable_item.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/searchable_item.dart
@@ -89,7 +89,7 @@ class SearchableItemWidget extends StatelessWidget {
if (snapshot.hasData && snapshot.data! > 0) {
final noOfMemories = snapshot.data!;
return Text(
- StringsLocalizations.of(context).memoryCount(
+ context.strings.memoryCount(
count: noOfMemories,
formattedCount: NumberFormat().format(noOfMemories),
),
diff --git a/mobile/apps/photos/lib/ui/viewer/search/search_map_navigation.dart b/mobile/apps/photos/lib/ui/viewer/search/search_map_navigation.dart
index e6b6843abb..d12a89aec1 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/search_map_navigation.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/search_map_navigation.dart
@@ -18,10 +18,7 @@ Future<void> openSearchMap(BuildContext context) async {
if (!context.mounted) {
return;
}
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
return;
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/search/search_suggestions.dart b/mobile/apps/photos/lib/ui/viewer/search/search_suggestions.dart
index 73454ab5e3..52d76fc10f 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/search_suggestions.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/search_suggestions.dart
@@ -137,9 +137,7 @@ class _SearchSuggestionsWidgetState extends State<SearchSuggestionsWidget> {
Padding(
padding: const EdgeInsets.fromLTRB(4, 0, 4, 12),
child: Text(
- StringsLocalizations.of(
- context,
- ).searchResultCount(count: _resultsCount),
+ context.strings.searchResultCount(count: _resultsCount),
style: textTheme.smallBold.copyWith(color: colorScheme.textMuted),
),
),
@@ -308,19 +306,19 @@ _SearchResultsSection _sectionForResult(SearchResult result) {
String _sectionTitle(BuildContext context, _SearchResultsSection section) {
switch (section) {
case _SearchResultsSection.people:
- return StringsLocalizations.of(context).people;
+ return context.strings.people;
case _SearchResultsSection.shared:
- return StringsLocalizations.of(context).shared;
+ return context.strings.shared;
case _SearchResultsSection.albums:
- return StringsLocalizations.of(context).albums;
+ return context.strings.albums;
case _SearchResultsSection.magic:
- return StringsLocalizations.of(context).magic;
+ return context.strings.magic;
case _SearchResultsSection.files:
- return StringsLocalizations.of(context).files;
+ return context.strings.files;
case _SearchResultsSection.locations:
- return StringsLocalizations.of(context).locations;
+ return context.strings.locations;
case _SearchResultsSection.moments:
- return StringsLocalizations.of(context).moments;
+ return context.strings.moments;
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/search/tab_empty_state.dart b/mobile/apps/photos/lib/ui/viewer/search/tab_empty_state.dart
index d51ca176c7..02d3df83f5 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/tab_empty_state.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/tab_empty_state.dart
@@ -19,22 +19,19 @@ class SearchTabEmptyState extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(
- StringsLocalizations.of(context).searchHint1,
- style: textStyle.h3Bold,
- ),
+ Text(context.strings.searchHint1, style: textStyle.h3Bold),
const SizedBox(height: 24),
- EmptyStateItemWidget(StringsLocalizations.of(context).searchHint2),
+ EmptyStateItemWidget(context.strings.searchHint2),
const SizedBox(height: 12),
- EmptyStateItemWidget(StringsLocalizations.of(context).searchHint3),
+ EmptyStateItemWidget(context.strings.searchHint3),
const SizedBox(height: 12),
- EmptyStateItemWidget(StringsLocalizations.of(context).searchHint4),
+ EmptyStateItemWidget(context.strings.searchHint4),
const SizedBox(height: 12),
- EmptyStateItemWidget(StringsLocalizations.of(context).searchHint5),
+ EmptyStateItemWidget(context.strings.searchHint5),
const SizedBox(height: 32),
ButtonWidget(
buttonType: ButtonType.trailingIconPrimary,
- labelText: StringsLocalizations.of(context).addYourPhotosNow,
+ labelText: context.strings.addYourPhotosNow,
icon: Icons.arrow_forward_outlined,
onTap: () async {
await handleFolderSelectionBackupFlow(context);
diff --git a/mobile/apps/photos/lib/ui/viewer/search_tab/contacts_section.dart b/mobile/apps/photos/lib/ui/viewer/search_tab/contacts_section.dart
index 2f2e887978..35ac5d1be6 100644
--- a/mobile/apps/photos/lib/ui/viewer/search_tab/contacts_section.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search_tab/contacts_section.dart
@@ -279,7 +279,7 @@ class ContactCTA extends StatelessWidget {
),
const SizedBox(height: 10),
Text(
- StringsLocalizations.of(context).invite,
+ context.strings.invite,
style: TextStyles.mini.copyWith(color: colorScheme.textMuted),
maxLines: 1,
overflow: TextOverflow.ellipsis,
diff --git a/mobile/apps/photos/lib/ui/viewer/search_tab/locations_section.dart b/mobile/apps/photos/lib/ui/viewer/search_tab/locations_section.dart
index 0fe82843b6..32e867acc0 100644
--- a/mobile/apps/photos/lib/ui/viewer/search_tab/locations_section.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search_tab/locations_section.dart
@@ -270,7 +270,7 @@ class GoToMapTile extends StatelessWidget {
),
const SizedBox(height: 8),
Text(
- StringsLocalizations.of(context).yourMap,
+ context.strings.yourMap,
style: TextStyles.body.copyWith(color: textTheme.body.color),
maxLines: 1,
overflow: TextOverflow.ellipsis,
diff --git a/mobile/apps/photos/lib/ui/viewer/search_tab/people_section.dart b/mobile/apps/photos/lib/ui/viewer/search_tab/people_section.dart
index 3910682439..3d18fa3b83 100644
--- a/mobile/apps/photos/lib/ui/viewer/search_tab/people_section.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search_tab/people_section.dart
@@ -323,7 +323,7 @@ class PersonSearchExample extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.only(top: 6, bottom: 0),
child: Text(
- StringsLocalizations.of(context).addName,
+ context.strings.addName,
maxLines: 1,
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
diff --git a/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart b/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart
index 902ff43653..d8885067c0 100644
--- a/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart
@@ -195,7 +195,7 @@ class _SearchHeaderTitle extends StatelessWidget {
heightFactor: (1 - (progress * 1.35)).clamp(0.0, 1.0),
child: Opacity(
opacity: progress < 0.08 ? 1 : 0,
- child: Text(StringsLocalizations.of(context).search, style: style),
+ child: Text(context.strings.search, style: style),
),
),
);
@@ -240,7 +240,7 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
return Padding(
padding: const EdgeInsets.only(bottom: 72),
child: Text(
- StringsLocalizations.of(context).searchSectionsLengthMismatch(
+ context.strings.searchSectionsLengthMismatch(
snapshotLength: sectionResults.length,
searchLength: SectionType.values.length,
),
@@ -340,9 +340,7 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
if (kDebugMode) {
return Padding(
padding: const EdgeInsets.only(bottom: 72),
- child: Text(
- StringsLocalizations.of(context).error + ': ${snapshot.error}',
- ),
+ child: Text(context.strings.error + ': ${snapshot.error}'),
);
}
return const Padding(
diff --git a/mobile/apps/photos/lib/utils/collection_util.dart b/mobile/apps/photos/lib/utils/collection_util.dart
index a6cf0b56ac..4219b07adf 100644
--- a/mobile/apps/photos/lib/utils/collection_util.dart
+++ b/mobile/apps/photos/lib/utils/collection_util.dart
@@ -16,9 +16,9 @@ Future<void> requestPermissionToOpenLinksInApp(
final choice = await showChoiceActionSheet(
isDismissible: false,
context,
- title: StringsLocalizations.of(context).seePublicAlbumLinksInApp,
- body: StringsLocalizations.of(context).allowAppToOpenSharedAlbumLinks,
- firstButtonLabel: StringsLocalizations.of(context).allow,
+ title: context.strings.seePublicAlbumLinksInApp,
+ body: context.strings.allowAppToOpenSharedAlbumLinks,
+ firstButtonLabel: context.strings.allow,
);
if (choice!.action == ButtonAction.first) {
final AndroidIntent intent;
diff --git a/mobile/apps/photos/lib/utils/delete_file_util.dart b/mobile/apps/photos/lib/utils/delete_file_util.dart
index fff1e4830a..b888a55e95 100644
--- a/mobile/apps/photos/lib/utils/delete_file_util.dart
+++ b/mobile/apps/photos/lib/utils/delete_file_util.dart
@@ -155,8 +155,8 @@ Future<void> deleteFilesFromEverywhere(
);
if (context.mounted) {
final message = hasLocalOnlyFiles && deletedIDs.isNotEmpty
- ? StringsLocalizations.of(context).filesDeleted
- : StringsLocalizations.of(context).movedToTrash;
+ ? context.strings.filesDeleted
+ : context.strings.movedToTrash;
showShortToast(context, message);
}
}
@@ -170,7 +170,7 @@ Future<void> deleteFilesFromRemoteOnly(
BuildContext context,
List<EnteFile> files,
) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
files.removeWhere((element) => element.uploadedFileID == null);
if (files.isEmpty) {
showToast(context, l10n.selectedFilesAreNotOnEnte);
@@ -271,8 +271,8 @@ Future<List<EnteFile>> deleteFilesOnDeviceOnly(
}
if (removedIDs.isNotEmpty && context.mounted) {
final message = deletedIDs.isNotEmpty
- ? StringsLocalizations.of(context).filesDeleted
- : StringsLocalizations.of(context).movedToTrash;
+ ? context.strings.filesDeleted
+ : context.strings.movedToTrash;
showShortToast(context, message);
}
return deletedFiles;
@@ -280,7 +280,7 @@ Future<List<EnteFile>> deleteFilesOnDeviceOnly(
Future<bool> deleteFromTrash(BuildContext context, List<EnteFile> files) async {
bool didDeletionStart = false;
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final actionResult = await showBottomSheetComponent<ButtonResult>(
context: context,
useRootNavigator: Platform.isIOS,
@@ -341,9 +341,9 @@ Future<bool> deleteFromTrash(BuildContext context, List<EnteFile> files) async {
Future<bool> emptyTrash(BuildContext context) async {
final actionResult = await showChoiceActionSheet(
context,
- title: StringsLocalizations.of(context).emptyTrashQuestion,
- body: StringsLocalizations.of(context).permDeleteWarning,
- firstButtonLabel: StringsLocalizations.of(context).empty,
+ title: context.strings.emptyTrashQuestion,
+ body: context.strings.permDeleteWarning,
+ firstButtonLabel: context.strings.empty,
isCritical: true,
firstButtonOnTap: () async {
try {
@@ -784,7 +784,7 @@ Future<List<String>> _tryDeleteSharedMediaFiles(List<String> localIDs) {
}
Future<void> showMediaManagementHintSheet(BuildContext context) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
if (!Platform.isAndroid) {
return;
}
@@ -853,7 +853,7 @@ Future<void> showDeleteSheet(
Future<void> Function(BuildContext context, List<EnteFile> files)?
deleteFromEverywhereOverride,
}) async {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
if (selectedFiles.files.length != filesSplit.count) {
throw AssertionError(
"Unexpected state, #{selectedFiles.files.length} != "
@@ -1010,7 +1010,7 @@ class _MoreOptionsButtonState extends State<_MoreOptionsButton> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final foreground = context.componentColors.textLight;
return GestureDetector(
behavior: HitTestBehavior.opaque,
@@ -1107,7 +1107,7 @@ class DeleteConfirmationSheetState extends State<DeleteConfirmationSheet> {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final title = l10n.deleteItemsQuestion(count: widget.count);
var body = l10n.selectedFilesSavedOnDeviceOnly;
if (widget.count == 1 && widget.isLocal && widget.isRemote) {
diff --git a/mobile/apps/photos/lib/utils/dialog_util.dart b/mobile/apps/photos/lib/utils/dialog_util.dart
index af9a07da1e..1a645b20cd 100644
--- a/mobile/apps/photos/lib/utils/dialog_util.dart
+++ b/mobile/apps/photos/lib/utils/dialog_util.dart
@@ -35,7 +35,7 @@ Future<ButtonResult?> showInfoDialog(
buttons: [
ButtonWidget(
buttonType: ButtonType.secondary,
- labelText: StringsLocalizations.of(context).ok,
+ labelText: context.strings.ok,
isInAlert: true,
buttonAction: ButtonAction.first,
),
@@ -60,7 +60,7 @@ Future<ButtonResult?> showErrorDialog(
buttons: [
ButtonWidget(
buttonType: ButtonType.secondary,
- labelText: StringsLocalizations.of(context).ok,
+ labelText: context.strings.ok,
isInAlert: true,
buttonAction: ButtonAction.first,
),
@@ -77,8 +77,7 @@ Future<ButtonResult?> showErrorDialogForException({
String? message,
}) async {
String errorMessage =
- message ??
- StringsLocalizations.of(context).tempErrorContactSupportIfPersists;
+ message ?? context.strings.tempErrorContactSupportIfPersists;
if (exception is DioException &&
exception.response != null &&
exception.response!.data["code"] != null) {
@@ -87,14 +86,14 @@ Future<ButtonResult?> showErrorDialogForException({
}
return showDialogWidget(
context: context,
- title: StringsLocalizations.of(context).error,
+ title: context.strings.error,
icon: Icons.error_outline_outlined,
body: errorMessage,
isDismissible: isDismissible,
buttons: [
ButtonWidget(
buttonType: ButtonType.secondary,
- labelText: StringsLocalizations.of(context).ok,
+ labelText: context.strings.ok,
isInAlert: true,
),
],
@@ -111,7 +110,7 @@ String parseErrorForUI(
return genericError;
}
if (error.toString() == DownloadManager.applePhotosUnsupportedResourceError) {
- return StringsLocalizations.of(context).applePhotosUnsupportedResource;
+ return context.strings.applePhotosUnsupportedResource;
}
if (error is DioException) {
final DioException dioError = error;
@@ -120,9 +119,9 @@ String parseErrorForUI(
dioError.type == DioExceptionType.sendTimeout ||
dioError.type == DioExceptionType.cancel) {
if (dioError.error.toString().contains('Failed host lookup')) {
- return StringsLocalizations.of(context).networkHostLookUpErr;
+ return context.strings.networkHostLookUpErr;
} else if (dioError.error.toString().contains('SocketException')) {
- return StringsLocalizations.of(context).networkConnectionRefusedErr;
+ return context.strings.networkConnectionRefusedErr;
}
}
}
@@ -165,33 +164,31 @@ Future<ButtonResult?> showGenericErrorDialog({
}) async {
final errorBody = parseErrorForUI(
context,
- StringsLocalizations.of(
- context,
- ).itLooksLikeSomethingWentWrongPleaseRetryAfterSome,
+ context.strings.itLooksLikeSomethingWentWrongPleaseRetryAfterSome,
error: error,
);
final ButtonResult? result = await showDialogWidget(
context: context,
- title: StringsLocalizations.of(context).error,
+ title: context.strings.error,
icon: Icons.error_outline_outlined,
body: errorBody,
isDismissible: isDismissible,
buttons: [
ButtonWidget(
buttonType: ButtonType.primary,
- labelText: StringsLocalizations.of(context).ok,
+ labelText: context.strings.ok,
buttonAction: ButtonAction.first,
isInAlert: true,
),
ButtonWidget(
buttonType: ButtonType.secondary,
- labelText: StringsLocalizations.of(context).contactSupport,
+ labelText: context.strings.contactSupport,
buttonAction: ButtonAction.second,
onTap: () async {
await sendLogs(
context,
- StringsLocalizations.of(context).contactSupport,
+ context.strings.contactSupport,
postShare: () {},
);
@@ -208,24 +205,22 @@ Future<void> showGenericErrorBottomSheet({
}) async {
final errorBody = parseErrorForUI(
context,
- StringsLocalizations.of(
- context,
- ).itLooksLikeSomethingWentWrongPleaseRetryAfterSome,
+ context.strings.itLooksLikeSomethingWentWrongPleaseRetryAfterSome,
error: error,
);
await showAlertBottomSheet(
context,
- title: StringsLocalizations.of(context).error,
+ title: context.strings.error,
message: errorBody,
assetPath: 'assets/warning-grey.png',
buttons: [
ButtonWidgetV2(
buttonType: ButtonTypeV2.secondary,
- labelText: StringsLocalizations.of(context).contactSupport,
+ labelText: context.strings.contactSupport,
onTap: () async {
await sendLogs(
context,
- StringsLocalizations.of(context).contactSupport,
+ context.strings.contactSupport,
postShare: () {},
);
diff --git a/mobile/apps/photos/lib/utils/email_util.dart b/mobile/apps/photos/lib/utils/email_util.dart
index e1f147ed47..eb91975a5f 100644
--- a/mobile/apps/photos/lib/utils/email_util.dart
+++ b/mobile/apps/photos/lib/utils/email_util.dart
@@ -49,14 +49,14 @@ Future<void> sendLogs(
// ignore: unawaited_futures
showDialogWidget(
context: context,
- title: StringsLocalizations.of(context).reportABug,
+ title: context.strings.reportABug,
icon: Icons.bug_report_outlined,
- body: StringsLocalizations.of(context).logsDialogBody,
+ body: context.strings.logsDialogBody,
buttons: [
ButtonWidget(
isInAlert: true,
buttonType: ButtonType.neutral,
- labelText: StringsLocalizations.of(context).reportABug,
+ labelText: context.strings.reportABug,
buttonAction: ButtonAction.first,
shouldSurfaceExecutionStates: false,
onTap: () async {
@@ -70,7 +70,7 @@ Future<void> sendLogs(
//on pressing this button
ButtonWidget(
buttonType: ButtonType.secondary,
- labelText: StringsLocalizations.of(context).viewLogs,
+ labelText: context.strings.viewLogs,
buttonAction: ButtonAction.second,
onTap: () async {
// ignore: unawaited_futures
@@ -87,7 +87,7 @@ Future<void> sendLogs(
),
ButtonWidget(
buttonType: ButtonType.secondary,
- labelText: StringsLocalizations.of(context).exportLogs,
+ labelText: context.strings.exportLogs,
buttonAction: ButtonAction.third,
shouldSurfaceExecutionStates: false,
onTap: () async {
@@ -99,7 +99,7 @@ Future<void> sendLogs(
ButtonWidget(
isInAlert: true,
buttonType: ButtonType.secondary,
- labelText: StringsLocalizations.of(context).cancel,
+ labelText: context.strings.cancel,
buttonAction: ButtonAction.cancel,
),
],
@@ -170,10 +170,7 @@ Future<void> triggerSendLogs(
Future<String> getZippedLogsFile(BuildContext? context) async {
late final ProgressDialog dialog;
if (context != null) {
- dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).preparingLogs,
- );
+ dialog = createProgressDialog(context, context.strings.preparingLogs);
await dialog.show();
}
final logsPath = (await getApplicationSupportDirectory()).path;
@@ -201,14 +198,12 @@ Future<void> shareLogs(
) async {
final result = await showDialogWidget(
context: context,
- title: StringsLocalizations.of(context).emailYourLogs,
- body: StringsLocalizations.of(
- context,
- ).pleaseSendTheLogsTo(toEmail: toEmail),
+ title: context.strings.emailYourLogs,
+ body: context.strings.pleaseSendTheLogsTo(toEmail: toEmail),
buttons: [
ButtonWidget(
buttonType: ButtonType.neutral,
- labelText: StringsLocalizations.of(context).copyEmailAddress,
+ labelText: context.strings.copyEmailAddress,
isInAlert: true,
buttonAction: ButtonAction.first,
onTap: () async {
@@ -218,13 +213,13 @@ Future<void> shareLogs(
),
ButtonWidget(
buttonType: ButtonType.neutral,
- labelText: StringsLocalizations.of(context).exportLogs,
+ labelText: context.strings.exportLogs,
isInAlert: true,
buttonAction: ButtonAction.second,
),
ButtonWidget(
buttonType: ButtonType.secondary,
- labelText: StringsLocalizations.of(context).cancel,
+ labelText: context.strings.cancel,
isInAlert: true,
buttonAction: ButtonAction.cancel,
),
@@ -342,7 +337,7 @@ Future<bool> sendComposedEmail(
}
final result = await OpenMailApp.composeNewEmailInMailApp(
- nativePickerTitle: StringsLocalizations.of(context).selectMailApp,
+ nativePickerTitle: context.strings.selectMailApp,
emailContent: emailContent,
);
if (!result.didOpen && !result.canOpen) {
@@ -353,9 +348,7 @@ Future<bool> sendComposedEmail(
await showCupertinoModalPopup(
context: context,
builder: (sheetContext) => CupertinoActionSheet(
- title: Text(
- StringsLocalizations.of(sheetContext).selectMailApp + " \n $to",
- ),
+ title: Text(sheetContext.strings.selectMailApp + " \n $to"),
actions: [
for (final app in result.options)
CupertinoActionSheetAction(
@@ -372,7 +365,7 @@ Future<bool> sendComposedEmail(
),
],
cancelButton: CupertinoActionSheetAction(
- child: Text(StringsLocalizations.of(sheetContext).cancel),
+ child: Text(sheetContext.strings.cancel),
onPressed: () {
Navigator.of(sheetContext).pop();
},
@@ -444,7 +437,7 @@ Future<void> _showNoMailAppsSheet(BuildContext context, String toEmail) async {
}
await showBaseBottomSheet<void>(
context,
- title: StringsLocalizations.of(context).noEmailAppFound,
+ title: context.strings.noEmailAppFound,
headerSpacing: 16,
child: _NoMailAppsSheet(toEmail: toEmail),
);
@@ -457,7 +450,7 @@ class _NoMailAppsSheet extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final l10n = StringsLocalizations.of(context);
+ final l10n = context.strings;
final textTheme = getEnteTextTheme(context);
return Column(
@@ -484,7 +477,7 @@ class _NoMailAppsSheet extends StatelessWidget {
Future<void> _copyEmailAddress(BuildContext context, String toEmail) async {
await Clipboard.setData(ClipboardData(text: toEmail));
if (context.mounted) {
- showShortToast(context, StringsLocalizations.of(context).copied);
+ showShortToast(context, context.strings.copied);
}
}
diff --git a/mobile/apps/photos/lib/utils/magic_util.dart b/mobile/apps/photos/lib/utils/magic_util.dart
index 21c59a19e1..06875653a9 100644
--- a/mobile/apps/photos/lib/utils/magic_util.dart
+++ b/mobile/apps/photos/lib/utils/magic_util.dart
@@ -32,8 +32,8 @@ Future<void> changeVisibility(
final dialog = createProgressDialog(
context,
newVisibility == archiveVisibility
- ? StringsLocalizations.of(context).archiving
- : StringsLocalizations.of(context).unarchiving,
+ ? context.strings.archiving
+ : context.strings.unarchiving,
);
await dialog.show();
try {
@@ -43,8 +43,8 @@ Future<void> changeVisibility(
showShortToast(
context,
newVisibility == archiveVisibility
- ? StringsLocalizations.of(context).successfullyArchived
- : StringsLocalizations.of(context).successfullyUnarchived,
+ ? context.strings.successfullyArchived
+ : context.strings.successfullyUnarchived,
);
}
} catch (e, s) {
@@ -124,10 +124,7 @@ Future<void> changeSortOrder(
} catch (e, s) {
_logger.severe("failed to update collection visibility", e, s);
if (context.mounted) {
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
}
rethrow;
}
@@ -147,10 +144,7 @@ Future<void> updateOrder(
} catch (e, s) {
_logger.severe("failed to update order", e, s);
if (context.mounted) {
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
}
rethrow;
}
@@ -173,10 +167,7 @@ Future<void> updateShareeOrder(
} catch (e, s) {
_logger.severe("failed to update sharee order", e, s);
if (context.mounted) {
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
}
rethrow;
}
@@ -206,10 +197,7 @@ Future<void> changeCoverPhoto(
} catch (e, s) {
_logger.severe("failed to update cover", e, s);
if (context.mounted) {
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
}
rethrow;
}
@@ -240,10 +228,7 @@ Future<bool> editTime(
};
}
- final dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).pleaseWait,
- );
+ final dialog = createProgressDialog(context, context.strings.pleaseWait);
await dialog.show();
try {
await FileMagicService.instance.updatePublicMagicMetadata(
@@ -258,7 +243,7 @@ Future<bool> editTime(
}
await dialog.hide();
if (context.mounted) {
- showShortToast(context, StringsLocalizations.of(context).done);
+ showShortToast(context, context.strings.done);
}
} catch (e, s) {
_logger.severe("failed to update times $fileIdToTimeUpdate", e, s);
@@ -268,10 +253,7 @@ Future<bool> editTime(
return true;
} catch (e) {
if (!context.mounted) return false;
- showShortToast(
- context,
- StringsLocalizations.of(context).somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
return false;
}
}
@@ -282,12 +264,12 @@ Future<void> editFilename(BuildContext context, EnteFile file) async {
final extName = extension(fileName);
final result = await showTextInputDialog(
context,
- title: StringsLocalizations.of(context).renameFile,
- submitButtonLabel: StringsLocalizations.of(context).rename,
+ title: context.strings.renameFile,
+ submitButtonLabel: context.strings.rename,
initialValue: nameWithoutExt,
message: extName.toUpperCase(),
alignMessage: Alignment.centerRight,
- hintText: StringsLocalizations.of(context).enterFileName,
+ hintText: context.strings.enterFileName,
maxLength: 50,
alwaysShowSuccessState: true,
onSubmit: (String text) async {
@@ -345,10 +327,7 @@ Future<void> _updatePublicMetadata(
}
ProgressDialog? dialog;
if (context != null && showProgressDialogs) {
- dialog = createProgressDialog(
- context,
- StringsLocalizations.of(context).pleaseWait,
- );
+ dialog = createProgressDialog(context, context.strings.pleaseWait);
await dialog.show();
}
try {
@@ -357,7 +336,7 @@ Future<void> _updatePublicMetadata(
if (context != null) {
await dialog?.hide();
if (showDoneToast && context.mounted) {
- showShortToast(context, StringsLocalizations.of(context).done);
+ showShortToast(context, context.strings.done);
}
}
@@ -383,13 +362,13 @@ String _visActionProgressDialogText(
) {
switch (action) {
case _VisibilityAction.archive:
- return StringsLocalizations.of(context).archiving;
+ return context.strings.archiving;
case _VisibilityAction.hide:
- return StringsLocalizations.of(context).hiding;
+ return context.strings.hiding;
case _VisibilityAction.unarchive:
- return StringsLocalizations.of(context).unarchiving;
+ return context.strings.unarchiving;
case _VisibilityAction.unHide:
- return StringsLocalizations.of(context).unhiding;
+ return context.strings.unhiding;
}
}
@@ -399,13 +378,13 @@ String _visActionSuccessfulText(
) {
switch (action) {
case _VisibilityAction.archive:
- return StringsLocalizations.of(context).successfullyArchived;
+ return context.strings.successfullyArchived;
case _VisibilityAction.hide:
- return StringsLocalizations.of(context).successfullyHid;
+ return context.strings.successfullyHid;
case _VisibilityAction.unarchive:
- return StringsLocalizations.of(context).successfullyUnarchived;
+ return context.strings.successfullyUnarchived;
case _VisibilityAction.unHide:
- return StringsLocalizations.of(context).successfullyUnhid;
+ return context.strings.successfullyUnhid;
}
}
diff --git a/mobile/apps/photos/test/ui/viewer/people/memory_lane_banner_section_test.dart b/mobile/apps/photos/test/ui/viewer/people/memory_lane_banner_section_test.dart
index 2d8d084fec..6e5c78b743 100644
--- a/mobile/apps/photos/test/ui/viewer/people/memory_lane_banner_section_test.dart
+++ b/mobile/apps/photos/test/ui/viewer/people/memory_lane_banner_section_test.dart
@@ -30,7 +30,7 @@ void main() {
expect(find.byType(MemoryLaneBanner), findsOneWidget);
final context = tester.element(find.byType(MemoryLaneBanner));
- final l10n = StringsLocalizations.of(context)!;
+ final l10n = context.strings;
expect(find.text(l10n.facesTimelineBannerTitle), findsOneWidget);
});