feat(i18n): add image gallery localization support (#2937)

This commit is contained in:
Konv Suu 2025-03-03 15:36:09 +08:00 committed by GitHub
parent a488ccbf79
commit ea35993754
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 2 deletions

View File

@ -105,6 +105,7 @@
"discover.target.feeds": "Feeds",
"discover.target.label": "Search for",
"discover.target.lists": "Lists",
"entry_actions.image_gallery": "Image Gallery",
"entry_actions.copied_notify": "{{which}} copied to clipboard.",
"entry_actions.copy_link": "Copy Link",
"entry_actions.copy_title": "Copy Title",

View File

@ -105,6 +105,7 @@
"discover.target.feeds": "订阅源",
"discover.target.label": "搜索",
"discover.target.lists": "列表",
"entry_actions.image_gallery": "图片库",
"entry_actions.copied_notify": "{{which}}已复制到剪贴板。",
"entry_actions.copy_link": "复制链接",
"entry_actions.copy_title": "复制标题",

View File

@ -1,5 +1,6 @@
import { ActionButton } from "@follow/components/ui/button/index.js"
import type { MediaModel } from "@follow/models"
import { useTranslation } from "react-i18next"
import { useModalStack } from "~/components/ui/modal/stacked/hooks"
import { filterSmallMedia } from "~/lib/utils"
@ -8,6 +9,7 @@ import { useEntry } from "~/store/entry"
import { ImageGallery } from "./picture-gallery"
export const ImageGalleryAction = ({ id }: { id: string }) => {
const { t } = useTranslation()
const images = useEntry(id, (entry) => entry.entries.media)
const { present } = useModalStack()
const filteredImages = filterSmallMedia(images)
@ -17,14 +19,14 @@ export const ImageGalleryAction = ({ id }: { id: string }) => {
onClick={() => {
window.analytics?.capture("entry_content_header_image_gallery_click")
present({
title: "Image Gallery",
title: t("entry_actions.image_gallery"),
content: () => <ImageGallery images={filteredImages as any as MediaModel[]} />,
max: true,
clickOutsideToDismiss: true,
})
}}
icon={<i className="i-mgc-pic-cute-fi" />}
tooltip={`Image Gallery`}
tooltip={t("entry_actions.image_gallery")}
/>
)
}