adding i18n to all other pages

This commit is contained in:
Azmat-7860
2026-10-03 11:22:48 +05:30
parent 47656678e1
commit 3fbeb606a8
22 changed files with 2526 additions and 249 deletions
@@ -152,11 +152,12 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Error'),
content: Text('Please select an image.'),
title: Text(AppLocalizations.of(context)!.error),
content: Text(
AppLocalizations.of(context)!.selectImage),
actions: [
TextButton(
child: const Text('OK'),
child: Text(AppLocalizations.of(context)!.ok),
onPressed: () {
Navigator.of(context).pop();
},
@@ -180,7 +181,9 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
await fetchProfileImageData();
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Profile image updated')),
SnackBar(
content: Text(AppLocalizations.of(context)!
.profileImageUpdated)),
);
}
} catch (e) {
@@ -188,11 +191,12 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Error'),
content: Text('Failed to upload image: $e'),
title: Text(AppLocalizations.of(context)!.error),
content: Text(AppLocalizations.of(context)!
.failedUploadImage(e.toString())),
actions: [
TextButton(
child: const Text('OK'),
child: Text(AppLocalizations.of(context)!.ok),
onPressed: () {
Navigator.of(context).pop();
},
@@ -212,7 +216,9 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
if (rawUserId == null) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('User id missing, please re-login')),
SnackBar(
content: Text(
AppLocalizations.of(context)!.userIdMissing)),
);
}
return;
@@ -241,7 +247,9 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
print("success");
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Profile updated')),
SnackBar(
content: Text(
AppLocalizations.of(context)!.profileUpdated)),
);
Navigator.of(context).pop();
}
@@ -251,15 +259,18 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'Failed to update profile: ${response.statusCode}')),
content: Text(AppLocalizations.of(context)!
.failedUpdateProfile(
response.statusCode.toString()))),
);
}
}
} catch (e) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Failed to update: $e')),
SnackBar(
content: Text(AppLocalizations.of(context)!
.failedUpdate(e.toString()))),
);
}
}
@@ -301,7 +312,9 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
Navigator.pop(context);
}),
centerTitle: true,
title: AppbarTitle(text: "My Profile Settings")),
title: AppbarTitle(
text:
AppLocalizations.of(context)!.myProfileSettings)),
body: SingleChildScrollView(
padding: EdgeInsets.all(16),
child: Column(
@@ -323,7 +336,8 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
SizedBox(height: 10),
CustomButton(
height: getVerticalSize(50),
text: "Pick a Profile Photo",
text: AppLocalizations.of(context)!
.pickProfilePhoto,
margin: getMargin(top: 24, bottom: 5),
onTap: () async {
// Pick + auto-upload, same as authsec_flutter_new
@@ -345,7 +359,7 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
SizedBox(height: 20),
// Section: Profile Form
Text(
'Your Profile Information',
AppLocalizations.of(context)!.yourProfileInfo,
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
SizedBox(height: 10),
@@ -359,17 +373,21 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text("Your Full Name",
Text(
AppLocalizations.of(context)!
.yourFullName,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900),
CustomTextFormField(
focusNode: FocusNode(),
controller: fullNameController,
hintText: "Enter Full Name",
hintText: AppLocalizations.of(context)!
.enterFullName,
validator: (value) {
if (value!.isEmpty) {
return 'Please enter your full name';
return AppLocalizations.of(context)!
.enterFullNameError;
}
return null;
},
@@ -381,13 +399,14 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text("Pronouns",
Text(AppLocalizations.of(context)!.pronouns,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900),
CustomTextFormField(
focusNode: FocusNode(),
hintText: "Enter Pronouns",
hintText: AppLocalizations.of(context)!
.enterPronouns,
controller: pronounsController,
margin: getMargin(top: 6))
])),
@@ -397,13 +416,14 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text("Role",
Text(AppLocalizations.of(context)!.role,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900),
CustomTextFormField(
focusNode: FocusNode(),
hintText: "Enter Role",
hintText: AppLocalizations.of(context)!
.enterRole,
controller: roleController,
margin: getMargin(top: 6))
])),
@@ -413,13 +433,16 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text("Department or Team",
Text(
AppLocalizations.of(context)!
.departmentOrTeam,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900),
CustomTextFormField(
focusNode: FocusNode(),
hintText: "Enter Department or Team",
hintText: AppLocalizations.of(context)!
.enterDepartmentOrTeam,
controller: departmentController,
margin: getMargin(top: 6))
])),
@@ -429,17 +452,19 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text("Email",
Text(AppLocalizations.of(context)!.email,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900),
CustomTextFormField(
focusNode: FocusNode(),
hintText: "Enter Email",
hintText: AppLocalizations.of(context)!
.enterEmail,
controller: emailController,
validator: (value) {
if (value!.isEmpty || !value!.contains('@')) {
return 'Please enter a valid email address';
return AppLocalizations.of(context)!
.validEmailError;
}
return null;
},
@@ -451,20 +476,21 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text("About Me",
Text(AppLocalizations.of(context)!.aboutMe,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900),
CustomTextFormField(
focusNode: FocusNode(),
hintText: "About Me",
hintText: AppLocalizations.of(context)!
.aboutMe,
controller: aboutMeController,
maxLines: 3,
margin: getMargin(top: 6))
])),
CustomButton(
height: getVerticalSize(50),
text: "Update Profile",
text: AppLocalizations.of(context)!.updateProfile,
margin: getMargin(top: 24, bottom: 5),
onTap: _updateProfile,
),
@@ -489,8 +515,8 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
text: TextSpan(
children: <TextSpan>[
TextSpan(
text:
"Password:Change Password for your account Change password",
text: AppLocalizations.of(context)!
.profilePasswordRow,
style: TextStyle(
fontWeight: FontWeight.normal,
color: Colors.blue,
@@ -509,8 +535,8 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
text: TextSpan(
children: <TextSpan>[
TextSpan(
text:
'Security:Logout of all sessions except this current browser Logout other sessions',
text: AppLocalizations.of(context)!
.profileSecurityRow,
style: TextStyle(
fontWeight: FontWeight.normal,
color: Colors.blue,
@@ -529,8 +555,8 @@ class _ProfileSettingsScreenState extends State<ProfileSettingsScreen> {
text: TextSpan(
children: <TextSpan>[
TextSpan(
text:
'Deactivation:Remove access to all organizations and workspace in cloudnsure Deactivate account',
text: AppLocalizations.of(context)!
.profileDeactivationRow,
style: TextStyle(
fontWeight: FontWeight.normal,
color: Colors.blue,