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/screens/ProfileList.tsx | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'src/view/screens/ProfileList.tsx') diff --git a/src/view/screens/ProfileList.tsx b/src/view/screens/ProfileList.tsx index a165502b7..0bbb512c1 100644 --- a/src/view/screens/ProfileList.tsx +++ b/src/view/screens/ProfileList.tsx @@ -45,6 +45,8 @@ import {makeProfileLink, makeListLink} from 'lib/routes/links' import {ComposeIcon2} from 'lib/icons' import {ListItems} from 'view/com/lists/ListItems' import {logger} from '#/logger' +import {Trans, msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' import {useSetMinimalShellMode} from '#/state/shell' import {useModalControls} from '#/state/modals' @@ -107,6 +109,7 @@ export const ProfileListScreenInner = observer( listOwnerDid, }: Props & {listOwnerDid: string}) { const store = useStores() + const {_} = useLingui() const setMinimalShellMode = useSetMinimalShellMode() const {rkey} = route.params const feedSectionRef = React.useRef(null) @@ -208,7 +211,7 @@ export const ProfileListScreenInner = observer( /> } accessibilityRole="button" - accessibilityLabel="New post" + accessibilityLabel={_(msg`New post`)} accessibilityHint="" /> @@ -246,7 +249,7 @@ export const ProfileListScreenInner = observer( /> } accessibilityRole="button" - accessibilityLabel="New post" + accessibilityLabel={_(msg`New post`)} accessibilityHint="" /> @@ -270,6 +273,7 @@ const Header = observer(function HeaderImpl({ }) { const pal = usePalette('default') const palInverted = usePalette('inverted') + const {_} = useLingui() const navigation = useNavigation() const {openModal, closeModal} = useModalControls() @@ -526,10 +530,12 @@ const Header = observer(function HeaderImpl({ - Subscribe + + Subscribe + ) @@ -537,7 +543,7 @@ const Header = observer(function HeaderImpl({ @@ -624,6 +630,7 @@ const AboutSection = React.forwardRef( ref, ) { const pal = usePalette('default') + const {_} = useLingui() const {isMobile} = useWebMediaQueries() const scrollElRef = React.useRef(null) @@ -662,7 +669,7 @@ const AboutSection = React.forwardRef( testID="listDescriptionEmpty" type="lg" style={[{fontStyle: 'italic'}, pal.textLight]}> - No description + No description )} @@ -688,12 +695,14 @@ const AboutSection = React.forwardRef( paddingBottom: isMobile ? 14 : 18, }, ]}> - Users + + Users + {isOwner && ( @@ -702,7 +711,9 @@ const AboutSection = React.forwardRef( color={pal.colors.link} size={16} /> - Add + + Add + )} @@ -717,6 +728,7 @@ const AboutSection = React.forwardRef( isCurateList, isOwner, onPressAddUser, + _, ]) const renderEmptyState = useCallback(() => { @@ -757,6 +769,7 @@ const AboutSection = React.forwardRef( function ErrorScreen({error}: {error: string}) { const pal = usePalette('default') const navigation = useNavigation() + const {_} = useLingui() const onPressBack = useCallback(() => { if (navigation.canGoBack()) { navigation.goBack() @@ -778,7 +791,7 @@ function ErrorScreen({error}: {error: string}) { }, ]}> - Could not load list + Could not load list {error} @@ -787,12 +800,12 @@ function ErrorScreen({error}: {error: string}) { -- cgit 1.4.1