Skip to content

Commit

Permalink
feat(i18n): add shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
ischanx committed Sep 24, 2024
1 parent be64099 commit 0057ca0
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 4 deletions.
8 changes: 8 additions & 0 deletions apps/renderer/src/constants/shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,11 @@ export const shortcuts = {
},
},
} as const

export const shortcutsType: { [key in keyof typeof shortcuts]: string } = {
feeds: "keys.type.feeds",
layout: "keys.type.layout",
entries: "keys.type.entries",
entry: "keys.type.entry",
audio: "keys.type.audio",
}
4 changes: 2 additions & 2 deletions apps/renderer/src/modules/modal/shortcuts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { KbdCombined } from "~/components/ui/kbd/Kbd"
import { useCurrentModal, useModalStack } from "~/components/ui/modal"
import { PlainModal } from "~/components/ui/modal/stacked/custom-modal"
import { ScrollArea } from "~/components/ui/scroll-area"
import { shortcuts } from "~/constants/shortcuts"
import { shortcuts, shortcutsType } from "~/constants/shortcuts"
import { useSwitchHotKeyScope } from "~/hooks/common"
import { cn } from "~/lib/utils"

Expand Down Expand Up @@ -53,7 +53,7 @@ const ShortcutModalContent = () => {
<div className="w-full space-y-6 px-4 pb-5 pt-3">
{Object.keys(shortcuts).map((type) => (
<section key={type}>
<div className="mb-2 text-base font-medium capitalize">{type}</div>
<div className="mb-2 text-base font-medium capitalize">{t(shortcutsType[type])}</div>
<div className="rounded-md border text-[13px] text-zinc-600 dark:text-zinc-300">
{Object.keys(shortcuts[type]).map((action, index) => (
<div
Expand Down
4 changes: 2 additions & 2 deletions apps/renderer/src/pages/settings/(settings)/shortcuts.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useTranslation } from "react-i18next"

import { KbdCombined } from "~/components/ui/kbd/Kbd"
import { shortcuts } from "~/constants/shortcuts"
import { shortcuts, shortcutsType } from "~/constants/shortcuts"
import { cn } from "~/lib/utils"
import { SettingsTitle } from "~/modules/settings/title"
import { defineSettingPageData } from "~/modules/settings/utils"
Expand All @@ -23,7 +23,7 @@ export function Component() {
<div className="mt-4 space-y-6">
{Object.keys(shortcuts).map((type) => (
<section key={type}>
<div className="mb-2 text-sm font-medium capitalize">{type}</div>
<div className="mb-2 text-sm font-medium capitalize">{t(shortcutsType[type])}</div>
<div className="rounded-md border text-[13px] text-zinc-600 dark:text-zinc-300">
{Object.keys(shortcuts[type]).map((action, index) => (
<div
Expand Down
5 changes: 5 additions & 0 deletions locales/shortcuts/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,10 @@
"keys.feeds.switchToView": "Switch to View",
"keys.layout.showShortcuts": "Show/Hide Shortcuts",
"keys.layout.toggleSidebar": "Show/Hide Feed Sidebar",
"keys.type.audio": "audio",
"keys.type.entries": "entries",
"keys.type.entry": "entry",
"keys.type.feeds": "feeds",
"keys.type.layout": "layout",
"sidebar_title": "Shortcuts"
}
5 changes: 5 additions & 0 deletions locales/shortcuts/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,10 @@
"keys.feeds.switchToView": "切换到指定类型",
"keys.layout.showShortcuts": "显示/隐藏快捷键",
"keys.layout.toggleSidebar": "显示/隐藏侧边栏",
"keys.type.audio": "音频",
"keys.type.entries": "条目列表",
"keys.type.entry": "条目",
"keys.type.feeds": "订阅源",
"keys.type.layout": "布局",
"sidebar_title": "快捷键"
}
5 changes: 5 additions & 0 deletions locales/shortcuts/zh-HK.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,10 @@
"keys.feeds.switchToView": "切換到視圖",
"keys.layout.showShortcuts": "顯示/隱藏快捷鍵",
"keys.layout.toggleSidebar": "顯示/隱藏訂閱側邊欄",
"keys.type.audio": "音頻",
"keys.type.entries": "條目列表",
"keys.type.entry": "條目",
"keys.type.feeds": "訂閲源",
"keys.type.layout": "佈局",
"sidebar_title": "快捷鍵"
}
5 changes: 5 additions & 0 deletions locales/shortcuts/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,10 @@
"keys.feeds.switchToView": "切換到視圖",
"keys.layout.showShortcuts": "顯示/隱藏快捷鍵",
"keys.layout.toggleSidebar": "顯示/隱藏摘要側邊欄",
"keys.type.audio": "音頻",
"keys.type.entries": "條目列表",
"keys.type.entry": "條目",
"keys.type.feeds": "訂閲源",
"keys.type.layout": "佈局",
"sidebar_title": "快捷鍵"
}

0 comments on commit 0057ca0

Please sign in to comment.