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:
surfdude29
2025-04-02 00:09:53 +01:00
committed by GitHub
parent 5130f932ed
commit 758cb731f0
2 changed files with 12 additions and 6 deletions
+6 -3
View File
@@ -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>