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/SelfLabel.tsx | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'src/view/com/modals/SelfLabel.tsx') diff --git a/src/view/com/modals/SelfLabel.tsx b/src/view/com/modals/SelfLabel.tsx index 242b6a38a..f8b64085d 100644 --- a/src/view/com/modals/SelfLabel.tsx +++ b/src/view/com/modals/SelfLabel.tsx @@ -9,6 +9,8 @@ import {isWeb} from 'platform/detection' import {Button} from '../util/forms/Button' import {SelectableBtn} from '../util/forms/SelectableBtn' import {ScrollView} from 'view/com/modals/util' +import {Trans, msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' import {useModalControls} from '#/state/modals' const ADULT_CONTENT_LABELS = ['sexual', 'nudity', 'porn'] @@ -28,6 +30,7 @@ export const Component = observer(function Component({ const {closeModal} = useModalControls() const {isMobile} = useWebMediaQueries() const [selected, setSelected] = useState(labels) + const {_} = useLingui() const toggleAdultLabel = (label: string) => { const hadLabel = selected.includes(label) @@ -51,7 +54,7 @@ export const Component = observer(function Component({ - Add a content warning + Add a content warning @@ -70,7 +73,7 @@ export const Component = observer(function Component({ paddingBottom: 8, }}> - Adult Content + Adult Content {hasAdultSelection ? ( ) : null} @@ -116,23 +119,25 @@ export const Component = observer(function Component({ {selected.includes('sexual') ? ( - <>Pictures meant for adults. + Pictures meant for adults. ) : selected.includes('nudity') ? ( - <>Artistic or non-erotic nudity. + Artistic or non-erotic nudity. ) : selected.includes('porn') ? ( - <>Sexual activity or erotic nudity. + Sexual activity or erotic nudity. ) : ( - <>If none are selected, suitable for all ages. + If none are selected, suitable for all ages. )} ) : ( - - Not Applicable + + Not Applicable. - . This warning is only available for posts with media attached. + + This warning is only available for posts with media attached. + )} @@ -147,9 +152,11 @@ export const Component = observer(function Component({ }} style={styles.btn} accessibilityRole="button" - accessibilityLabel="Confirm" + accessibilityLabel={_(msg`Confirm`)} accessibilityHint=""> - Done + + Done + -- cgit 1.4.1