From 4c7850f8c48a0cb3f83f33b1701a99066c6b31db Mon Sep 17 00:00:00 2001 From: Ansh Date: Thu, 9 Nov 2023 10:04:16 -0800 Subject: Internationalization & localization (#1822) * install and setup lingui * setup dynamic locale activation and async loading * first pass of automated replacement of text messages * add some more documentaton * fix nits * add `es` and `hi`locales for testing purposes * make accessibilityLabel localized * compile and extract new messages * fix merge conflicts * fix eslint warning * change instructions from sending email to opening PR * fix comments --- src/view/com/post-thread/PostThread.tsx | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'src/view/com/post-thread/PostThread.tsx') diff --git a/src/view/com/post-thread/PostThread.tsx b/src/view/com/post-thread/PostThread.tsx index 4eb47b0a3..f868c3dca 100644 --- a/src/view/com/post-thread/PostThread.tsx +++ b/src/view/com/post-thread/PostThread.tsx @@ -31,6 +31,8 @@ import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' import {NavigationProp} from 'lib/routes/types' import {sanitizeDisplayName} from 'lib/strings/display-names' import {logger} from '#/logger' +import {Trans, msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' const MAINTAIN_VISIBLE_CONTENT_POSITION = {minIndexForVisible: 2} @@ -79,6 +81,7 @@ export const PostThread = observer(function PostThread({ treeView: boolean }) { const pal = usePalette('default') + const {_} = useLingui() const {isTablet, isDesktop} = useWebMediaQueries() const ref = useRef(null) const hasScrolledIntoView = useRef(false) @@ -197,7 +200,7 @@ export const PostThread = observer(function PostThread({ return ( - Deleted post. + Deleted post. ) @@ -205,7 +208,7 @@ export const PostThread = observer(function PostThread({ return ( - Blocked post. + Blocked post. ) @@ -214,7 +217,7 @@ export const PostThread = observer(function PostThread({ setMaxVisible(n => n + 50)} style={[pal.border, pal.view, styles.itemContainer]} - accessibilityLabel="Load more posts" + accessibilityLabel={_(msg`Load more posts`)} accessibilityHint=""> - Load more posts + Load more posts @@ -275,6 +278,7 @@ export const PostThread = observer(function PostThread({ posts, onRefresh, treeView, + _, ], ) @@ -302,15 +306,15 @@ export const PostThread = observer(function PostThread({ - Post not found + Post not found - The post may have been deleted. + The post may have been deleted. - Back + Back @@ -336,15 +340,18 @@ export const PostThread = observer(function PostThread({ - Post hidden + Post hidden - You have blocked the author or you have been blocked by the author. + + You have blocked the author or you have been blocked by the + author. + - Back + Back -- cgit 1.4.1