diff options
author | Stanislas Signoud <signez@stanisoft.net> | 2024-01-09 23:37:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-09 14:37:15 -0800 |
commit | 008893b911c354ea70fbb4ceacefe2dafc7567b9 (patch) | |
tree | 817a76b7a5a3b324db025b0d9c9c2647bde5ce6e /src/view/com/lightbox | |
parent | aeeacd10d322a6e599631c500de03172d69984de (diff) | |
download | voidsky-008893b911c354ea70fbb4ceacefe2dafc7567b9.tar.zst |
Internationalize more strings (#2440)
Co-authored-by: Ansh <anshnanda10@gmail.com>
Diffstat (limited to 'src/view/com/lightbox')
-rw-r--r-- | src/view/com/lightbox/ImageViewing/components/ImageDefaultHeader.tsx | 2 | ||||
-rw-r--r-- | src/view/com/lightbox/Lightbox.tsx | 15 | ||||
-rw-r--r-- | src/view/com/lightbox/Lightbox.web.tsx | 6 |
3 files changed, 15 insertions, 8 deletions
diff --git a/src/view/com/lightbox/ImageViewing/components/ImageDefaultHeader.tsx b/src/view/com/lightbox/ImageViewing/components/ImageDefaultHeader.tsx index c806bc6a6..3401adaff 100644 --- a/src/view/com/lightbox/ImageViewing/components/ImageDefaultHeader.tsx +++ b/src/view/com/lightbox/ImageViewing/components/ImageDefaultHeader.tsx @@ -24,7 +24,7 @@ const ImageDefaultHeader = ({onRequestClose}: Props) => ( hitSlop={HIT_SLOP} accessibilityRole="button" accessibilityLabel={t`Close image`} - accessibilityHint="Closes viewer for header image" + accessibilityHint={t`Closes viewer for header image`} onAccessibilityEscape={onRequestClose}> <Text style={styles.closeText}>✕</Text> </TouchableOpacity> diff --git a/src/view/com/lightbox/Lightbox.tsx b/src/view/com/lightbox/Lightbox.tsx index 8a18df33f..2271bb9fb 100644 --- a/src/view/com/lightbox/Lightbox.tsx +++ b/src/view/com/lightbox/Lightbox.tsx @@ -15,6 +15,8 @@ import { ProfileImageLightbox, ImagesLightbox, } from '#/state/lightbox' +import {Trans, msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' export function Lightbox() { const {activeLightbox} = useLightbox() @@ -53,6 +55,7 @@ export function Lightbox() { } function LightboxFooter({imageIndex}: {imageIndex: number}) { + const {_} = useLingui() const {activeLightbox} = useLightbox() const [isAltExpanded, setAltExpanded] = React.useState(false) const [permissionResponse, requestPermission] = MediaLibrary.usePermissions() @@ -60,12 +63,14 @@ function LightboxFooter({imageIndex}: {imageIndex: number}) { const saveImageToAlbumWithToasts = React.useCallback( async (uri: string) => { if (!permissionResponse || permissionResponse.granted === false) { - Toast.show('Permission to access camera roll is required.') + Toast.show(_(msg`Permission to access camera roll is required.`)) if (permissionResponse?.canAskAgain) { requestPermission() } else { Toast.show( - 'Permission to access camera roll was denied. Please enable it in your system settings.', + _( + msg`Permission to access camera roll was denied. Please enable it in your system settings.`, + ), ) } return @@ -78,7 +83,7 @@ function LightboxFooter({imageIndex}: {imageIndex: number}) { Toast.show(`Failed to save image: ${String(e)}`) } }, - [permissionResponse, requestPermission], + [permissionResponse, requestPermission, _], ) const lightbox = activeLightbox @@ -117,7 +122,7 @@ function LightboxFooter({imageIndex}: {imageIndex: number}) { onPress={() => saveImageToAlbumWithToasts(uri)}> <FontAwesomeIcon icon={['far', 'floppy-disk']} style={s.white} /> <Text type="xl" style={s.white}> - Save + <Trans context="action">Save</Trans> </Text> </Button> <Button @@ -126,7 +131,7 @@ function LightboxFooter({imageIndex}: {imageIndex: number}) { onPress={() => shareImageModal({uri})}> <FontAwesomeIcon icon="arrow-up-from-bracket" style={s.white} /> <Text type="xl" style={s.white}> - Share + <Trans context="action">Share</Trans> </Text> </Button> </View> diff --git a/src/view/com/lightbox/Lightbox.web.tsx b/src/view/com/lightbox/Lightbox.web.tsx index 45e1fa5a3..a258d25ab 100644 --- a/src/view/com/lightbox/Lightbox.web.tsx +++ b/src/view/com/lightbox/Lightbox.web.tsx @@ -110,7 +110,7 @@ function LightboxInner({ onPress={onClose} accessibilityRole="button" accessibilityLabel={_(msg`Close image viewer`)} - accessibilityHint="Exits image view" + accessibilityHint={_(msg`Exits image view`)} onAccessibilityEscape={onClose}> <View style={styles.imageCenterer}> <Image @@ -154,7 +154,9 @@ function LightboxInner({ <View style={styles.footer}> <Pressable accessibilityLabel={_(msg`Expand alt text`)} - accessibilityHint="If alt text is long, toggles alt text expanded state" + accessibilityHint={_( + msg`If alt text is long, toggles alt text expanded state`, + )} onPress={() => { setAltExpanded(!isAltExpanded) }}> |