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 {useState} from 'react'
|
||||||
import {TouchableOpacity, View} from 'react-native'
|
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 {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {HITSLOP_10, MAX_ALT_TEXT} from '#/lib/constants'
|
import {HITSLOP_10, MAX_ALT_TEXT} from '#/lib/constants'
|
||||||
@@ -177,8 +177,11 @@ function AltTextInner({
|
|||||||
t.atoms.text_contrast_medium,
|
t.atoms.text_contrast_medium,
|
||||||
]}>
|
]}>
|
||||||
<Trans>
|
<Trans>
|
||||||
Alt text will be truncated. Limit:{' '}
|
Alt text will be truncated.{' '}
|
||||||
{i18n.number(MAX_ALT_TEXT)} characters.
|
<Plural
|
||||||
|
value={MAX_ALT_TEXT}
|
||||||
|
other={`Limit: ${i18n.number(MAX_ALT_TEXT)} characters.`}
|
||||||
|
/>
|
||||||
</Trans>
|
</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {ImageStyle, useWindowDimensions, View} from 'react-native'
|
import {ImageStyle, useWindowDimensions, View} from 'react-native'
|
||||||
import {Image} from 'expo-image'
|
import {Image} from 'expo-image'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Plural, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {MAX_ALT_TEXT} from '#/lib/constants'
|
import {MAX_ALT_TEXT} from '#/lib/constants'
|
||||||
@@ -137,8 +137,11 @@ const ImageAltTextInner = ({
|
|||||||
t.atoms.text_contrast_medium,
|
t.atoms.text_contrast_medium,
|
||||||
]}>
|
]}>
|
||||||
<Trans>
|
<Trans>
|
||||||
Alt text will be truncated. Limit: {i18n.number(MAX_ALT_TEXT)}{' '}
|
Alt text will be truncated.{' '}
|
||||||
characters.
|
<Plural
|
||||||
|
value={MAX_ALT_TEXT}
|
||||||
|
other={`Limit: ${i18n.number(MAX_ALT_TEXT)} characters.`}
|
||||||
|
/>
|
||||||
</Trans>
|
</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
Reference in New Issue
Block a user