Add plural formatting for alt text truncated string (#7994)
* add plural formatting in GifAltText.tsx * add plural formatting in ImageAltTextDialog.tsx * import Plural * format
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import {useState} from 'react'
|
||||
import {TouchableOpacity, View} from 'react-native'
|
||||
import {msg, Trans} from '@lingui/macro'
|
||||
import {msg, Plural, Trans} from '@lingui/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
|
||||
import {HITSLOP_10, MAX_ALT_TEXT} from '#/lib/constants'
|
||||
@@ -177,8 +177,11 @@ function AltTextInner({
|
||||
t.atoms.text_contrast_medium,
|
||||
]}>
|
||||
<Trans>
|
||||
Alt text will be truncated. Limit:{' '}
|
||||
{i18n.number(MAX_ALT_TEXT)} characters.
|
||||
Alt text will be truncated.{' '}
|
||||
<Plural
|
||||
value={MAX_ALT_TEXT}
|
||||
other={`Limit: ${i18n.number(MAX_ALT_TEXT)} characters.`}
|
||||
/>
|
||||
</Trans>
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
import {ImageStyle, useWindowDimensions, View} from 'react-native'
|
||||
import {Image} from 'expo-image'
|
||||
import {msg, Trans} from '@lingui/macro'
|
||||
import {msg, Plural, Trans} from '@lingui/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
|
||||
import {MAX_ALT_TEXT} from '#/lib/constants'
|
||||
@@ -137,8 +137,11 @@ const ImageAltTextInner = ({
|
||||
t.atoms.text_contrast_medium,
|
||||
]}>
|
||||
<Trans>
|
||||
Alt text will be truncated. Limit: {i18n.number(MAX_ALT_TEXT)}{' '}
|
||||
characters.
|
||||
Alt text will be truncated.{' '}
|
||||
<Plural
|
||||
value={MAX_ALT_TEXT}
|
||||
other={`Limit: ${i18n.number(MAX_ALT_TEXT)} characters.`}
|
||||
/>
|
||||
</Trans>
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user