Localize dates, counts (#5027)

* refactor: consistent localized formatting

* refactor: localized date time

* refactor: localize relative time with strings

* chore: fix typo from copy-paste

* Clean up useTimeAgo

* Remove old ago

* Const

* Reuse

* Prettier

---------

Co-authored-by: Mary <git@mary.my.id>
This commit is contained in:
Eric Bailey
2024-08-29 19:22:53 -05:00
committed by GitHub
parent d5a7618374
commit 8651f31ebb
21 changed files with 375 additions and 186 deletions
+3 -3
View File
@@ -75,7 +75,7 @@ let PostCtrls = ({
threadgateRecord?: AppBskyFeedThreadgate.Record
}): React.ReactNode => {
const t = useTheme()
const {_} = useLingui()
const {_, i18n} = useLingui()
const {openComposer} = useComposerControls()
const {currentAccount} = useSession()
const [queueLike, queueUnlike] = usePostLikeMutationQueue(post, logContext)
@@ -247,7 +247,7 @@ let PostCtrls = ({
big ? a.text_md : {fontSize: 15},
a.user_select_none,
]}>
{formatCount(post.replyCount)}
{formatCount(i18n, post.replyCount)}
</Text>
) : undefined}
</Pressable>
@@ -300,7 +300,7 @@ let PostCtrls = ({
: defaultCtrlColor,
],
]}>
{formatCount(post.likeCount)}
{formatCount(i18n, post.likeCount)}
</Text>
) : undefined}
</Pressable>
@@ -32,7 +32,7 @@ let RepostButton = ({
embeddingDisabled,
}: Props): React.ReactNode => {
const t = useTheme()
const {_} = useLingui()
const {_, i18n} = useLingui()
const requireAuth = useRequireAuth()
const dialogControl = Dialog.useDialogControl()
const playHaptic = useHaptics()
@@ -79,7 +79,7 @@ let RepostButton = ({
big ? a.text_md : {fontSize: 15},
isReposted && a.font_bold,
]}>
{formatCount(repostCount)}
{formatCount(i18n, repostCount)}
</Text>
) : undefined}
</Button>
@@ -128,6 +128,7 @@ const RepostInner = ({
repostCount?: number
big?: boolean
}) => {
const {i18n} = useLingui()
return (
<View style={[a.flex_row, a.align_center, a.gap_xs, {padding: 5}]}>
<Repost style={color} width={big ? 22 : 18} />
@@ -140,7 +141,7 @@ const RepostInner = ({
isReposted && [a.font_bold],
a.user_select_none,
]}>
{formatCount(repostCount)}
{formatCount(i18n, repostCount)}
</Text>
) : undefined}
</View>