@@ -27,7 +30,7 @@ export function DownloadingToast(router: NextRouter, progress?: string) {
className="p-2 rounded bg-red-500 hover:bg-red-400 text-white focus:outline-none focus:ring focus:ring-red-300"
onClick={() => router.reload()}
>
- Cancel
+ {t('Cancel')}
)
diff --git a/components/Navbar.tsx b/components/Navbar.tsx
index a2d6236..2ea78a6 100644
--- a/components/Navbar.tsx
+++ b/components/Navbar.tsx
@@ -8,6 +8,7 @@ import Link from 'next/link'
import Image from 'next/image'
import { useRouter } from 'next/router'
import { Fragment, useEffect, useState } from 'react'
+import { useTranslation } from 'next-i18next'
import siteConfig from '../config/site.config'
import SearchModal from './SearchModal'
@@ -37,6 +38,8 @@ const Navbar = () => {
setTokenPresent(storedToken())
}, [])
+ const { t } = useTranslation()
+
const clearTokens = () => {
setIsOpen(false)
@@ -71,7 +74,7 @@ const Navbar = () => {
>
diff --git a/components/SwitchLayout.tsx b/components/SwitchLayout.tsx
index ebf31b6..af76888 100644
--- a/components/SwitchLayout.tsx
+++ b/components/SwitchLayout.tsx
@@ -2,6 +2,7 @@ import { Fragment } from 'react'
import { IconProp } from '@fortawesome/fontawesome-svg-core'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { Listbox, Transition } from '@headlessui/react'
+import { useTranslation } from 'next-i18next'
import useLocalStorage from '../utils/useLocalStorage'
@@ -13,13 +14,21 @@ export const layouts: Array<{ id: number; name: 'Grid' | 'List'; icon: IconProp
export const SwitchLayout = () => {
const [preferredLayout, setPreferredLayout] = useLocalStorage('preferredLayout', layouts[0])
+ const { t } = useTranslation()
+
return (
- {preferredLayout.name}
+
+ {
+ // t('Grid')
+ // t('List')
+ t(preferredLayout.name)
+ }
+
@@ -39,7 +48,11 @@ export const SwitchLayout = () => {
>
- {layout.name}
+ {
+ // t('Grid')
+ // t('List')
+ t(layout.name)
+ }
{layout.name === preferredLayout.name && (
diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index 0967ef4..c23ed78 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -1 +1,32 @@
-{}
+{
+ "Actions": "Actions",
+ "Cancel": "Cancel",
+ "Copied folder permalink.": "Copied folder permalink.",
+ "Copied raw file permalink.": "Copied raw file permalink.",
+ "Copy folder permalink": "Copy folder permalink",
+ "Copy raw file permalink": "Copy raw file permalink",
+ "Download file": "Download file",
+ "Download folder": "Download folder",
+ "Download selected files": "Download selected files",
+ "Downloading folder, refresh page to cancel": "Downloading folder, refresh page to cancel",
+ "Downloading selected files, refresh page to cancel": "Downloading selected files, refresh page to cancel",
+ "Downloading selected files...": "Downloading selected files...",
+ "Downloading {{progress}}%": "Downloading {{progress}}%",
+ "Failed to download folder {{path}}: {{status}} {{message}} Skipped it to continue.": "Failed to download folder {{path}}: {{status}} {{message}} Skipped it to continue.",
+ "Failed to download folder.": "Failed to download folder.",
+ "Failed to download selected files.": "Failed to download selected files.",
+ "Finished downloading folder.": "Finished downloading folder.",
+ "Finished downloading selected files.": "Finished downloading selected files.",
+ "Grid": "Grid",
+ "Home": "Home",
+ "Last Modified": "Last Modified",
+ "List": "List",
+ "Load more": "Load more",
+ "Loading ...": "Loading ...",
+ "Name": "Name",
+ "No more files": "No more files",
+ "Search ...": "Search ...",
+ "Select file": "Select file",
+ "Select files": "Select files",
+ "Size": "Size"
+}
diff --git a/public/locales/zh-CN/common.json b/public/locales/zh-CN/common.json
index 0967ef4..c5afe04 100644
--- a/public/locales/zh-CN/common.json
+++ b/public/locales/zh-CN/common.json
@@ -1 +1,32 @@
-{}
+{
+ "Actions": "操作",
+ "Cancel": "取消",
+ "Copied folder permalink.": "已复制文件夹永久链接。",
+ "Copied raw file permalink.": "已复制文件永久链接。",
+ "Copy folder permalink": "复制文件夹永久链接",
+ "Copy raw file permalink": "复制文件永久链接",
+ "Download file": "下载此文件",
+ "Download folder": "下载此文件夹",
+ "Download selected files": "下载选定文件",
+ "Downloading folder, refresh page to cancel": "下载文件夹中,刷新页面以取消",
+ "Downloading selected files, refresh page to cancel": "下载选定文件中,刷新页面以取消",
+ "Downloading selected files...": "下载选定文件中...",
+ "Downloading {{progress}}%": "已下载 {{progress}}%",
+ "Failed to download folder {{path}}: {{status}} {{message}} Skipped it to continue.": "下载文件夹 {{path}} 失败:{{status}} {{message}} 已忽略此错误并继续下载。",
+ "Failed to download folder.": "下载文件夹失败。",
+ "Failed to download selected files.": "下载选定文件失败。",
+ "Finished downloading folder.": "下载文件夹成功。",
+ "Finished downloading selected files.": "下载选定文件成功。",
+ "Grid": "图格",
+ "Home": "首页",
+ "Last Modified": "最后修改时间",
+ "List": "列表",
+ "Load more": "加载更多",
+ "Loading ...": "加载中……",
+ "Name": "文件名",
+ "No more files": "加载完毕",
+ "Search ...": "搜索……",
+ "Select file": "选择此文件",
+ "Select files": "选择以下文件",
+ "Size": "文件大小"
+}