l10n: Extract strings

This commit is contained in:
Neeraj Gupta 2023-05-07 11:52:07 +05:30
parent 1d778821af
commit 2750192ed4
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1
3 changed files with 89 additions and 69 deletions

View file

@ -99,6 +99,7 @@
"scan": "Scan", "scan": "Scan",
"scanACode": "Scan a code", "scanACode": "Scan a code",
"verify": "Verify", "verify": "Verify",
"verifyEmail": "Verify email",
"enterCodeHint": "Enter the 6-digit code from\nyour authenticator app", "enterCodeHint": "Enter the 6-digit code from\nyour authenticator app",
"lostDeviceTitle": "Lost device?", "lostDeviceTitle": "Lost device?",
"twoFactorAuthTitle": "Two-factor authentication", "twoFactorAuthTitle": "Two-factor authentication",
@ -174,6 +175,19 @@
"privacyPolicyTitle": "Privacy Policy", "privacyPolicyTitle": "Privacy Policy",
"termsOfServicesTitle": "Terms", "termsOfServicesTitle": "Terms",
"encryption": "Encryption", "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, <underline>we cannot decrypt your data</underline>",
"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 <underline>end-to-end encrypted</underline>.", "ackPasswordLostWarning": "I understand that if I lose my password, I may lose my data since my data is <underline>end-to-end encrypted</underline>.",
"loginTerms": "By clicking log in, I agree to the <u-terms>terms of service</u-terms> and <u-policy>privacy policy</u-policy>", "loginTerms": "By clicking log in, I agree to the <u-terms>terms of service</u-terms> and <u-policy>privacy policy</u-policy>",
"logInLabel": "Log in", "logInLabel": "Log in",
@ -229,5 +243,19 @@
"sorry" : "Sorry", "sorry" : "Sorry",
"importFailureDesc": "Could not parse the selected file.\nPlease write to support@ente.io if you need help!", "importFailureDesc": "Could not parse the selected file.\nPlease write to support@ente.io if you need help!",
"pendingSyncs" : "Warning", "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 <green>{email}</green>",
"@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"
}
}
}
} }

View file

@ -1,10 +1,10 @@
import 'package:ente_auth/ente_theme_data.dart'; 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/services/user_service.dart';
import 'package:ente_auth/ui/common/dynamic_fab.dart'; import 'package:ente_auth/ui/common/dynamic_fab.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:step_progress_indicator/step_progress_indicator.dart'; import 'package:step_progress_indicator/step_progress_indicator.dart';
import 'package:styled_text/styled_text.dart';
class OTTVerificationPage extends StatefulWidget { class OTTVerificationPage extends StatefulWidget {
final String email; final String email;
@ -27,6 +27,7 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final l10n = context.l10n;
final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100; final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;
FloatingActionButtonLocation? fabLocation() { FloatingActionButtonLocation? fabLocation() {
@ -67,7 +68,7 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
isKeypadOpen: isKeypadOpen, isKeypadOpen: isKeypadOpen,
isFormValid: !(_verificationCodeController.text == null || isFormValid: !(_verificationCodeController.text == null ||
_verificationCodeController.text.isEmpty), _verificationCodeController.text.isEmpty),
buttonText: 'Verify', buttonText: l10n.verify,
onPressedFunction: () { onPressedFunction: () {
if (widget.isChangeEmail) { if (widget.isChangeEmail) {
UserService.instance.changeEmail( UserService.instance.changeEmail(
@ -88,6 +89,7 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
} }
Widget _getBody() { Widget _getBody() {
final l10n = context.l10n;
return ListView( return ListView(
children: [ children: [
Column( Column(
@ -96,7 +98,7 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
Padding( Padding(
padding: const EdgeInsets.fromLTRB(20, 30, 20, 15), padding: const EdgeInsets.fromLTRB(20, 30, 20, 15),
child: Text( child: Text(
'Verify email', l10n.verifyEmail,
style: Theme.of(context).textTheme.headline4, style: Theme.of(context).textTheme.headline4,
), ),
), ),
@ -110,28 +112,25 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 0, 12), padding: const EdgeInsets.fromLTRB(0, 0, 0, 12),
child: RichText( child: StyledText(
text: TextSpan( text: l10n.weHaveSendEmailTo(widget.email),
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.subtitle1! .subtitle1!
.copyWith(fontSize: 14), .copyWith(fontSize: 14),
children: [ tags: {
const TextSpan(text: "We've sent a mail to "), 'green': StyledTextTag(
TextSpan( style: TextStyle(
text: widget.email, color: Theme.of(context)
style: TextStyle( .colorScheme
color: Theme.of(context) .alternativeColor,
.colorScheme ),
.alternativeColor, ),
), },
)
],
),
), ),
), ),
Text( Text(
'Please check your inbox (and spam) to complete verification', l10n.checkInboxAndSpamFolder,
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.subtitle1! .subtitle1!
@ -153,7 +152,7 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
style: Theme.of(context).textTheme.subtitle1, style: Theme.of(context).textTheme.subtitle1,
decoration: InputDecoration( decoration: InputDecoration(
filled: true, filled: true,
hintText: 'Tap to enter code', hintText: l10n.tapToEnterCode,
contentPadding: const EdgeInsets.all(15), contentPadding: const EdgeInsets.all(15),
border: UnderlineInputBorder( border: UnderlineInputBorder(
borderSide: BorderSide.none, borderSide: BorderSide.none,
@ -186,7 +185,7 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
); );
}, },
child: Text( child: Text(
"Resend email", l10n.resendEmail,
style: Theme.of(context).textTheme.subtitle1!.copyWith( style: Theme.of(context).textTheme.subtitle1!.copyWith(
fontSize: 14, fontSize: 14,
decoration: TextDecoration.underline, decoration: TextDecoration.underline,

View file

@ -1,5 +1,3 @@
import 'package:ente_auth/core/configuration.dart'; import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/l10n/l10n.dart'; import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/services/user_service.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:flutter/services.dart';
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
import 'package:password_strength/password_strength.dart'; import 'package:password_strength/password_strength.dart';
import 'package:styled_text/styled_text.dart';
enum PasswordEntryMode { enum PasswordEntryMode {
set, set,
@ -87,13 +86,13 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
} }
} }
String title = "Set password"; String title = context.l10n.setPasswordTitle;
if (widget.mode == PasswordEntryMode.update) { if (widget.mode == PasswordEntryMode.update) {
title = "Change password"; title = context.l10n.changePasswordTitle;
} else if (widget.mode == PasswordEntryMode.reset) { } else if (widget.mode == PasswordEntryMode.reset) {
title = "Reset password"; title = context.l10n.resetPasswordTitle;
} else if (_volatilePassword != null) { } else if (_volatilePassword != null) {
title = "Encryption keys"; title = context.l10n.encryptionKeys;
} }
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: isKeypadOpen, resizeToAvoidBottomInset: isKeypadOpen,
@ -130,13 +129,13 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
Widget _getBody(String buttonTextAndHeading) { Widget _getBody(String buttonTextAndHeading) {
final email = Configuration.instance.getEmail(); final email = Configuration.instance.getEmail();
var passwordStrengthText = 'Weak'; var passwordStrengthText = context.l10n.weakStrength;
var passwordStrengthColor = Colors.redAccent; var passwordStrengthColor = Colors.redAccent;
if (_passwordStrength > kStrongPasswordStrengthThreshold) { if (_passwordStrength > kStrongPasswordStrengthThreshold) {
passwordStrengthText = 'Strong'; passwordStrengthText = context.l10n.strongStrength;
passwordStrengthColor = Colors.greenAccent; passwordStrengthColor = Colors.greenAccent;
} else if (_passwordStrength > kMildPasswordStrengthThreshold) { } else if (_passwordStrength > kMildPasswordStrengthThreshold) {
passwordStrengthText = 'Moderate'; passwordStrengthText = context.l10n.moderateStrength;
passwordStrengthColor = Colors.orangeAccent; passwordStrengthColor = Colors.orangeAccent;
} }
if (_volatilePassword != null) { if (_volatilePassword != null) {
@ -159,9 +158,9 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 20), padding: const EdgeInsets.symmetric(horizontal: 20),
child: Text( child: Text(
"Enter a" + widget.mode == PasswordEntryMode.set
(widget.mode != PasswordEntryMode.set ? " new " : " ") + ? context.l10n.enterPasswordToEncrypt
"password we can use to encrypt your data", : context.l10n.enterNewPasswordToEncrypt,
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
@ -172,26 +171,20 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
const Padding(padding: EdgeInsets.all(8)), const Padding(padding: EdgeInsets.all(8)),
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 20), padding: const EdgeInsets.symmetric(horizontal: 20),
child: RichText( child: StyledText(
text: TextSpan( text: context.l10n.passwordWarning,
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.subtitle1! .subtitle1!
.copyWith(fontSize: 14), .copyWith(fontSize: 14),
children: [ tags: {
const TextSpan( 'underline': StyledTextTag(
text: style: Theme.of(context).textTheme.subtitle1!.copyWith(
"We don't store this password, so if you forget, ", fontSize: 14,
), decoration: TextDecoration.underline,
TextSpan( ),
text: "we cannot decrypt your data", ),
style: Theme.of(context).textTheme.subtitle1!.copyWith( },
fontSize: 14,
decoration: TextDecoration.underline,
),
),
],
),
), ),
), ),
const Padding(padding: EdgeInsets.all(12)), const Padding(padding: EdgeInsets.all(12)),
@ -217,7 +210,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
fillColor: fillColor:
_isPasswordValid ? _validFieldValueColor : null, _isPasswordValid ? _validFieldValueColor : null,
filled: true, filled: true,
hintText: "Password", hintText: context.l10n.password,
contentPadding: const EdgeInsets.all(20), contentPadding: const EdgeInsets.all(20),
border: UnderlineInputBorder( border: UnderlineInputBorder(
borderSide: BorderSide.none, borderSide: BorderSide.none,
@ -280,7 +273,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
decoration: InputDecoration( decoration: InputDecoration(
fillColor: _passwordsMatch ? _validFieldValueColor : null, fillColor: _passwordsMatch ? _validFieldValueColor : null,
filled: true, filled: true,
hintText: "Confirm password", hintText: context.l10n.confirmPassword,
contentPadding: const EdgeInsets.symmetric( contentPadding: const EdgeInsets.symmetric(
horizontal: 20, horizontal: 20,
vertical: 20, vertical: 20,
@ -335,7 +328,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
padding: padding:
const EdgeInsets.symmetric(horizontal: 20, vertical: 8), const EdgeInsets.symmetric(horizontal: 20, vertical: 8),
child: Text( child: Text(
'Password Strength: $passwordStrengthText', context.l10n.passwordStrength(passwordStrengthText),
style: TextStyle( style: TextStyle(
color: passwordStrengthColor, color: passwordStrengthColor,
), ),
@ -349,8 +342,8 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(
builder: (BuildContext context) { builder: (BuildContext context) {
return const WebPage( return WebPage(
"How it works", context.l10n.howItWorks,
"https://ente.io/architecture", "https://ente.io/architecture",
); );
}, },
@ -361,7 +354,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
padding: const EdgeInsets.symmetric(horizontal: 20), padding: const EdgeInsets.symmetric(horizontal: 20),
child: RichText( child: RichText(
text: TextSpan( text: TextSpan(
text: "How it works", text: context.l10n.howItWorks,
style: Theme.of(context).textTheme.subtitle1!.copyWith( style: Theme.of(context).textTheme.subtitle1!.copyWith(
fontSize: 14, fontSize: 14,
decoration: TextDecoration.underline, decoration: TextDecoration.underline,
@ -381,14 +374,14 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
void _updatePassword() async { void _updatePassword() async {
final dialog = final dialog =
createProgressDialog(context, "Generating encryption keys..."); createProgressDialog(context, context.l10n.generatingEncryptionKeys);
await dialog.show(); await dialog.show();
try { try {
final keyAttributes = await Configuration.instance final keyAttributes = await Configuration.instance
.updatePassword(_passwordController1.text); .updatePassword(_passwordController1.text);
await UserService.instance.updateKeyAttributes(keyAttributes); await UserService.instance.updateKeyAttributes(keyAttributes);
await dialog.hide(); await dialog.hide();
showShortToast(context, "Password changed successfully"); showShortToast(context, context.l10n.passwordChangedSuccessfully);
Navigator.of(context).pop(); Navigator.of(context).pop();
if (widget.mode == PasswordEntryMode.reset) { if (widget.mode == PasswordEntryMode.reset) {
Navigator.of(context).popUntil((route) => route.isFirst); Navigator.of(context).popUntil((route) => route.isFirst);
@ -434,7 +427,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
context, context,
RecoveryKeyPage( RecoveryKeyPage(
result.privateKeyAttributes.recoveryKey, result.privateKeyAttributes.recoveryKey,
"Continue", context.l10n.continueLabel,
showAppBar: false, showAppBar: false,
isDismissible: false, isDismissible: false,
onDone: onDone, onDone: onDone,
@ -447,8 +440,8 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
if (e is UnsupportedError) { if (e is UnsupportedError) {
showErrorDialog( showErrorDialog(
context, context,
"Insecure device", context.l10n.insecureDevice,
"Sorry, we could not generate secure keys on this device.\n\nplease sign up from a different device.", context.l10n.sorryWeCouldNotGenerateSecureKeysOnThisDevicennplease,
); );
} else { } else {
showGenericErrorDialog(context: context); showGenericErrorDialog(context: context);