diff options
author | Eric Bailey <git@esb.lol> | 2024-08-29 19:22:53 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-29 19:22:53 -0500 |
commit | 8651f31ebb7cf9c6a0949503f2c2c5755328ce46 (patch) | |
tree | 04f9c08a3770cee554a6cd421a53dc04957457fb /src/view/com/post-thread/PostThreadItem.tsx | |
parent | d5a76183746bc67f88b858add49c2dba52b99bb5 (diff) | |
download | voidsky-8651f31ebb7cf9c6a0949503f2c2c5755328ce46.tar.zst |
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>
Diffstat (limited to 'src/view/com/post-thread/PostThreadItem.tsx')
-rw-r--r-- | src/view/com/post-thread/PostThreadItem.tsx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index a3cfebbab..3b5ddb1dc 100644 --- a/src/view/com/post-thread/PostThreadItem.tsx +++ b/src/view/com/post-thread/PostThreadItem.tsx @@ -181,7 +181,7 @@ let PostThreadItemLoaded = ({ threadgateRecord?: AppBskyFeedThreadgate.Record }): React.ReactNode => { const pal = usePalette('default') - const {_} = useLingui() + const {_, i18n} = useLingui() const langPrefs = useLanguagePrefs() const {openComposer} = useComposerControls() const [limitLines, setLimitLines] = React.useState( @@ -388,7 +388,7 @@ let PostThreadItemLoaded = ({ type="lg" style={pal.textLight}> <Text type="xl-bold" style={pal.text}> - {formatCount(post.repostCount)} + {formatCount(i18n, post.repostCount)} </Text>{' '} <Plural value={post.repostCount} @@ -410,7 +410,7 @@ let PostThreadItemLoaded = ({ type="lg" style={pal.textLight}> <Text type="xl-bold" style={pal.text}> - {formatCount(post.quoteCount)} + {formatCount(i18n, post.quoteCount)} </Text>{' '} <Plural value={post.quoteCount} @@ -430,7 +430,7 @@ let PostThreadItemLoaded = ({ type="lg" style={pal.textLight}> <Text type="xl-bold" style={pal.text}> - {formatCount(post.likeCount)} + {formatCount(i18n, post.likeCount)} </Text>{' '} <Plural value={post.likeCount} one="like" other="likes" /> </Text> @@ -705,7 +705,7 @@ function ExpandedPostDetails({ translatorUrl: string }) { const pal = usePalette('default') - const {_} = useLingui() + const {_, i18n} = useLingui() const openLink = useOpenLink() const isRootPost = !('reply' in post.record) @@ -723,7 +723,9 @@ function ExpandedPostDetails({ s.mt2, s.mb10, ]}> - <Text style={[a.text_sm, pal.textLight]}>{niceDate(post.indexedAt)}</Text> + <Text style={[a.text_sm, pal.textLight]}> + {niceDate(i18n, post.indexedAt)} + </Text> {isRootPost && ( <WhoCanReply post={post} isThreadAuthor={isThreadAuthor} /> )} |