Use new lingui syntax

This commit is contained in:
Eric Bailey
2026-07-02 15:04:31 -05:00
parent 6bbf5ad915
commit c9ac6695c0
+14 -21
View File
@@ -1,9 +1,7 @@
import {useCallback, useEffect} from 'react' import {useCallback, useEffect} from 'react'
import {ScrollView, View} from 'react-native' import {ScrollView, View} from 'react-native'
import {useSafeAreaInsets} from 'react-native-safe-area-context' import {useSafeAreaInsets} from 'react-native-safe-area-context'
import {msg} from '@lingui/core/macro' import {Trans, useLingui} from '@lingui/react/macro'
import {useLingui} from '@lingui/react'
import {Trans} from '@lingui/react/macro'
import {dateDiff, useGetTimeAgo} from '#/lib/hooks/useTimeAgo' import {dateDiff, useGetTimeAgo} from '#/lib/hooks/useTimeAgo'
import {useIsBirthdateUpdateAllowed} from '#/state/birthdate' import {useIsBirthdateUpdateAllowed} from '#/state/birthdate'
@@ -46,7 +44,7 @@ const textStyles = [a.text_md, a.leading_snug]
export function NoAccessScreen() { export function NoAccessScreen() {
const t = useTheme() const t = useTheme()
const {_, i18n} = useLingui() const {t: l, i18n} = useLingui()
const ax = useAnalytics() const ax = useAnalytics()
const {gtPhone} = useBreakpoints() const {gtPhone} = useBreakpoints()
const insets = useSafeAreaInsets() const insets = useSafeAreaInsets()
@@ -117,7 +115,7 @@ export function NoAccessScreen() {
<Trans> <Trans>
If you believe your birthdate is incorrect, you can update it by{' '} If you believe your birthdate is incorrect, you can update it by{' '}
<SimpleInlineLinkText <SimpleInlineLinkText
label={_(msg`Click here to update your birthdate`)} label={l`Click here to update your birthdate`}
style={[textStyles]} style={[textStyles]}
{...createStaticClick(() => { {...createStaticClick(() => {
ax.metric('ageAssurance:noAccessScreen:openBirthdateDialog', {}) ax.metric('ageAssurance:noAccessScreen:openBirthdateDialog', {})
@@ -206,7 +204,7 @@ export function NoAccessScreen() {
<> <>
{' '} {' '}
<SimpleInlineLinkText <SimpleInlineLinkText
label={_(msg`Update your location`)} label={l`Update your location`}
{...createStaticClick(() => { {...createStaticClick(() => {
locationControl.open() locationControl.open()
})} })}
@@ -225,20 +223,15 @@ export function NoAccessScreen() {
if (access !== aa.Access.Full) { if (access !== aa.Access.Full) {
props.disableDialogAction() props.disableDialogAction()
props.setDialogError( props.setDialogError(
_( l`We're sorry, but based on your device's location, you are currently located in a region that requires age assurance.`,
msg`We're sorry, but based on your device's location, you are currently located in a region that requires age assurance.`,
),
) )
} else { } else {
props.closeDialog(() => { props.closeDialog(() => {
// set this after close! // set this after close!
setDeviceGeolocation(props.geolocation) setDeviceGeolocation(props.geolocation)
Toast.show( Toast.show(l`Thanks! You're all set.`, {
_(msg`Thanks! You're all set.`), type: 'success',
{ })
type: 'success',
},
)
}) })
} }
}} }}
@@ -297,7 +290,7 @@ export function NoAccessScreen() {
<Button <Button
color="primary" color="primary"
size="large" size="large"
label={_(msg`Click here to update your birthdate`)} label={l`Click here to update your birthdate`}
onPress={() => birthdateControl.open()}> onPress={() => birthdateControl.open()}>
<ButtonText> <ButtonText>
<Trans>Add your birthdate</Trans> <Trans>Add your birthdate</Trans>
@@ -321,7 +314,7 @@ export function NoAccessScreen() {
<Trans> <Trans>
To log out,{' '} To log out,{' '}
<SimpleInlineLinkText <SimpleInlineLinkText
label={_(msg`Click here to log out`)} label={l`Click here to log out`}
{...createStaticClick(() => { {...createStaticClick(() => {
onPressLogout() onPressLogout()
})} })}
@@ -330,7 +323,7 @@ export function NoAccessScreen() {
</SimpleInlineLinkText> </SimpleInlineLinkText>
. Or if youd prefer, you can{' '} . Or if youd prefer, you can{' '}
<SimpleInlineLinkText <SimpleInlineLinkText
label={_(msg`Click here to delete your account`)} label={l`Click here to delete your account`}
{...createStaticClick(() => { {...createStaticClick(() => {
ax.metric( ax.metric(
'ageAssurance:noAccessScreen:openDeleteAccountDialog', 'ageAssurance:noAccessScreen:openDeleteAccountDialog',
@@ -369,7 +362,7 @@ export function NoAccessScreen() {
function AccessSection() { function AccessSection() {
const t = useTheme() const t = useTheme()
const {_, i18n} = useLingui() const {t: l, i18n} = useLingui()
const ax = useAnalytics() const ax = useAnalytics()
const control = useDialogControl() const control = useDialogControl()
const appealControl = Dialog.useDialogControl() const appealControl = Dialog.useDialogControl()
@@ -407,7 +400,7 @@ function AccessSection() {
You are currently unable to access Bluesky's Age Assurance flow. You are currently unable to access Bluesky's Age Assurance flow.
Please{' '} Please{' '}
<SimpleInlineLinkText <SimpleInlineLinkText
label={_(msg`Contact our moderation team`)} label={l`Contact our moderation team`}
{...createStaticClick(() => { {...createStaticClick(() => {
appealControl.open() appealControl.open()
ax.metric('ageAssurance:appealDialogOpen', {}) ax.metric('ageAssurance:appealDialogOpen', {})
@@ -442,7 +435,7 @@ function AccessSection() {
device, and will therefore only work on this device. device, and will therefore only work on this device.
Alternatively,{' '} Alternatively,{' '}
<SimpleInlineLinkText <SimpleInlineLinkText
label={_(msg`Verify now using KWS`)} label={l`Verify now using KWS`}
{...createStaticClick(() => { {...createStaticClick(() => {
openInitDialog() openInitDialog()
})}> })}>