diff --git a/lib/l10n/arb/app_en.arb b/lib/l10n/arb/app_en.arb index 232e5213c..6858d8d3a 100644 --- a/lib/l10n/arb/app_en.arb +++ b/lib/l10n/arb/app_en.arb @@ -99,6 +99,7 @@ "scan": "Scan", "scanACode": "Scan a code", "verify": "Verify", + "verifyEmail": "Verify email", "enterCodeHint": "Enter the 6-digit code from\nyour authenticator app", "lostDeviceTitle": "Lost device?", "twoFactorAuthTitle": "Two-factor authentication", @@ -174,6 +175,19 @@ "privacyPolicyTitle": "Privacy Policy", "termsOfServicesTitle": "Terms", "encryption": "Encryption", + "setPasswordTitle": "Set password", + "changePasswordTitle": "Change password", + "resetPasswordTitle": "Reset password", + "encryptionKeys": "Encryption keys", + "passwordWarning": "We don't store this password, so if you forget, we cannot decrypt your data", + "enterPasswordToEncrypt": "Enter a password we can use to encrypt your data", + "enterNewPasswordToEncrypt": "Enter a new password we can use to encrypt your data", + "passwordChangedSuccessfully": "Password changed successfully", + "generatingEncryptionKeys": "Generating encryption keys...", + "continueLabel": "Continue", + "insecureDevice": "Insecure device", + "sorryWeCouldNotGenerateSecureKeysOnThisDevicennplease": "Sorry, we could not generate secure keys on this device.\n\nplease sign up from a different device.", + "howItWorks": "How it works", "ackPasswordLostWarning": "I understand that if I lose my password, I may lose my data since my data is end-to-end encrypted.", "loginTerms": "By clicking log in, I agree to the terms of service and privacy policy", "logInLabel": "Log in", @@ -229,5 +243,19 @@ "sorry" : "Sorry", "importFailureDesc": "Could not parse the selected file.\nPlease write to support@ente.io if you need help!", "pendingSyncs" : "Warning", - "pendingSyncsWarningBody": "Some of your codes have not been backed up.\n\nPlease ensure that you have a backup for these codes before you logout." + "pendingSyncsWarningBody": "Some of your codes have not been backed up.\n\nPlease ensure that you have a backup for these codes before you logout.", + "checkInboxAndSpamFolder": "Please check your inbox (and spam) to complete verification", + "tapToEnterCode": "Tap to enter code", + "resendEmail": "Resend email", + "weHaveSendEmailTo": "We have sent a mail to {email}", + "@weHaveSendEmailTo": { + "description": "Text to indicate that we have sent a mail to the user", + "placeholders": { + "email": { + "description": "The email address of the user", + "type": "String", + "example": "example@ente.io" + } + } + } } diff --git a/lib/ui/account/ott_verification_page.dart b/lib/ui/account/ott_verification_page.dart index 3df518c2b..0aa4a05af 100644 --- a/lib/ui/account/ott_verification_page.dart +++ b/lib/ui/account/ott_verification_page.dart @@ -1,10 +1,10 @@ - - import 'package:ente_auth/ente_theme_data.dart'; +import 'package:ente_auth/l10n/l10n.dart'; import 'package:ente_auth/services/user_service.dart'; import 'package:ente_auth/ui/common/dynamic_fab.dart'; import 'package:flutter/material.dart'; import 'package:step_progress_indicator/step_progress_indicator.dart'; +import 'package:styled_text/styled_text.dart'; class OTTVerificationPage extends StatefulWidget { final String email; @@ -27,6 +27,7 @@ class _OTTVerificationPageState extends State { @override Widget build(BuildContext context) { + final l10n = context.l10n; final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100; FloatingActionButtonLocation? fabLocation() { @@ -67,7 +68,7 @@ class _OTTVerificationPageState extends State { isKeypadOpen: isKeypadOpen, isFormValid: !(_verificationCodeController.text == null || _verificationCodeController.text.isEmpty), - buttonText: 'Verify', + buttonText: l10n.verify, onPressedFunction: () { if (widget.isChangeEmail) { UserService.instance.changeEmail( @@ -88,6 +89,7 @@ class _OTTVerificationPageState extends State { } Widget _getBody() { + final l10n = context.l10n; return ListView( children: [ Column( @@ -96,7 +98,7 @@ class _OTTVerificationPageState extends State { Padding( padding: const EdgeInsets.fromLTRB(20, 30, 20, 15), child: Text( - 'Verify email', + l10n.verifyEmail, style: Theme.of(context).textTheme.headline4, ), ), @@ -110,28 +112,25 @@ class _OTTVerificationPageState extends State { children: [ Padding( padding: const EdgeInsets.fromLTRB(0, 0, 0, 12), - child: RichText( - text: TextSpan( - style: Theme.of(context) - .textTheme - .subtitle1! - .copyWith(fontSize: 14), - children: [ - const TextSpan(text: "We've sent a mail to "), - TextSpan( - text: widget.email, - style: TextStyle( - color: Theme.of(context) - .colorScheme - .alternativeColor, - ), - ) - ], - ), + child: StyledText( + text: l10n.weHaveSendEmailTo(widget.email), + style: Theme.of(context) + .textTheme + .subtitle1! + .copyWith(fontSize: 14), + tags: { + 'green': StyledTextTag( + style: TextStyle( + color: Theme.of(context) + .colorScheme + .alternativeColor, + ), + ), + }, ), ), Text( - 'Please check your inbox (and spam) to complete verification', + l10n.checkInboxAndSpamFolder, style: Theme.of(context) .textTheme .subtitle1! @@ -153,7 +152,7 @@ class _OTTVerificationPageState extends State { style: Theme.of(context).textTheme.subtitle1, decoration: InputDecoration( filled: true, - hintText: 'Tap to enter code', + hintText: l10n.tapToEnterCode, contentPadding: const EdgeInsets.all(15), border: UnderlineInputBorder( borderSide: BorderSide.none, @@ -186,7 +185,7 @@ class _OTTVerificationPageState extends State { ); }, child: Text( - "Resend email", + l10n.resendEmail, style: Theme.of(context).textTheme.subtitle1!.copyWith( fontSize: 14, decoration: TextDecoration.underline, diff --git a/lib/ui/account/password_entry_page.dart b/lib/ui/account/password_entry_page.dart index 0cbc7772c..20c75dfcb 100644 --- a/lib/ui/account/password_entry_page.dart +++ b/lib/ui/account/password_entry_page.dart @@ -1,5 +1,3 @@ - - import 'package:ente_auth/core/configuration.dart'; import 'package:ente_auth/l10n/l10n.dart'; import 'package:ente_auth/services/user_service.dart'; @@ -14,6 +12,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:logging/logging.dart'; import 'package:password_strength/password_strength.dart'; +import 'package:styled_text/styled_text.dart'; enum PasswordEntryMode { set, @@ -87,13 +86,13 @@ class _PasswordEntryPageState extends State { } } - String title = "Set password"; + String title = context.l10n.setPasswordTitle; if (widget.mode == PasswordEntryMode.update) { - title = "Change password"; + title = context.l10n.changePasswordTitle; } else if (widget.mode == PasswordEntryMode.reset) { - title = "Reset password"; + title = context.l10n.resetPasswordTitle; } else if (_volatilePassword != null) { - title = "Encryption keys"; + title = context.l10n.encryptionKeys; } return Scaffold( resizeToAvoidBottomInset: isKeypadOpen, @@ -130,13 +129,13 @@ class _PasswordEntryPageState extends State { Widget _getBody(String buttonTextAndHeading) { final email = Configuration.instance.getEmail(); - var passwordStrengthText = 'Weak'; + var passwordStrengthText = context.l10n.weakStrength; var passwordStrengthColor = Colors.redAccent; if (_passwordStrength > kStrongPasswordStrengthThreshold) { - passwordStrengthText = 'Strong'; + passwordStrengthText = context.l10n.strongStrength; passwordStrengthColor = Colors.greenAccent; } else if (_passwordStrength > kMildPasswordStrengthThreshold) { - passwordStrengthText = 'Moderate'; + passwordStrengthText = context.l10n.moderateStrength; passwordStrengthColor = Colors.orangeAccent; } if (_volatilePassword != null) { @@ -159,9 +158,9 @@ class _PasswordEntryPageState extends State { Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: Text( - "Enter a" + - (widget.mode != PasswordEntryMode.set ? " new " : " ") + - "password we can use to encrypt your data", + widget.mode == PasswordEntryMode.set + ? context.l10n.enterPasswordToEncrypt + : context.l10n.enterNewPasswordToEncrypt, textAlign: TextAlign.start, style: Theme.of(context) .textTheme @@ -172,26 +171,20 @@ class _PasswordEntryPageState extends State { const Padding(padding: EdgeInsets.all(8)), Padding( padding: const EdgeInsets.symmetric(horizontal: 20), - child: RichText( - text: TextSpan( - style: Theme.of(context) - .textTheme - .subtitle1! - .copyWith(fontSize: 14), - children: [ - const TextSpan( - text: - "We don't store this password, so if you forget, ", - ), - TextSpan( - text: "we cannot decrypt your data", - style: Theme.of(context).textTheme.subtitle1!.copyWith( - fontSize: 14, - decoration: TextDecoration.underline, - ), - ), - ], - ), + child: StyledText( + text: context.l10n.passwordWarning, + style: Theme.of(context) + .textTheme + .subtitle1! + .copyWith(fontSize: 14), + tags: { + 'underline': StyledTextTag( + style: Theme.of(context).textTheme.subtitle1!.copyWith( + fontSize: 14, + decoration: TextDecoration.underline, + ), + ), + }, ), ), const Padding(padding: EdgeInsets.all(12)), @@ -217,7 +210,7 @@ class _PasswordEntryPageState extends State { fillColor: _isPasswordValid ? _validFieldValueColor : null, filled: true, - hintText: "Password", + hintText: context.l10n.password, contentPadding: const EdgeInsets.all(20), border: UnderlineInputBorder( borderSide: BorderSide.none, @@ -280,7 +273,7 @@ class _PasswordEntryPageState extends State { decoration: InputDecoration( fillColor: _passwordsMatch ? _validFieldValueColor : null, filled: true, - hintText: "Confirm password", + hintText: context.l10n.confirmPassword, contentPadding: const EdgeInsets.symmetric( horizontal: 20, vertical: 20, @@ -335,7 +328,7 @@ class _PasswordEntryPageState extends State { padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 8), child: Text( - 'Password Strength: $passwordStrengthText', + context.l10n.passwordStrength(passwordStrengthText), style: TextStyle( color: passwordStrengthColor, ), @@ -349,8 +342,8 @@ class _PasswordEntryPageState extends State { Navigator.of(context).push( MaterialPageRoute( builder: (BuildContext context) { - return const WebPage( - "How it works", + return WebPage( + context.l10n.howItWorks, "https://ente.io/architecture", ); }, @@ -361,7 +354,7 @@ class _PasswordEntryPageState extends State { padding: const EdgeInsets.symmetric(horizontal: 20), child: RichText( text: TextSpan( - text: "How it works", + text: context.l10n.howItWorks, style: Theme.of(context).textTheme.subtitle1!.copyWith( fontSize: 14, decoration: TextDecoration.underline, @@ -381,14 +374,14 @@ class _PasswordEntryPageState extends State { void _updatePassword() async { final dialog = - createProgressDialog(context, "Generating encryption keys..."); + createProgressDialog(context, context.l10n.generatingEncryptionKeys); await dialog.show(); try { final keyAttributes = await Configuration.instance .updatePassword(_passwordController1.text); await UserService.instance.updateKeyAttributes(keyAttributes); await dialog.hide(); - showShortToast(context, "Password changed successfully"); + showShortToast(context, context.l10n.passwordChangedSuccessfully); Navigator.of(context).pop(); if (widget.mode == PasswordEntryMode.reset) { Navigator.of(context).popUntil((route) => route.isFirst); @@ -434,7 +427,7 @@ class _PasswordEntryPageState extends State { context, RecoveryKeyPage( result.privateKeyAttributes.recoveryKey, - "Continue", + context.l10n.continueLabel, showAppBar: false, isDismissible: false, onDone: onDone, @@ -447,8 +440,8 @@ class _PasswordEntryPageState extends State { if (e is UnsupportedError) { showErrorDialog( context, - "Insecure device", - "Sorry, we could not generate secure keys on this device.\n\nplease sign up from a different device.", + context.l10n.insecureDevice, + context.l10n.sorryWeCouldNotGenerateSecureKeysOnThisDevicennplease, ); } else { showGenericErrorDialog(context: context);