diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/LabelingServiceCard/index.tsx | 7 | ||||
-rw-r--r-- | src/components/ProfileHoverCard/index.web.tsx | 16 | ||||
-rw-r--r-- | src/components/moderation/LabelsOnMe.tsx | 18 |
3 files changed, 26 insertions, 15 deletions
diff --git a/src/components/LabelingServiceCard/index.tsx b/src/components/LabelingServiceCard/index.tsx index f924f0f59..2bb7ed59c 100644 --- a/src/components/LabelingServiceCard/index.tsx +++ b/src/components/LabelingServiceCard/index.tsx @@ -1,6 +1,6 @@ import React from 'react' import {View} from 'react-native' -import {msg, Trans} from '@lingui/macro' +import {msg, Plural, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {AppBskyLabelerDefs} from '@atproto/api' @@ -13,7 +13,6 @@ import {RichText} from '#/components/RichText' import {ChevronRight_Stroke2_Corner0_Rounded as ChevronRight} from '../icons/Chevron' import {UserAvatar} from '#/view/com/util/UserAvatar' import {sanitizeHandle} from '#/lib/strings/handles' -import {pluralize} from '#/lib/strings/helpers' type LabelingServiceProps = { labeler: AppBskyLabelerDefs.LabelerViewDetailed @@ -69,9 +68,7 @@ export function LikeCount({count}: {count: number}) { t.atoms.text_contrast_medium, {fontWeight: '500'}, ]}> - <Trans> - Liked by {count} {pluralize(count, 'user')} - </Trans> + <Plural value={count} one="Liked by # user" other="Liked by # users" /> </Text> ) } diff --git a/src/components/ProfileHoverCard/index.web.tsx b/src/components/ProfileHoverCard/index.web.tsx index a22436879..305327d8b 100644 --- a/src/components/ProfileHoverCard/index.web.tsx +++ b/src/components/ProfileHoverCard/index.web.tsx @@ -2,13 +2,12 @@ import React from 'react' import {View} from 'react-native' import {AppBskyActorDefs, moderateProfile, ModerationOpts} from '@atproto/api' import {flip, offset, shift, size, useFloating} from '@floating-ui/react-dom' -import {msg, Trans} from '@lingui/macro' +import {msg, plural, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {makeProfileLink} from '#/lib/routes/links' import {sanitizeDisplayName} from '#/lib/strings/display-names' import {sanitizeHandle} from '#/lib/strings/handles' -import {pluralize} from '#/lib/strings/helpers' import {useModerationOpts} from '#/state/preferences/moderation-opts' import {usePrefetchProfileQuery, useProfileQuery} from '#/state/queries/profile' import {useSession} from '#/state/session' @@ -371,7 +370,14 @@ function Inner({ const blockHide = profile.viewer?.blocking || profile.viewer?.blockedBy const following = formatCount(profile.followsCount || 0) const followers = formatCount(profile.followersCount || 0) - const pluralizedFollowers = pluralize(profile.followersCount || 0, 'follower') + const pluralizedFollowers = plural(profile.followersCount || 0, { + one: 'follower', + other: 'followers', + }) + const pluralizedFollowings = plural(profile.followsCount || 0, { + one: 'following', + other: 'following', + }) const profileURL = makeProfileLink({ did: profile.did, handle: profile.handle, @@ -448,7 +454,9 @@ function Inner({ onPress={hide}> <Trans> <Text style={[a.text_md, a.font_bold]}>{following} </Text> - <Text style={[t.atoms.text_contrast_medium]}>following</Text> + <Text style={[t.atoms.text_contrast_medium]}> + {pluralizedFollowings} + </Text> </Trans> </InlineLinkText> </View> diff --git a/src/components/moderation/LabelsOnMe.tsx b/src/components/moderation/LabelsOnMe.tsx index 099769fa7..46825d761 100644 --- a/src/components/moderation/LabelsOnMe.tsx +++ b/src/components/moderation/LabelsOnMe.tsx @@ -1,7 +1,7 @@ import React from 'react' import {StyleProp, View, ViewStyle} from 'react-native' import {AppBskyFeedDefs, ComAtprotoLabelDefs} from '@atproto/api' -import {msg, Trans} from '@lingui/macro' +import {msg, Plural} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useSession} from '#/state/session' @@ -39,7 +39,6 @@ export function LabelsOnMe({ return null } - const labelTarget = isAccount ? _(msg`account`) : _(msg`content`) return ( <View style={[a.flex_row, style]}> <LabelsOnMeDialog control={control} subject={details} labels={labels} /> @@ -54,11 +53,18 @@ export function LabelsOnMe({ }}> <ButtonIcon position="left" icon={CircleInfo} /> <ButtonText style={[a.leading_snug]}> - {labels.length}{' '} - {labels.length === 1 ? ( - <Trans>label has been placed on this {labelTarget}</Trans> + {isAccount ? ( + <Plural + value={labels.length} + one="# label has been placed on this account" + other="# labels has been placed on this account" + /> ) : ( - <Trans>labels have been placed on this {labelTarget}</Trans> + <Plural + value={labels.length} + one="# label has been placed on this content" + other="# labels has been placed on this content" + /> )} </ButtonText> </Button> |