Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Plural formatting for accessibility `unread items` strings (#7743)

authored by

surfdude29 and committed by
GitHub
3fc4c32a a383b9ba

+34 -9
+7 -2
src/view/shell/Drawer.tsx
··· 1 1 import React, {ComponentProps} from 'react' 2 2 import {Linking, ScrollView, TouchableOpacity, View} from 'react-native' 3 3 import {useSafeAreaInsets} from 'react-native-safe-area-context' 4 - import {msg, Plural, Trans} from '@lingui/macro' 4 + import {msg, Plural, plural, Trans} from '@lingui/macro' 5 5 import {useLingui} from '@lingui/react' 6 6 import {StackActions, useNavigation} from '@react-navigation/native' 7 7 ··· 450 450 accessibilityHint={ 451 451 numUnreadNotifications === '' 452 452 ? '' 453 - : _(msg`${numUnreadNotifications} unread`) 453 + : _( 454 + msg`${plural(numUnreadNotifications ?? 0, { 455 + one: '# unread item', 456 + other: '# unread items', 457 + })}` || '', 458 + ) 454 459 } 455 460 count={numUnreadNotifications} 456 461 bold={isActive}
+13 -3
src/view/shell/bottom-bar/BottomBar.tsx
··· 2 2 import {GestureResponderEvent, View} from 'react-native' 3 3 import Animated from 'react-native-reanimated' 4 4 import {useSafeAreaInsets} from 'react-native-safe-area-context' 5 - import {msg, Trans} from '@lingui/macro' 5 + import {msg, plural, Trans} from '@lingui/macro' 6 6 import {useLingui} from '@lingui/react' 7 7 import {BottomTabBarProps} from '@react-navigation/bottom-tabs' 8 8 import {StackActions} from '@react-navigation/native' ··· 204 204 accessibilityLabel={_(msg`Chat`)} 205 205 accessibilityHint={ 206 206 numUnreadMessages.count > 0 207 - ? _(msg`${numUnreadMessages.numUnread} unread items`) 207 + ? _( 208 + msg`${plural(numUnreadMessages.numUnread ?? 0, { 209 + one: '# unread item', 210 + other: '# unread items', 211 + })}` || '', 212 + ) 208 213 : '' 209 214 } 210 215 /> ··· 231 236 accessibilityHint={ 232 237 numUnreadNotifications === '' 233 238 ? '' 234 - : _(msg`${numUnreadNotifications} unread items`) 239 + : _( 240 + msg`${plural(numUnreadNotifications ?? 0, { 241 + one: '# unread item', 242 + other: '# unread items', 243 + })}` || '', 244 + ) 235 245 } 236 246 /> 237 247 <Btn
+7 -2
src/view/shell/bottom-bar/BottomBarWeb.tsx
··· 1 1 import React from 'react' 2 2 import {View} from 'react-native' 3 3 import Animated from 'react-native-reanimated' 4 - import {msg, Trans} from '@lingui/macro' 4 + import {msg, plural, Trans} from '@lingui/macro' 5 5 import {useLingui} from '@lingui/react' 6 6 import {useNavigationState} from '@react-navigation/native' 7 7 ··· 269 269 {notificationCount ? ( 270 270 <View 271 271 style={styles.notificationCount} 272 - aria-label={_(msg`${notificationCount} unread items`)}> 272 + aria-label={_( 273 + msg`${plural(notificationCount, { 274 + one: '# unread item', 275 + other: '# unread items', 276 + })}`, 277 + )}> 273 278 <Text style={styles.notificationCountLabel}>{notificationCount}</Text> 274 279 </View> 275 280 ) : hasNew ? (
+7 -2
src/view/shell/desktop/LeftNav.tsx
··· 2 2 import {StyleSheet, View} from 'react-native' 3 3 import {AppBskyActorDefs} from '@atproto/api' 4 4 import {FontAwesomeIconStyle} from '@fortawesome/react-native-fontawesome' 5 - import {msg, Trans} from '@lingui/macro' 5 + import {msg, plural, Trans} from '@lingui/macro' 6 6 import {useLingui} from '@lingui/react' 7 7 import { 8 8 useLinkProps, ··· 384 384 {right: -20}, // more breathing room 385 385 ]}> 386 386 <Text 387 - accessibilityLabel={_(msg`${count} unread items`)} 387 + accessibilityLabel={_( 388 + msg`${plural(count, { 389 + one: '# unread item', 390 + other: '# unread items', 391 + })}`, 392 + )} 388 393 accessibilityHint="" 389 394 accessible={true} 390 395 numberOfLines={1}