Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tooltip content of open image and improve i18n support #689

Merged
merged 4 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/renderer/src/components/ui/media/preview-media.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { MediaModel } from "@follow/shared/hono"
import type { FC } from "react"
import { Fragment, useCallback, useEffect, useRef, useState } from "react"
import { Blurhash } from "react-blurhash"
import { useTranslation } from "react-i18next"
import { Keyboard, Mousewheel } from "swiper/modules"
import type { SwiperRef } from "swiper/react"
import { Swiper, SwiperSlide } from "swiper/react"
Expand All @@ -25,6 +26,7 @@ const Wrapper: Component<{
entryId?: string
}> = ({ children, src, showActions, entryId }) => {
const { dismiss } = useCurrentModal()
const { t } = useTranslation("shortcuts")

return (
<div className="center relative size-full px-20 pb-8 pt-10" onClick={dismiss}>
Expand Down Expand Up @@ -59,7 +61,7 @@ const Wrapper: Component<{
</ActionButton>
)}
<ActionButton
tooltip={COPY_MAP.OpenInBrowser()}
tooltip={t(COPY_MAP.OpenInBrowser())}
onClick={() => {
window.open(src)
}}
Expand Down
3 changes: 2 additions & 1 deletion apps/renderer/src/modules/ai/ai-daily/daily.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ export const DailyReportModalContent: Component<DailyReportContentProps> = ({
}) => {
const content = useQueryData({ endDate, startDate, view })
const RelatedEntryLink = useState(() => createRelatedEntryLink("toast"))[0]
const { t } = useTranslation()
return (
<div className="center flex-col">
{content.isLoading ? (
Expand All @@ -203,7 +204,7 @@ export const DailyReportModalContent: Component<DailyReportContentProps> = ({
) : (
<div className="center pointer-events-none absolute inset-0 translate-y-6 flex-col gap-4 opacity-80">
<EmptyIcon />
<p>No AI news found for this period.</p>
<p>{t("ai_daily.no_found")}</p>
</div>
)}

Expand Down
3 changes: 2 additions & 1 deletion apps/renderer/src/modules/ai/ai-daily/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ export const useParseDailyDate = (day: DayOf) => {

export const useAIDailyReportModal = () => {
const { present } = useModalStack()
const { t } = useTranslation()

return useCallback(() => {
present({
content: () => <FeedDailyModalContent />,
title: "AI Daily Report",
title: t("ai_daily.header"),
resizeable: true,
clickOutsideToDismiss: true,

Expand Down
5 changes: 3 additions & 2 deletions apps/renderer/src/modules/wallet/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createElement, useCallback } from "react"
import { useTranslation } from "react-i18next"
import { toast } from "sonner"

import { useModalStack } from "~/components/ui/modal/stacked/hooks"
Expand All @@ -15,7 +16,7 @@ export const useTipModal = ({
entryId?: string
}) => {
const { present } = useModalStack()

const { t } = useTranslation()
return useCallback(() => {
if (!feedId || !entryId) {
// this should not happen unless there is a bug in the code
Expand All @@ -24,7 +25,7 @@ export const useTipModal = ({
}
window.posthog?.capture("tip_modal_opened", { entryId })
present({
title: "Tip Power",
title: t("tip_modal.tip_title"),
content: () => createElement(TipModalContent, { userId, feedId, entryId }),
})
}, [present, userId, feedId, entryId])
Expand Down
3 changes: 3 additions & 0 deletions locales/app/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"achievement.first_claim_feed": "Feed Owner",
"achievement.first_claim_feed_description": "You own your feed on Follow",
"achievement.mint_more_power": "Be a hardcore player and earn more <power />",
"ai_daily.header": "AI Daily Report",
"ai_daily.no_found": "No AI news found for this period.",
"ai_daily.title": "Top News - {{title}}",
"ai_daily.tooltip.content": "Here is news selected by AI from your timeline (<From /> - <To />) that may be important to you.",
"ai_daily.tooltip.update_schedule": "Update daily at 8 AM and 8 PM.",
Expand Down Expand Up @@ -205,6 +207,7 @@
"tip_modal.tip_now": "Tip Now",
"tip_modal.tip_sent": "Tip sent successfully! Thank you for your support.",
"tip_modal.tip_support": "⭐ Tip to show your support!",
"tip_modal.tip_title": "Tip Power",
"tip_modal.unclaimed_feed": "No one has claimed this feed yet. The received Power will be securely held in the blockchain contract until it is claimed.",
"user_button.account": "Account",
"user_button.achievement": "Achievements",
Expand Down
3 changes: 3 additions & 0 deletions locales/app/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"achievement.first_claim_feed": "订阅源所有者",
"achievement.first_claim_feed_description": "在 Follow 上认证订阅源",
"achievement.mint_more_power": "成为硬核玩家,赚取更多 <power />",
"ai_daily.header": "AI 日报",
"ai_daily.no_found": "该期间未找到AI新闻",
"ai_daily.title": "热点 - {{title}}",
"ai_daily.tooltip.content": "AI 根据时间线(<From /> - <To />)提取的重点信息",
"ai_daily.tooltip.update_schedule": "每天 8:00 和 20:00 定时更新",
Expand Down Expand Up @@ -205,6 +207,7 @@
"tip_modal.tip_now": "立即打赏",
"tip_modal.tip_sent": "成功打赏!感谢支持",
"tip_modal.tip_support": "⭐ 打赏表示支持!",
"tip_modal.tip_title": "打赏 Power",
"tip_modal.unclaimed_feed": "这个订阅源还没有被认证,收到的 Power 将存放在区块链直到源所有者完成认证",
"user_button.account": "账号",
"user_button.achievement": "成就",
Expand Down
4 changes: 4 additions & 0 deletions locales/app/zh-HK.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"achievement.first_claim_feed": "Feed 擁有者",
"achievement.first_claim_feed_description": "你在 Follow 上擁有你的 Feed",
"achievement.mint_more_power": "成為資深玩家,賺取更多 <power />",
"ai_daily.header": "AI 日報",
"ai_daily.no_found": "該期間未找到AI新聞",
"ai_daily.title": "頭條新聞 - {{title}}",
"ai_daily.tooltip.content": "以下是由 AI 從你的時間線中選出的新聞(<From /> - <To />),可能對你很重要。",
"ai_daily.tooltip.update_schedule": "每天上午 8 點和下午 8 點更新。",
Expand Down Expand Up @@ -182,6 +184,7 @@
"sidebar.feed_actions.open_site_in_browser": "在瀏覽器中打開網站",
"sidebar.feed_actions.unfollow": "取消關注",
"sidebar.feed_actions.unfollow_feed": "取消關注訂閱源",
"sidebar.feed_column.context_menu.add_feeds_to_list": "添加訂閱源到清單",
"sidebar.feed_column.context_menu.change_to_other_view": "切換到其他視圖",
"sidebar.feed_column.context_menu.delete_category": "刪除分類",
"sidebar.feed_column.context_menu.delete_category_confirmation": "確定刪除分類 {{folderName}}?",
Expand All @@ -204,6 +207,7 @@
"tip_modal.tip_now": "立刻贊助",
"tip_modal.tip_sent": "贊助成功!感謝你的支持。",
"tip_modal.tip_support": "⭐ 贊助以顯示你的支持!",
"tip_modal.tip_title": "贊助 Power",
"tip_modal.unclaimed_feed": "目前尚未有人認領此訂閱源。收到的 Power 將安全地保留在區塊鏈合約中,直到被認領為止。",
"user_button.account": "帳戶",
"user_button.achievement": "成就",
Expand Down
7 changes: 7 additions & 0 deletions locales/app/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"achievement.first_claim_feed": "訂閱源所有者",
"achievement.first_claim_feed_description": "在 Follow 上認證訂閱源",
"achievement.mint_more_power": "成為核心玩家,賺取更多 <power />",
"ai_daily.header": "AI 日報",
"ai_daily.no_found": "該期間未找到AI新聞",
"ai_daily.title": "頭條新聞 - {{title}}",
"ai_daily.tooltip.content": "以下是 AI 從您的時間軸中選擇的新聞(<From /> - <To />),可能對您很重要。",
"ai_daily.tooltip.update_schedule": "每天早上 8 點和晚上 8 點更新。",
Expand Down Expand Up @@ -171,15 +173,18 @@
"sidebar.feed_actions.copy_list_url": "複製列表連結",
"sidebar.feed_actions.edit": "編輯",
"sidebar.feed_actions.edit_feed": "編輯摘要",
"sidebar.feed_actions.edit_list": "編輯列表",
"sidebar.feed_actions.feed_owned_by_you": "此摘要由你所擁有",
"sidebar.feed_actions.list_owned_by_you": "該列表歸你所有",
"sidebar.feed_actions.mark_all_as_read": "全部標記為已讀",
"sidebar.feed_actions.navigate_to_feed": "導航到摘要",
"sidebar.feed_actions.navigate_to_list": "導航到列表",
"sidebar.feed_actions.open_feed_in_browser": "使用瀏覽器打開這個摘要",
"sidebar.feed_actions.open_list_in_browser": "在瀏覽器開啟列表",
"sidebar.feed_actions.open_site_in_browser": "使用瀏覽器打開這個網站",
"sidebar.feed_actions.unfollow": "取消關注",
"sidebar.feed_actions.unfollow_feed": "取消關注摘要",
"sidebar.feed_column.context_menu.add_feeds_to_list": "添加摘要到列表",
"sidebar.feed_column.context_menu.change_to_other_view": "切換到其他視圖",
"sidebar.feed_column.context_menu.delete_category": "刪除類別",
"sidebar.feed_column.context_menu.delete_category_confirmation": "刪除類別 {{folderName}}?",
Expand All @@ -202,6 +207,7 @@
"tip_modal.tip_now": "立刻贊助",
"tip_modal.tip_sent": "贊助成功!謝謝您的支持",
"tip_modal.tip_support": "⭐ 贊助以表示你的支持!",
"tip_modal.tip_title": "贊助 Power",
"tip_modal.unclaimed_feed": "目前尚無人認領此摘要。收到的 Power 將安全地保存在區塊鏈合約中,直到被認領為止。",
"user_button.account": "帳戶",
"user_button.achievement": "成就",
Expand All @@ -227,6 +233,7 @@
"words.lists": "列表",
"words.load_archived_entries": "載入已封存項目",
"words.login": "登入",
"words.mint": "Mint",
"words.power": "Power",
"words.rss": "RSS",
"words.rss3": "RSS3",
Expand Down
1 change: 1 addition & 0 deletions locales/common/zh-HK.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"time.yesterday": "昨天",
"tips.load-lng-error": "語言包載入失敗",
"words.actions": "操作",
"words.ago": "前",
"words.back": "返回",
"words.copy": "複製",
"words.create": "創建",
Expand Down
6 changes: 6 additions & 0 deletions locales/common/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,25 @@
"time.today": "今天",
"time.yesterday": "昨天",
"tips.load-lng-error": "語言包載入失敗",
"words.actions": "操作",
"words.ago": "前",
"words.back": "返回",
"words.copy": "複製",
"words.create": "創建",
"words.edit": "編輯",
"words.entry": "條目",
"words.id": "識別碼",
"words.items_one": "項目",
"words.items_other": "多個項目",
"words.local": "本地",
"words.manage": "管理",
"words.record": "記錄",
"words.record_one": "記錄",
"words.record_other": "多筆記錄",
"words.result": "結果",
"words.result_one": "結果",
"words.result_other": "多筆結果",
"words.submit": "提交",
"words.update": "更新",
"words.which.all": "全部"
}
15 changes: 15 additions & 0 deletions locales/native/zh-TW.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
{
"contextMenu.copy": "複製",
"contextMenu.copyImage": "複製圖片",
"contextMenu.copyImageAddress": "複製圖片網址",
"contextMenu.copyLink": "複製連結",
"contextMenu.copyVideoAddress": "複製影片網址",
"contextMenu.cut": "剪下",
"contextMenu.inspect": "檢查元素",
"contextMenu.learnSpelling": "學習拼寫",
"contextMenu.lookUpSelection": "查找選擇",
"contextMenu.openImageInBrowser": "在瀏覽器中開啟圖片",
"contextMenu.openLinkInBrowser": "在瀏覽器中開啟連結",
"contextMenu.paste": "貼上",
"contextMenu.saveImage": "儲存圖片",
"contextMenu.saveImageAs": "圖片另存新檔...",
"contextMenu.saveLinkAs": "連結另存新檔...",
"contextMenu.saveVideo": "儲存影片",
"contextMenu.saveVideoAs": "影片另存新檔...",
"contextMenu.searchWithGoogle": "使用 Google 搜尋",
"contextMenu.selectAll": "全選",
"contextMenu.services": "服務",
"dialog.clearAllData": "您確定要清除所有資料嗎?",
"dialog.no": "否",
"dialog.yes": "是",
"menu.about": "關於 {{name}}",
"menu.actualSize": "實際大小",
"menu.bringAllToFront": "將所有視窗移至最上層",
"menu.checkForUpdates": "檢查更新",
"menu.clearAllData": "清除所有資料",
"menu.close": "關閉",
"menu.copy": "複製",
"menu.cut": "剪下",
Expand Down
2 changes: 2 additions & 0 deletions locales/settings/zh-HK.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"lists.created.error": "建立清單失敗。",
"lists.created.success": "成功建立清單!",
"lists.description": "描述",
"lists.earnings": "收益",
"lists.edit.error": "編輯清單失敗。",
"lists.edit.label": "編輯",
"lists.edit.success": "成功編輯清單!",
Expand All @@ -177,6 +178,7 @@
"lists.info": "清單是你可以分享或出售給其他人訂閱的資訊源集合。訂閱者將同步並存取清單中的所有資訊源。",
"lists.noLists": "沒有清單",
"lists.submit": "提交",
"lists.subscriptions": "訂閱",
"lists.title": "標題",
"lists.view": "查看",
"profile.avatar.label": "頭像",
Expand Down
37 changes: 36 additions & 1 deletion locales/settings/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
"appearance.title": "外觀",
"appearance.ui_font": "介面字體",
"appearance.unread_count": "未讀計數",
"appearance.use_pointer_cursor.description": "將游標變更為指標,當滑鼠懸停在任何互動元素上時。",
"appearance.use_pointer_cursor.label": "使用指標游標",
"common.give_star": "<HeartIcon />喜歡我們的產品嗎? <Link>在 GitHub 上給我們 star 吧!</Link>",
"feeds.claimTips": "要認領您的 feed 並接收贊助,請在您的訂閱列表中右鍵點擊該 feed,然後選擇「認領」。",
"feeds.noFeeds": "無認領的 feed",
Expand All @@ -93,7 +95,10 @@
"general.mark_as_read.render.label": "顯示時標記為已讀",
"general.mark_as_read.scroll.description": "當條目捲動離開視圖時自動標記為已讀。",
"general.mark_as_read.scroll.label": "捲動時標記為已讀",
"general.network": "網路",
"general.privacy_data": "隱私與數據",
"general.proxy.description": "設定代理伺服器代理網絡流量,例如:socks://proxy.example.com:1080",
"general.proxy.label": "代理伺服器",
"general.rebuild_database.button": "重建",
"general.rebuild_database.description": "如果您遇到渲染問題,重建資料庫可能可以解決。",
"general.rebuild_database.label": "重建資料庫",
Expand Down Expand Up @@ -147,7 +152,36 @@
"invitation.tableHeaders.creationTime": "建立時間",
"invitation.tableHeaders.usedBy": "使用者",
"invitation.title": "邀請碼",
"profile.avatar.label": "大頭貼",
"lists.create": "建立新列表",
"lists.created.error": "建立列表失敗。",
"lists.created.success": "列表建立成功!",
"lists.description": "描述",
"lists.earnings": "收益",
"lists.edit.error": "編輯列表失敗。",
"lists.edit.label": "編輯",
"lists.edit.success": "列表編輯成功!",
"lists.fee.description": "其他人訂閱此列表需要支付的費用。",
"lists.fee.label": "費用",
"lists.feeds.actions": "操作",
"lists.feeds.add.error": "將訂閱源添加到列表失敗。",
"lists.feeds.add.label": "添加",
"lists.feeds.add.success": "訂閱源已添加到列表。",
"lists.feeds.delete.error": "從列表中移除訂閱源失敗。",
"lists.feeds.delete.success": "訂閱源已從列表中移除。",
"lists.feeds.id": "訂閱源 ID",
"lists.feeds.label": "訂閱源",
"lists.feeds.manage": "管理訂閱源",
"lists.feeds.owner": "擁有者",
"lists.feeds.search": "搜尋訂閱源",
"lists.feeds.title": "標題",
"lists.image": "圖片",
"lists.info": "列表是您可以分享或出售給他人訂閱的訂閱源集合。訂閱者將同步並訪問列表中的所有訂閱源。",
"lists.noLists": "沒有列表",
"lists.submit": "送出",
"lists.subscriptions": "訂閱",
"lists.title": "標題",
"lists.view": "查看",
"profile.avatar.label": "頭像",
"profile.handle.description": "您的唯一識別碼",
"profile.handle.label": "Handle",
"profile.name.description": "您的公開顯示名稱。",
Expand All @@ -163,6 +197,7 @@
"titles.general": "一般",
"titles.integration": "整合",
"titles.invitations": "邀請",
"titles.lists": "列表",
"titles.power": "Power",
"titles.profile": "個人資料",
"titles.shortcuts": "快捷鍵",
Expand Down