Merge pull request #5920 from fishshi/i18n

Use i18n for DISCOVERY
This commit is contained in:
RiverRay 2024-12-28 22:05:37 +08:00 committed by GitHub
commit 5f96804f3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 14 deletions

View File

@ -22,7 +22,6 @@ import {
MIN_SIDEBAR_WIDTH, MIN_SIDEBAR_WIDTH,
NARROW_SIDEBAR_WIDTH, NARROW_SIDEBAR_WIDTH,
Path, Path,
PLUGINS,
REPO_URL, REPO_URL,
} from "../constant"; } from "../constant";
@ -32,6 +31,12 @@ import dynamic from "next/dynamic";
import { showConfirm, Selector } from "./ui-lib"; import { showConfirm, Selector } from "./ui-lib";
import clsx from "clsx"; import clsx from "clsx";
const DISCOVERY = [
{ name: Locale.Plugin.Name, path: Path.Plugins },
{ name: "Stable Diffusion", path: Path.Sd },
{ name: Locale.SearchChat.Page.Title, path: Path.SearchChat },
];
const ChatList = dynamic(async () => (await import("./chat-list")).ChatList, { const ChatList = dynamic(async () => (await import("./chat-list")).ChatList, {
loading: () => null, loading: () => null,
}); });
@ -219,7 +224,7 @@ export function SideBarTail(props: {
export function SideBar(props: { className?: string }) { export function SideBar(props: { className?: string }) {
useHotKey(); useHotKey();
const { onDragStart, shouldNarrow } = useDragSideBar(); const { onDragStart, shouldNarrow } = useDragSideBar();
const [showPluginSelector, setShowPluginSelector] = useState(false); const [showDiscoverySelector, setshowDiscoverySelector] = useState(false);
const navigate = useNavigate(); const navigate = useNavigate();
const config = useAppConfig(); const config = useAppConfig();
const chatStore = useChatStore(); const chatStore = useChatStore();
@ -254,21 +259,21 @@ export function SideBar(props: { className?: string }) {
icon={<DiscoveryIcon />} icon={<DiscoveryIcon />}
text={shouldNarrow ? undefined : Locale.Discovery.Name} text={shouldNarrow ? undefined : Locale.Discovery.Name}
className={styles["sidebar-bar-button"]} className={styles["sidebar-bar-button"]}
onClick={() => setShowPluginSelector(true)} onClick={() => setshowDiscoverySelector(true)}
shadow shadow
/> />
</div> </div>
{showPluginSelector && ( {showDiscoverySelector && (
<Selector <Selector
items={[ items={[
...PLUGINS.map((item) => { ...DISCOVERY.map((item) => {
return { return {
title: item.name, title: item.name,
value: item.path, value: item.path,
}; };
}), }),
]} ]}
onClose={() => setShowPluginSelector(false)} onClose={() => setshowDiscoverySelector(false)}
onSelection={(s) => { onSelection={(s) => {
navigate(s[0], { state: { fromHome: true } }); navigate(s[0], { state: { fromHome: true } });
}} }}

View File

@ -597,11 +597,6 @@ export const internalAllowedWebDavEndpoints = [
]; ];
export const DEFAULT_GA_ID = "G-89WN60ZK2E"; export const DEFAULT_GA_ID = "G-89WN60ZK2E";
export const PLUGINS = [
{ name: "Plugins", path: Path.Plugins },
{ name: "Stable Diffusion", path: Path.Sd },
{ name: "Search Chat", path: Path.SearchChat },
];
export const SAAS_CHAT_URL = "https://nextchat.dev/chat"; export const SAAS_CHAT_URL = "https://nextchat.dev/chat";
export const SAAS_CHAT_UTM_URL = "https://nextchat.dev/chat?utm=github"; export const SAAS_CHAT_UTM_URL = "https://nextchat.dev/chat?utm=github";

View File

@ -176,7 +176,7 @@ const cn = {
}, },
}, },
Lang: { Lang: {
Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language` Name: "Language", // 注意:如果要添加新的翻译,请不要翻译此值,将它保留为 `Language`
All: "所有语言", All: "所有语言",
}, },
Avatar: "头像", Avatar: "头像",
@ -630,7 +630,7 @@ const cn = {
Sysmessage: "你是一个助手", Sysmessage: "你是一个助手",
}, },
SearchChat: { SearchChat: {
Name: "搜索", Name: "搜索聊天记录",
Page: { Page: {
Title: "搜索聊天记录", Title: "搜索聊天记录",
Search: "输入搜索关键词", Search: "输入搜索关键词",

View File

@ -485,7 +485,7 @@ const tw = {
}, },
}, },
SearchChat: { SearchChat: {
Name: "搜尋", Name: "搜尋聊天記錄",
Page: { Page: {
Title: "搜尋聊天記錄", Title: "搜尋聊天記錄",
Search: "輸入搜尋關鍵詞", Search: "輸入搜尋關鍵詞",