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/modals/AddAppPasswords.tsx | 41 ++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'src/view/com/modals/AddAppPasswords.tsx') diff --git a/src/view/com/modals/AddAppPasswords.tsx b/src/view/com/modals/AddAppPasswords.tsx index 621c61b90..095ad48bd 100644 --- a/src/view/com/modals/AddAppPasswords.tsx +++ b/src/view/com/modals/AddAppPasswords.tsx @@ -13,6 +13,8 @@ import { import Clipboard from '@react-native-clipboard/clipboard' import * as Toast from '../util/Toast' import {logger} from '#/logger' +import {Trans, msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' import {useModalControls} from '#/state/modals' export const snapPoints = ['70%'] @@ -55,6 +57,7 @@ const shadesOfBlue: string[] = [ export function Component({}: {}) { const pal = usePalette('default') const store = useStores() + const {_} = useLingui() const {closeModal} = useModalControls() const [name, setName] = useState( shadesOfBlue[Math.floor(Math.random() * shadesOfBlue.length)], @@ -121,15 +124,19 @@ export function Component({}: {}) { {!appPassword ? ( - Please enter a unique name for this App Password or use our randomly - generated one. + + Please enter a unique name for this App Password or use our + randomly generated one. + ) : ( - - Here is your app password. - {' '} - Use this to sign into the other app along with your handle. + + Here is your app password. + + + Use this to sign into the other app along with your handle. + )} {!appPassword ? ( @@ -154,7 +161,7 @@ export function Component({}: {}) { returnKeyType="done" onEndEditing={createAppPassword} accessible={true} - accessibilityLabel="Name" + accessibilityLabel={_(msg`Name`)} accessibilityHint="Input name for app password" /> @@ -163,13 +170,15 @@ export function Component({}: {}) { style={[pal.border, styles.passwordContainer, pal.btn]} onPress={onCopy} accessibilityRole="button" - accessibilityLabel="Copy" + accessibilityLabel={_(msg`Copy`)} accessibilityHint="Copies app password"> {appPassword} {wasCopied ? ( - Copied + + Copied + ) : ( {appPassword ? ( - For security reasons, you won't be able to view this again. If you - lose this password, you'll need to generate a new one. + + For security reasons, you won't be able to view this again. If you + lose this password, you'll need to generate a new one. + ) : ( - Can only contain letters, numbers, spaces, dashes, and underscores. - Must be at least 4 characters long, but no more than 32 characters - long. + + Can only contain letters, numbers, spaces, dashes, and underscores. + Must be at least 4 characters long, but no more than 32 characters + long. + )} -- cgit 1.4.1