Skip to content

Commit fbc26d4

Browse files
authored
Merge pull request #25 from headlines-toolkit/refactor_enhance_auth_localization
Refactor enhance auth localization
2 parents 9b5135f + add02ed commit fbc26d4

File tree

11 files changed

+74
-52
lines changed

11 files changed

+74
-52
lines changed

lib/authentication/view/authentication_page.dart

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,14 @@ import 'package:ht_dashboard/router/routes.dart';
1010
import 'package:ht_dashboard/shared/constants/app_spacing.dart';
1111

1212
/// {@template authentication_page}
13-
/// Displays authentication options (Google, Email, Anonymous) based on context.
13+
/// Displays authentication options for the dashboard.
1414
///
15-
/// This page can be used for both initial sign-in and for connecting an
16-
/// existing anonymous account.
15+
/// This page provides a secure sign-in method for administrators and
16+
/// publishers via email.
1717
/// {@endtemplate}
1818
class AuthenticationPage extends StatelessWidget {
1919
/// {@macro authentication_page}
20-
const AuthenticationPage({
21-
required this.headline,
22-
required this.subHeadline,
23-
required this.showAnonymousButton,
24-
super.key,
25-
});
26-
27-
/// The main title displayed on the page.
28-
final String headline;
29-
30-
/// The descriptive text displayed below the headline.
31-
final String subHeadline;
32-
33-
/// Whether to show the "Continue Anonymously" button.
34-
final bool showAnonymousButton;
20+
const AuthenticationPage({super.key});
3521

3622
@override
3723
Widget build(BuildContext context) {
@@ -88,15 +74,15 @@ class AuthenticationPage extends StatelessWidget {
8874
// const SizedBox(height: AppSpacing.lg),
8975
// --- Headline and Subheadline ---
9076
Text(
91-
headline,
77+
l10n.authenticationPageHeadline,
9278
style: textTheme.headlineMedium?.copyWith(
9379
fontWeight: FontWeight.bold,
9480
),
9581
textAlign: TextAlign.center,
9682
),
9783
const SizedBox(height: AppSpacing.md),
9884
Text(
99-
subHeadline,
85+
l10n.authenticationPageSubheadline,
10086
style: textTheme.bodyLarge?.copyWith(
10187
color: colorScheme.onSurfaceVariant,
10288
),

lib/authentication/view/request_code_page.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
import 'package:flutter/material.dart';
55
import 'package:flutter_bloc/flutter_bloc.dart';
6+
import 'package:go_router/go_router.dart';
67
import 'package:ht_dashboard/app/bloc/app_bloc.dart';
78
import 'package:ht_dashboard/app/config/config.dart';
8-
import 'package:go_router/go_router.dart';
99
import 'package:ht_dashboard/authentication/bloc/authentication_bloc.dart';
1010
import 'package:ht_dashboard/l10n/l10n.dart';
1111
import 'package:ht_dashboard/router/routes.dart';
@@ -137,7 +137,9 @@ class _RequestCodeView extends StatelessWidget {
137137
builder: (context, environment) {
138138
if (environment == AppEnvironment.demo) {
139139
return Padding(
140-
padding: const EdgeInsets.only(top: AppSpacing.lg),
140+
padding: const EdgeInsets.only(
141+
top: AppSpacing.lg,
142+
),
141143
child: Text(
142144
l10n.demoEmailHint('[email protected]'),
143145
style: textTheme.bodyMedium?.copyWith(

lib/content_management/view/create_category_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ class _CreateCategoryViewState extends State<_CreateCategoryView> {
8282
SnackBar(content: Text(l10n.categoryCreatedSuccessfully)),
8383
);
8484
context.read<ContentManagementBloc>().add(
85-
// Refresh the list to show the new category
86-
const LoadCategoriesRequested(limit: kDefaultRowsPerPage),
85+
// Refresh the list to show the new category
86+
const LoadCategoriesRequested(limit: kDefaultRowsPerPage),
8787
);
8888
context.pop();
8989
}

lib/content_management/view/create_headline_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ class _CreateHeadlineViewState extends State<_CreateHeadlineView> {
8484
SnackBar(content: Text(l10n.headlineCreatedSuccessfully)),
8585
);
8686
context.read<ContentManagementBloc>().add(
87-
// Refresh the list to show the new headline
88-
const LoadHeadlinesRequested(limit: kDefaultRowsPerPage),
87+
// Refresh the list to show the new headline
88+
const LoadHeadlinesRequested(limit: kDefaultRowsPerPage),
8989
);
9090
context.pop();
9191
}

lib/content_management/view/create_source_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ class _CreateSourceViewState extends State<_CreateSourceView> {
8484
SnackBar(content: Text(l10n.sourceCreatedSuccessfully)),
8585
);
8686
context.read<ContentManagementBloc>().add(
87-
// Refresh the list to show the new source
88-
const LoadSourcesRequested(limit: kDefaultRowsPerPage),
87+
// Refresh the list to show the new source
88+
const LoadSourcesRequested(limit: kDefaultRowsPerPage),
8989
);
9090
context.pop();
9191
}

lib/l10n/app_localizations.dart

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,18 @@ abstract class AppLocalizations {
104104
/// **'Hello World!'**
105105
String get helloWorld;
106106

107+
/// Headline for the main authentication page
108+
///
109+
/// In en, this message translates to:
110+
/// **'Dashboard Access'**
111+
String get authenticationPageHeadline;
112+
113+
/// Subheadline for the main authentication page
114+
///
115+
/// In en, this message translates to:
116+
/// **'Secure sign-in for administrators and publishers.'**
117+
String get authenticationPageSubheadline;
118+
107119
/// Button label for signing in with email
108120
///
109121
/// In en, this message translates to:
@@ -113,19 +125,19 @@ abstract class AppLocalizations {
113125
/// Title for the email sign-in page
114126
///
115127
/// In en, this message translates to:
116-
/// **'Email Sign In'**
128+
/// **'Secure Email Sign-In'**
117129
String get emailSignInPageTitle;
118130

119131
/// Headline for the request code page
120132
///
121133
/// In en, this message translates to:
122-
/// **'Sign in or create an account'**
134+
/// **'Secure Email Sign-In'**
123135
String get requestCodePageHeadline;
124136

125137
/// Subheadline for the request code page
126138
///
127139
/// In en, this message translates to:
128-
/// **'Enter your email to receive a verification code. No password needed!'**
140+
/// **'Enter your authorized email to receive a secure sign-in code.'**
129141
String get requestCodePageSubheadline;
130142

131143
/// Label for the email input field on the request code page

lib/l10n/app_localizations_ar.dart

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,26 @@ class AppLocalizationsAr extends AppLocalizations {
1111
@override
1212
String get helloWorld => 'مرحبا بالعالم!';
1313

14+
@override
15+
String get authenticationPageHeadline => 'الوصول إلى لوحة التحكم';
16+
17+
@override
18+
String get authenticationPageSubheadline =>
19+
'تسجيل دخول آمن للمسؤولين والناشرين.';
20+
1421
@override
1522
String get authenticationEmailSignInButton =>
1623
'تسجيل الدخول بالبريد الإلكتروني';
1724

1825
@override
19-
String get emailSignInPageTitle => 'تسجيل الدخول بالبريد الإلكتروني';
26+
String get emailSignInPageTitle => 'تسجيل دخول آمن بالبريد الإلكتروني';
2027

2128
@override
22-
String get requestCodePageHeadline => 'سجل الدخول أو أنشئ حسابًا';
29+
String get requestCodePageHeadline => 'تسجيل دخول آمن بالبريد الإلكتروني';
2330

2431
@override
2532
String get requestCodePageSubheadline =>
26-
'أدخل بريدك الإلكتروني لتلقي رمز التحقق. لا حاجة لكلمة مرور!';
33+
'أدخل بريدك الإلكتروني المعتمد لتلقي رمز تسجيل دخول آمن.';
2734

2835
@override
2936
String get requestCodeEmailLabel => 'البريد الإلكتروني';

lib/l10n/app_localizations_en.dart

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,25 @@ class AppLocalizationsEn extends AppLocalizations {
1111
@override
1212
String get helloWorld => 'Hello World!';
1313

14+
@override
15+
String get authenticationPageHeadline => 'Dashboard Access';
16+
17+
@override
18+
String get authenticationPageSubheadline =>
19+
'Secure sign-in for administrators and publishers.';
20+
1421
@override
1522
String get authenticationEmailSignInButton => 'Sign in with Email';
1623

1724
@override
18-
String get emailSignInPageTitle => 'Email Sign In';
25+
String get emailSignInPageTitle => 'Secure Email Sign-In';
1926

2027
@override
21-
String get requestCodePageHeadline => 'Sign in or create an account';
28+
String get requestCodePageHeadline => 'Secure Email Sign-In';
2229

2330
@override
2431
String get requestCodePageSubheadline =>
25-
'Enter your email to receive a verification code. No password needed!';
32+
'Enter your authorized email to receive a secure sign-in code.';
2633

2734
@override
2835
String get requestCodeEmailLabel => 'Email';

lib/l10n/arb/app_ar.arb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,27 @@
33
"@helloWorld": {
44
"description": "التحية التقليدية للمبرمج حديث الولادة"
55
},
6+
"authenticationPageHeadline": "الوصول إلى لوحة التحكم",
7+
"@authenticationPageHeadline": {
8+
"description": "عنوان صفحة المصادقة الرئيسية"
9+
},
10+
"authenticationPageSubheadline": "تسجيل دخول آمن للمسؤولين والناشرين.",
11+
"@authenticationPageSubheadline": {
12+
"description": "عنوان فرعي لصفحة المصادقة الرئيسية"
13+
},
614
"authenticationEmailSignInButton": "تسجيل الدخول بالبريد الإلكتروني",
715
"@authenticationEmailSignInButton": {
816
"description": "زر تسجيل الدخول بالبريد الإلكتروني"
917
},
10-
"emailSignInPageTitle": "تسجيل الدخول بالبريد الإلكتروني",
18+
"emailSignInPageTitle": "تسجيل دخول آمن بالبريد الإلكتروني",
1119
"@emailSignInPageTitle": {
1220
"description": "عنوان صفحة تسجيل الدخول بالبريد الإلكتروني"
1321
},
14-
"requestCodePageHeadline": "سجل الدخول أو أنشئ حسابًا",
22+
"requestCodePageHeadline": "تسجيل دخول آمن بالبريد الإلكتروني",
1523
"@requestCodePageHeadline": {
1624
"description": "عنوان صفحة طلب الرمز"
1725
},
18-
"requestCodePageSubheadline": "أدخل بريدك الإلكتروني لتلقي رمز التحقق. لا حاجة لكلمة مرور!",
26+
"requestCodePageSubheadline": "أدخل بريدك الإلكتروني المعتمد لتلقي رمز تسجيل دخول آمن.",
1927
"@requestCodePageSubheadline": {
2028
"description": "عنوان فرعي لصفحة طلب الرمز"
2129
},

lib/l10n/arb/app_en.arb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,27 @@
33
"@helloWorld": {
44
"description": "The conventional newborn programmer greeting"
55
},
6+
"authenticationPageHeadline": "Dashboard Access",
7+
"@authenticationPageHeadline": {
8+
"description": "Headline for the main authentication page"
9+
},
10+
"authenticationPageSubheadline": "Secure sign-in for administrators and publishers.",
11+
"@authenticationPageSubheadline": {
12+
"description": "Subheadline for the main authentication page"
13+
},
614
"authenticationEmailSignInButton": "Sign in with Email",
715
"@authenticationEmailSignInButton": {
816
"description": "Button label for signing in with email"
917
},
10-
"emailSignInPageTitle": "Email Sign In",
18+
"emailSignInPageTitle": "Secure Email Sign-In",
1119
"@emailSignInPageTitle": {
1220
"description": "Title for the email sign-in page"
1321
},
14-
"requestCodePageHeadline": "Sign in or create an account",
22+
"requestCodePageHeadline": "Secure Email Sign-In",
1523
"@requestCodePageHeadline": {
1624
"description": "Headline for the request code page"
1725
},
18-
"requestCodePageSubheadline": "Enter your email to receive a verification code. No password needed!",
26+
"requestCodePageSubheadline": "Enter your authorized email to receive a secure sign-in code.",
1927
"@requestCodePageSubheadline": {
2028
"description": "Subheadline for the request code page"
2129
},

0 commit comments

Comments
 (0)