Extract strings

This commit is contained in:
Neeraj Gupta 2023-04-04 22:26:36 +05:30
parent ef19bf9950
commit 31850533cd
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1
5 changed files with 174 additions and 19 deletions

View file

@ -24,6 +24,8 @@ class MessageLookup extends MessageLookupByLibrary {
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"accountWelcomeBack":
MessageLookupByLibrary.simpleMessage("Welcome back!"),
"activeSessions":
MessageLookupByLibrary.simpleMessage("Active sessions"),
"askDeleteReason": MessageLookupByLibrary.simpleMessage(
"What is the main reason you are deleting your account?"),
"cancel": MessageLookupByLibrary.simpleMessage("Cancel"),
@ -31,6 +33,11 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Confirm Account Deletion"),
"confirmDeletePrompt": MessageLookupByLibrary.simpleMessage(
"Yes, I want to permanently delete this account and all its data."),
"confirmPassword":
MessageLookupByLibrary.simpleMessage("Confirm password"),
"createAccount": MessageLookupByLibrary.simpleMessage("Create account"),
"createNewAccount":
MessageLookupByLibrary.simpleMessage("Create new account"),
"deleteAccount": MessageLookupByLibrary.simpleMessage("Delete account"),
"deleteAccountFeedbackPrompt": MessageLookupByLibrary.simpleMessage(
"We are sorry to see you go. Please share your feedback to help us improve."),
@ -61,10 +68,24 @@ class MessageLookup extends MessageLookupByLibrary {
"kindlyHelpUsWithThisInformation": MessageLookupByLibrary.simpleMessage(
"Kindly help us with this information"),
"ok": MessageLookupByLibrary.simpleMessage("Ok"),
"oops": MessageLookupByLibrary.simpleMessage("Oops"),
"password": MessageLookupByLibrary.simpleMessage("Password"),
"pleaseSendAnEmailTo":
MessageLookupByLibrary.simpleMessage("Please send an email to"),
"selectReason": MessageLookupByLibrary.simpleMessage("Select reason"),
"sendEmail": MessageLookupByLibrary.simpleMessage("Send email"),
"somethingWentWrongPleaseTryAgain":
MessageLookupByLibrary.simpleMessage(
"Something went wrong, please try again"),
"terminate": MessageLookupByLibrary.simpleMessage("Terminate"),
"terminateSession":
MessageLookupByLibrary.simpleMessage("Terminate session?"),
"thisDevice": MessageLookupByLibrary.simpleMessage("This device"),
"thisWillLogYouOutOfTheFollowingDevice":
MessageLookupByLibrary.simpleMessage(
"This will log you out of the following device:"),
"thisWillLogYouOutOfThisDevice": MessageLookupByLibrary.simpleMessage(
"This will log you out of this device!"),
"verify": MessageLookupByLibrary.simpleMessage("Verify"),
"yourAccountHasBeenDeleted": MessageLookupByLibrary.simpleMessage(
"Your account has been deleted")

View file

@ -321,6 +321,126 @@ class S {
args: [],
);
}
/// `Create account`
String get createAccount {
return Intl.message(
'Create account',
name: 'createAccount',
desc: '',
args: [],
);
}
/// `Create new account`
String get createNewAccount {
return Intl.message(
'Create new account',
name: 'createNewAccount',
desc: '',
args: [],
);
}
/// `Password`
String get password {
return Intl.message(
'Password',
name: 'password',
desc: '',
args: [],
);
}
/// `Confirm password`
String get confirmPassword {
return Intl.message(
'Confirm password',
name: 'confirmPassword',
desc: '',
args: [],
);
}
/// `Active sessions`
String get activeSessions {
return Intl.message(
'Active sessions',
name: 'activeSessions',
desc: '',
args: [],
);
}
/// `Oops`
String get oops {
return Intl.message(
'Oops',
name: 'oops',
desc: '',
args: [],
);
}
/// `Something went wrong, please try again`
String get somethingWentWrongPleaseTryAgain {
return Intl.message(
'Something went wrong, please try again',
name: 'somethingWentWrongPleaseTryAgain',
desc: '',
args: [],
);
}
/// `This will log you out of this device!`
String get thisWillLogYouOutOfThisDevice {
return Intl.message(
'This will log you out of this device!',
name: 'thisWillLogYouOutOfThisDevice',
desc: '',
args: [],
);
}
/// `This will log you out of the following device:`
String get thisWillLogYouOutOfTheFollowingDevice {
return Intl.message(
'This will log you out of the following device:',
name: 'thisWillLogYouOutOfTheFollowingDevice',
desc: '',
args: [],
);
}
/// `Terminate session?`
String get terminateSession {
return Intl.message(
'Terminate session?',
name: 'terminateSession',
desc: '',
args: [],
);
}
/// `Terminate`
String get terminate {
return Intl.message(
'Terminate',
name: 'terminate',
desc: '',
args: [],
);
}
/// `This device`
String get thisDevice {
return Intl.message(
'This device',
name: 'thisDevice',
desc: '',
args: [],
);
}
}
class AppLocalizationDelegate extends LocalizationsDelegate<S> {

View file

@ -31,5 +31,17 @@
"@fromYourRegisteredEmailAddress": {
"description": "This text is part of the sentence 'Please send an email to email@ente.io from your registered email address.'"
},
"ok": "Ok"
"ok": "Ok",
"createAccount": "Create account",
"createNewAccount": "Create new account",
"password": "Password",
"confirmPassword": "Confirm password",
"activeSessions": "Active sessions",
"oops": "Oops",
"somethingWentWrongPleaseTryAgain": "Something went wrong, please try again",
"thisWillLogYouOutOfThisDevice": "This will log you out of this device!",
"thisWillLogYouOutOfTheFollowingDevice": "This will log you out of the following device:",
"terminateSession": "Terminate session?",
"terminate": "Terminate",
"thisDevice": "This device"
}

View file

@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
import 'package:password_strength/password_strength.dart';
import 'package:photos/core/configuration.dart';
import 'package:photos/ente_theme_data.dart';
import "package:photos/generated/l10n.dart";
import 'package:photos/services/user_service.dart';
import 'package:photos/ui/common/dynamic_fab.dart';
import 'package:photos/ui/common/web_page.dart';
@ -99,7 +100,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
floatingActionButton: DynamicFAB(
isKeypadOpen: isKeypadOpen,
isFormValid: _isFormValid(),
buttonText: 'Create account',
buttonText: S.of(context).createAccount,
onPressedFunction: () {
_config.setVolatilePassword(_passwordController1.text);
UserService.instance.setEmail(_email!);
@ -133,7 +134,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
padding:
const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
child: Text(
'Create new account',
S.of(context).createNewAccount,
style: Theme.of(context).textTheme.headline4,
),
),
@ -145,7 +146,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
decoration: InputDecoration(
fillColor: _emailIsValid ? _validFieldValueColor : null,
filled: true,
hintText: 'Email',
hintText: S.of(context).email,
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 14,
@ -193,7 +194,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
fillColor:
_passwordIsValid ? _validFieldValueColor : null,
filled: true,
hintText: "Password",
hintText: S.of(context).password,
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 14,
@ -262,7 +263,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
? _validFieldValueColor
: null,
filled: true,
hintText: "Confirm password",
hintText: S.of(context).confirmPassword,
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 14,

View file

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
import 'package:photos/core/configuration.dart';
import 'package:photos/ente_theme_data.dart';
import "package:photos/generated/l10n.dart";
import 'package:photos/models/sessions.dart';
import 'package:photos/services/user_service.dart';
import 'package:photos/ui/common/loading_widget.dart';
@ -33,7 +34,7 @@ class _SessionsPageState extends State<SessionsPage> {
return Scaffold(
appBar: AppBar(
elevation: 0,
title: const Text("Active sessions"),
title: Text(S.of(context).activeSessions),
),
body: _getBody(),
);
@ -122,8 +123,8 @@ class _SessionsPageState extends State<SessionsPage> {
_logger.severe('failed to terminate');
showErrorDialog(
context,
'Oops',
"Something went wrong, please try again",
S.of(context).oops,
S.of(context).somethingWentWrongPleaseTryAgain,
);
}
}
@ -148,15 +149,15 @@ class _SessionsPageState extends State<SessionsPage> {
session.token == Configuration.instance.getToken();
Widget text;
if (isLoggingOutFromThisDevice) {
text = const Text(
"This will log you out of this device!",
text = Text(
S.of(context).thisWillLogYouOutOfThisDevice,
);
} else {
text = SingleChildScrollView(
child: Column(
children: [
const Text(
"This will log you out of the following device:",
Text(
S.of(context).thisWillLogYouOutOfTheFollowingDevice,
),
const Padding(padding: EdgeInsets.all(8)),
Text(
@ -168,13 +169,13 @@ class _SessionsPageState extends State<SessionsPage> {
);
}
final AlertDialog alert = AlertDialog(
title: const Text("Terminate session?"),
title: Text(S.of(context).terminateSession),
content: text,
actions: [
TextButton(
child: const Text(
"Terminate",
style: TextStyle(
child: Text(
S.of(context).terminate,
style: const TextStyle(
color: Colors.red,
),
),
@ -189,7 +190,7 @@ class _SessionsPageState extends State<SessionsPage> {
),
TextButton(
child: Text(
"Cancel",
S.of(context).cancel,
style: TextStyle(
color: isLoggingOutFromThisDevice
? Theme.of(context).colorScheme.greenAlternative
@ -214,7 +215,7 @@ class _SessionsPageState extends State<SessionsPage> {
Widget _getUAWidget(Session session) {
if (session.token == Configuration.instance.getToken()) {
return Text(
"This device",
S.of(context).thisDevice,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.greenAlternative,