diff --git a/src/components/Gallery/Gallery.tsx b/src/components/Gallery/Gallery.tsx index 341fe765..560954e3 100644 --- a/src/components/Gallery/Gallery.tsx +++ b/src/components/Gallery/Gallery.tsx @@ -36,6 +36,7 @@ export const Gallery = ({ emptyMessage, }: GalleryProps) => { const isMobile = useMobile(); + const {t} = i18n.useTranslation(); const items = children ? React.Children.map(children, (child) => child.props) : emptyItems; const itemsCount = items.length; @@ -148,7 +149,7 @@ export const Gallery = ({ > {!items.length && ( - {emptyMessage ?? i18n('no-items')} + {emptyMessage ?? t('no-items')} )} {activeItem?.view} diff --git a/src/components/Gallery/components/DesktopGalleryHeader/DesktopGalleryHeader.tsx b/src/components/Gallery/components/DesktopGalleryHeader/DesktopGalleryHeader.tsx index 6269ea7d..4ca88445 100644 --- a/src/components/Gallery/components/DesktopGalleryHeader/DesktopGalleryHeader.tsx +++ b/src/components/Gallery/components/DesktopGalleryHeader/DesktopGalleryHeader.tsx @@ -39,6 +39,7 @@ export const DesktopGalleryHeader = ({ onClose, }: DesktopGalleryHeaderProps) => { const direction = useDirection(); + const {t} = i18n.useTranslation(); return ( - diff --git a/src/components/Gallery/components/FallbackText/FallbackText.tsx b/src/components/Gallery/components/FallbackText/FallbackText.tsx index c6575673..f2431506 100644 --- a/src/components/Gallery/components/FallbackText/FallbackText.tsx +++ b/src/components/Gallery/components/FallbackText/FallbackText.tsx @@ -10,8 +10,12 @@ const cnFallbackText = block('gallery-fallback-text'); export type GalleryFallbackTextProps = React.HTMLAttributes; -export const GalleryFallbackText = ({children, className, ...props}: GalleryFallbackTextProps) => ( -
- {children || i18n('cannot-display-file')} -
-); +export const GalleryFallbackText = ({children, className, ...props}: GalleryFallbackTextProps) => { + const {t} = i18n.useTranslation(); + + return ( +
+ {children || t('cannot-display-file')} +
+ ); +}; diff --git a/src/components/Gallery/components/MobileGalleryHeader/MobileGalleryHeader.tsx b/src/components/Gallery/components/MobileGalleryHeader/MobileGalleryHeader.tsx index 5ca5d817..dc3b3e35 100644 --- a/src/components/Gallery/components/MobileGalleryHeader/MobileGalleryHeader.tsx +++ b/src/components/Gallery/components/MobileGalleryHeader/MobileGalleryHeader.tsx @@ -34,6 +34,8 @@ export const MobileGalleryHeader = ({ hidden, interactive, }: MobileGalleryHeaderProps) => { + const {t} = i18n.useTranslation(); + const [mobileActionsOpen, setMobileActionsOpen] = React.useState(false); const handleMobileActionClose = React.useCallback(() => { @@ -58,7 +60,7 @@ export const MobileGalleryHeader = ({ size="xl" view="flat" onClick={onBackClick} - aria-label={i18n('back')} + aria-label={t('back')} color="primary" > @@ -75,7 +77,7 @@ export const MobileGalleryHeader = ({ size="xl" view="flat" onClick={handleMobileActionClick} - aria-label={i18n('close')} + aria-label={t('close')} color="primary" className={cnGalleryHeaderMobile('button-actions')} > diff --git a/src/components/Gallery/components/actions/FullScreenAction/FullScreenAction.tsx b/src/components/Gallery/components/actions/FullScreenAction/FullScreenAction.tsx index a7d30000..d1761b2e 100644 --- a/src/components/Gallery/components/actions/FullScreenAction/FullScreenAction.tsx +++ b/src/components/Gallery/components/actions/FullScreenAction/FullScreenAction.tsx @@ -13,13 +13,15 @@ export type FullScreenActionProps = { export const FullScreenAction = React.memo( ({fullScreen, onUpdateFullScreen, ...buttonProps}: FullScreenActionProps) => { + const {t} = i18n.useTranslation(); + const handleToggleFullScreen = React.useCallback(() => { onUpdateFullScreen((value) => !value); }, [onUpdateFullScreen]); return (