Skip to content

Commit 910495b

Browse files
committed
chore: update a11y badge text
1 parent f48d5ca commit 910495b

10 files changed

Lines changed: 151 additions & 32 deletions

app/lib/l10n/gen/ouds_flutter_app_localizations.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,18 @@ abstract class AppLocalizations {
13141314
/// **'Last item badge'**
13151315
String get app_components_navigationBar_lastItemBadge_label;
13161316

1317+
/// No description provided for @app_components_navigationBar_badge_count_a11y.
1318+
///
1319+
/// In en, this message translates to:
1320+
/// **'{count, plural, =1 {1 unread notification} other {{count} unread notifications}}'**
1321+
String app_components_navigationBar_badge_count_a11y(int count);
1322+
1323+
/// No description provided for @app_components_navigationBar_badge_dot_a11y.
1324+
///
1325+
/// In en, this message translates to:
1326+
/// **'Unread notification'**
1327+
String get app_components_navigationBar_badge_dot_a11y;
1328+
13171329
/// No description provided for @app_components_topAppBar_label.
13181330
///
13191331
/// In en, this message translates to:

app/lib/l10n/gen/ouds_flutter_app_localizations_ar.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,24 @@ class AppLocalizationsAr extends AppLocalizations {
689689
String get app_components_navigationBar_lastItemBadge_label =>
690690
'Last item badge';
691691

692+
@override
693+
String app_components_navigationBar_badge_count_a11y(int count) {
694+
String _temp0 = intl.Intl.pluralLogic(
695+
count,
696+
locale: localeName,
697+
other: '$count إشعار غير مقروء',
698+
many: '$count إشعارًا غير مقروء',
699+
few: '$count إشعارات غير مقروءة',
700+
two: 'إشعاران غير مقروءين',
701+
one: 'إشعار واحد غير مقروء',
702+
zero: 'لا توجد إشعارات غير مقروءة',
703+
);
704+
return '$_temp0';
705+
}
706+
707+
@override
708+
String get app_components_navigationBar_badge_dot_a11y => 'إشعار غير مقروء';
709+
692710
@override
693711
String get app_components_topAppBar_label => 'Top bar';
694712

app/lib/l10n/gen/ouds_flutter_app_localizations_en.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,21 @@ class AppLocalizationsEn extends AppLocalizations {
689689
String get app_components_navigationBar_lastItemBadge_label =>
690690
'Last item badge';
691691

692+
@override
693+
String app_components_navigationBar_badge_count_a11y(int count) {
694+
String _temp0 = intl.Intl.pluralLogic(
695+
count,
696+
locale: localeName,
697+
other: '$count unread notifications',
698+
one: '1 unread notification',
699+
);
700+
return '$_temp0';
701+
}
702+
703+
@override
704+
String get app_components_navigationBar_badge_dot_a11y =>
705+
'Unread notification';
706+
692707
@override
693708
String get app_components_topAppBar_label => 'Top bar';
694709

app/lib/l10n/gen/ouds_flutter_app_localizations_fr.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,21 @@ class AppLocalizationsFr extends AppLocalizations {
693693
String get app_components_navigationBar_lastItemBadge_label =>
694694
'Last item badge';
695695

696+
@override
697+
String app_components_navigationBar_badge_count_a11y(int count) {
698+
String _temp0 = intl.Intl.pluralLogic(
699+
count,
700+
locale: localeName,
701+
other: '$count notifications non lues',
702+
one: '1 notification non lue',
703+
);
704+
return '$_temp0';
705+
}
706+
707+
@override
708+
String get app_components_navigationBar_badge_dot_a11y =>
709+
'Notification non lue';
710+
696711
@override
697712
String get app_components_topAppBar_label => 'Top bar';
698713

app/lib/l10n/ouds_flutter_ar.arb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,15 @@
125125

126126
"@_components_navigation_bar": {},
127127
"app_components_navigationBar_description_text": "Bottom bars يوفر الوصول إلى الوجهات الرئيسية للتطبيق باستخدام 3 إلى 5 علامات تبويب دائمة. يتم تمثيل كل وجهة بواسطة أيقونة وعلامة نصية اختيارية.",
128+
"app_components_navigationBar_badge_count_a11y": "{count, plural, zero {لا توجد إشعارات غير مقروءة} one {إشعار واحد غير مقروء} two {إشعاران غير مقروءين} few {{count} إشعارات غير مقروءة} many {{count} إشعارًا غير مقروء} other {{count} إشعار غير مقروء}}",
129+
"@app_components_navigationBar_badge_count_a11y": {
130+
"placeholders": {
131+
"count": {
132+
"type": "int"
133+
}
134+
}
135+
},
136+
"app_components_navigationBar_badge_dot_a11y": "إشعار غير مقروء",
128137

129138
"@_components_topAppBar": {},
130139
"app_components_topAppBar_description_text": "Top bar هو مكون موجه من الأعلى يعرض عنوان الشاشة ويوفر الوصول إلى الإجراءات الرئيسية وعناصر التنقل.",

app/lib/l10n/ouds_flutter_en.arb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,15 @@
294294
"app_components_navigationBar_description_text": "The Bottom bar provides access to an app’s primary destinations using 3 to 5 persistent tabs. Each destination is represented by an icon and optionally a text label.",
295295
"app_components_navigationBar_itemCount_label": "Item count",
296296
"app_components_navigationBar_lastItemBadge_label": "Last item badge",
297+
"app_components_navigationBar_badge_count_a11y": "{count, plural, =1 {1 unread notification} other {{count} unread notifications}}",
298+
"@app_components_navigationBar_badge_count_a11y": {
299+
"placeholders": {
300+
"count": {
301+
"type": "int"
302+
}
303+
}
304+
},
305+
"app_components_navigationBar_badge_dot_a11y": "Unread notification",
297306

298307
"@_components_topAppBar": {},
299308
"app_components_topAppBar_label": "Top bar",

app/lib/l10n/ouds_flutter_fr.arb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,15 @@
122122

123123
"@_components_navigation_bar": {},
124124
"app_components_navigationBar_description_text": "Une Bottom bar (ou barre inférieure) permet d'accéder aux principales destinations d'une application grâce à 3 à 5 onglets permanents. Chaque destination est représentée par une icône et, éventuellement, par un libellé textuel.",
125+
"app_components_navigationBar_badge_count_a11y": "{count, plural, =1 {1 notification non lue} other {{count} notifications non lues}}",
126+
"@app_components_navigationBar_badge_count_a11y": {
127+
"placeholders": {
128+
"count": {
129+
"type": "int"
130+
}
131+
}
132+
},
133+
"app_components_navigationBar_badge_dot_a11y": "Notification non lue",
125134

126135
"@_components_topAppBar": {},
127136
"app_components_topAppBar_description_text": "L'app bar (ou barre d'application) est un composant situé en haut de l'ecran qui affiche le titre et donne accès aux actions principales et aux éléments de navigation.",

app/lib/ui/components/components.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ List<Component> components(BuildContext context) {
157157
onDestinationSelected: (index) {},
158158
translucent: true,
159159
destinations: NavigationBarCustomizationUtils.buildItems(
160+
context: context,
160161
themeController: themeController,
161162
),
162163
),

app/lib/ui/components/navigation/navigation_bar_customization_utils.dart

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
* // Software description: Flutter library of reusable graphical components
1111
* //
1212
*/
13+
import 'package:flutter/widgets.dart';
1314
import 'package:ouds_core/components/navigation/ouds_navigation_bar_item.dart';
15+
import 'package:ouds_flutter_demo/l10n/gen/ouds_flutter_app_localizations.dart';
1416
import 'package:ouds_flutter_demo/ui/components/navigation/navigation_bar_customization.dart';
1517
import 'package:ouds_flutter_demo/ui/components/navigation/navigation_bar_enum.dart';
1618
import 'package:ouds_flutter_demo/ui/theme/theme_controller.dart';
@@ -23,39 +25,54 @@ class NavigationBarCustomizationUtils {
2325

2426
/// Returns an optional navigation bar item badge based on the selected badge type
2527
/// (count badge, standard badge, or none).
26-
static OudsNavigationBarItemBadge? getItemBadge(NavigationBarCustomizationState customizationState) {
28+
static OudsNavigationBarItemBadge? getItemBadge(
29+
NavigationBarCustomizationState customizationState,
30+
BuildContext context,
31+
) {
32+
final l10n = AppLocalizations.of(context)!;
33+
2734
return customizationState.selectedItemBadge == ItemBadge.count
28-
? OudsNavigationBarItemBadge(contentDescription: "$itemBadgeCount notification unread", count: itemBadgeCount)
35+
? OudsNavigationBarItemBadge(
36+
contentDescription: l10n
37+
.app_components_navigationBar_badge_count_a11y(itemBadgeCount),
38+
count: itemBadgeCount,
39+
)
2940
: customizationState.selectedItemBadge == ItemBadge.dot
30-
? OudsNavigationBarItemBadge(contentDescription: "notification unread")
31-
: null;
41+
? OudsNavigationBarItemBadge(
42+
contentDescription:
43+
l10n.app_components_navigationBar_badge_dot_a11y,
44+
)
45+
: null;
3246
}
3347

3448
/// Generates a list of consecutive item count values from [minItemCount] to [maxItemCount] (inclusive).
35-
static final itemCountOptions = List<int>.generate(maxItemCount - minItemCount + 1, (index) => minItemCount + index);
49+
static final itemCountOptions = List<int>.generate(
50+
maxItemCount - minItemCount + 1,
51+
(index) => minItemCount + index,
52+
);
3653

3754
/// Builds a shared list of navigation bar items based on the current
3855
/// customization state and theme.
3956
static List<OudsNavigationBarItem> buildItems({
4057
required ThemeController themeController,
58+
required BuildContext context,
4159
NavigationBarCustomizationState? customizationState,
4260
int itemCount = minItemCount,
4361
}) {
4462
final safeItemCount = itemCount.clamp(minItemCount, maxItemCount);
4563

46-
return List.generate(
47-
safeItemCount,
48-
(index) {
49-
final isLastItem = index == safeItemCount - 1;
64+
return List.generate(safeItemCount, (index) {
65+
final isLastItem = index == safeItemCount - 1;
5066

51-
return OudsNavigationBarItem(
52-
icon: AppAssets.icons.functionalSocialAndEngagementHeartEmpty(
53-
themeController,
54-
),
55-
label: 'Label', //'item ${index + 1}',
56-
badge: (isLastItem && customizationState != null) ? getItemBadge(customizationState) : null,
57-
);
58-
},
59-
);
67+
return OudsNavigationBarItem(
68+
icon: AppAssets.icons.functionalSocialAndEngagementHeartEmpty(
69+
themeController,
70+
),
71+
label: 'Label', //'item ${index + 1}',
72+
badge: (isLastItem && customizationState != null)
73+
? getItemBadge(customizationState, context)
74+
: null,
75+
);
76+
});
6077
}
6178
}

app/lib/ui/components/navigation/navigation_bar_demo_screen.dart

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,15 @@ import 'package:provider/provider.dart';
3636
class NavigationBarDemoScreen extends StatefulWidget {
3737
final bool indeterminate;
3838
final String? previousPageTitle;
39-
const NavigationBarDemoScreen({super.key, this.indeterminate = false,this.previousPageTitle}); // Default value set to false
39+
const NavigationBarDemoScreen({
40+
super.key,
41+
this.indeterminate = false,
42+
this.previousPageTitle,
43+
}); // Default value set to false
4044

4145
@override
42-
State<NavigationBarDemoScreen> createState() => _NavigationBarDemoScreenState();
46+
State<NavigationBarDemoScreen> createState() =>
47+
_NavigationBarDemoScreenState();
4348
}
4449

4550
class _NavigationBarDemoScreenState extends State<NavigationBarDemoScreen> {
@@ -56,7 +61,11 @@ class _NavigationBarDemoScreenState extends State<NavigationBarDemoScreen> {
5661
Widget build(BuildContext context) {
5762
return NavigationBarCustomization(
5863
child: Padding(
59-
padding: EdgeInsets.only(bottom: defaultTargetPlatform == TargetPlatform.android ? MediaQuery.of(context).viewPadding.bottom : OudsTheme.of(context).spaceScheme(context).paddingBlockNone),
64+
padding: EdgeInsets.only(
65+
bottom: defaultTargetPlatform == TargetPlatform.android
66+
? MediaQuery.of(context).viewPadding.bottom
67+
: OudsTheme.of(context).spaceScheme(context).paddingBlockNone,
68+
),
6069
child: Scaffold(
6170
bottomSheet: OudsSheetsBottom(
6271
onExpansionChanged: _onExpansionChanged,
@@ -65,9 +74,9 @@ class _NavigationBarDemoScreenState extends State<NavigationBarDemoScreen> {
6574
),
6675
key: _scaffoldKey,
6776
appBar: MainAppBar(
68-
showBackButton: true,
69-
title: context.l10n.app_components_navigationBar_label,
70-
previousPageTitle: widget.previousPageTitle,
77+
showBackButton: true,
78+
title: context.l10n.app_components_navigationBar_label,
79+
previousPageTitle: widget.previousPageTitle,
7180
),
7281
body: SafeArea(
7382
child: ExcludeSemantics(
@@ -89,21 +98,24 @@ class _Body extends StatefulWidget {
8998
class _BodyState extends State<_Body> {
9099
@override
91100
Widget build(BuildContext context) {
92-
ThemeController? themeController = Provider.of<ThemeController>(context, listen: false);
101+
ThemeController? themeController = Provider.of<ThemeController>(
102+
context,
103+
listen: false,
104+
);
93105
return DetailScreenDescription(
94106
description: context.l10n.app_components_navigationBar_description_text,
95107
widget: Column(
96108
children: [
97109
_NavigationBarDemo(),
98-
SizedBox(height: themeController.currentTheme.spaceScheme(context).fixedMedium),
99-
Code(
100-
code: NavigationBarCodeGenerator.updateCode(
101-
context,
102-
),
110+
SizedBox(
111+
height: themeController.currentTheme
112+
.spaceScheme(context)
113+
.fixedMedium,
103114
),
115+
Code(code: NavigationBarCodeGenerator.updateCode(context)),
104116
ReferenceDesignVersionComponent(
105117
version: OudsComponentVersion.navigationBar,
106-
)
118+
),
107119
],
108120
),
109121
);
@@ -135,6 +147,7 @@ class _NavigationBarDemoState extends State<_NavigationBarDemo> {
135147
customizationState = NavigationBarCustomization.of(context);
136148
themeController = Provider.of<ThemeController>(context, listen: true);
137149
final items = NavigationBarCustomizationUtils.buildItems(
150+
context: context,
138151
themeController: themeController!,
139152
customizationState: customizationState!,
140153
itemCount: customizationState!.itemSelected,
@@ -176,7 +189,8 @@ class _CustomizationContentState extends State<_CustomizationContent> {
176189

177190
@override
178191
Widget build(BuildContext context) {
179-
final NavigationBarCustomizationState? customizationState = NavigationBarCustomization.of(context);
192+
final NavigationBarCustomizationState? customizationState =
193+
NavigationBarCustomization.of(context);
180194
var badgeType = customizationState!.itemBadgeState.list;
181195
return CustomizableSection(
182196
children: [

0 commit comments

Comments
 (0)