chore: update chinese locales (#247)
* chore: update chinese locales * chore: update locales
This commit is contained in:
parent
a78a8c4a94
commit
28c8bf0e0d
|
@ -1,5 +1,6 @@
|
||||||
import { Prompt } from '@/types/prompt';
|
import { Prompt } from '@/types/prompt';
|
||||||
import { FC, KeyboardEvent, useEffect, useRef, useState } from 'react';
|
import { FC, KeyboardEvent, useEffect, useRef, useState } from 'react';
|
||||||
|
import { useTranslation } from 'next-i18next';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
prompt: Prompt;
|
prompt: Prompt;
|
||||||
|
@ -8,6 +9,7 @@ interface Props {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PromptModal: FC<Props> = ({ prompt, onClose, onUpdatePrompt }) => {
|
export const PromptModal: FC<Props> = ({ prompt, onClose, onUpdatePrompt }) => {
|
||||||
|
const { t } = useTranslation('promptbar');
|
||||||
const [name, setName] = useState(prompt.name);
|
const [name, setName] = useState(prompt.name);
|
||||||
const [description, setDescription] = useState(prompt.description);
|
const [description, setDescription] = useState(prompt.description);
|
||||||
const [content, setContent] = useState(prompt.content);
|
const [content, setContent] = useState(prompt.content);
|
||||||
|
@ -42,11 +44,11 @@ export const PromptModal: FC<Props> = ({ prompt, onClose, onUpdatePrompt }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="z-100 fixed inset-0 flex items-center justify-center bg-black bg-opacity-50"
|
className="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 z-100"
|
||||||
onKeyDown={handleEnter}
|
onKeyDown={handleEnter}
|
||||||
>
|
>
|
||||||
<div className="fixed inset-0 z-10 overflow-y-auto">
|
<div className="fixed inset-0 z-10 overflow-y-auto">
|
||||||
<div className="flex min-h-screen items-center justify-center px-4 pt-4 pb-20 text-center sm:block sm:p-0">
|
<div className="flex items-center justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:block sm:p-0">
|
||||||
<div
|
<div
|
||||||
className="hidden sm:inline-block sm:h-screen sm:align-middle"
|
className="hidden sm:inline-block sm:h-screen sm:align-middle"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
|
@ -58,7 +60,7 @@ export const PromptModal: FC<Props> = ({ prompt, onClose, onUpdatePrompt }) => {
|
||||||
role="dialog"
|
role="dialog"
|
||||||
>
|
>
|
||||||
<div className="text-sm font-bold text-black dark:text-neutral-200">
|
<div className="text-sm font-bold text-black dark:text-neutral-200">
|
||||||
Name
|
{t('Name')}
|
||||||
</div>
|
</div>
|
||||||
<input
|
<input
|
||||||
ref={nameInputRef}
|
ref={nameInputRef}
|
||||||
|
@ -69,24 +71,28 @@ export const PromptModal: FC<Props> = ({ prompt, onClose, onUpdatePrompt }) => {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="mt-6 text-sm font-bold text-black dark:text-neutral-200">
|
<div className="mt-6 text-sm font-bold text-black dark:text-neutral-200">
|
||||||
Description
|
{t('Description')}
|
||||||
</div>
|
</div>
|
||||||
<textarea
|
<textarea
|
||||||
className="mt-2 w-full rounded-lg border border-neutral-500 px-4 py-2 text-neutral-900 shadow focus:outline-none dark:border-neutral-800 dark:border-opacity-50 dark:bg-[#40414F] dark:text-neutral-100"
|
className="mt-2 w-full rounded-lg border border-neutral-500 px-4 py-2 text-neutral-900 shadow focus:outline-none dark:border-neutral-800 dark:border-opacity-50 dark:bg-[#40414F] dark:text-neutral-100"
|
||||||
style={{ resize: 'none' }}
|
style={{ resize: 'none' }}
|
||||||
placeholder="A description for your prompt."
|
placeholder={t('A description for your prompt.') || ''}
|
||||||
value={description}
|
value={description}
|
||||||
onChange={(e) => setDescription(e.target.value)}
|
onChange={(e) => setDescription(e.target.value)}
|
||||||
rows={3}
|
rows={3}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="mt-6 text-sm font-bold text-black dark:text-neutral-200">
|
<div className="mt-6 text-sm font-bold text-black dark:text-neutral-200">
|
||||||
Prompt
|
{t('Prompt')}
|
||||||
</div>
|
</div>
|
||||||
<textarea
|
<textarea
|
||||||
className="mt-2 w-full rounded-lg border border-neutral-500 px-4 py-2 text-neutral-900 shadow focus:outline-none dark:border-neutral-800 dark:border-opacity-50 dark:bg-[#40414F] dark:text-neutral-100"
|
className="mt-2 w-full rounded-lg border border-neutral-500 px-4 py-2 text-neutral-900 shadow focus:outline-none dark:border-neutral-800 dark:border-opacity-50 dark:bg-[#40414F] dark:text-neutral-100"
|
||||||
style={{ resize: 'none' }}
|
style={{ resize: 'none' }}
|
||||||
placeholder="Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}"
|
placeholder={
|
||||||
|
t(
|
||||||
|
'Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}',
|
||||||
|
) || ''
|
||||||
|
}
|
||||||
value={content}
|
value={content}
|
||||||
onChange={(e) => setContent(e.target.value)}
|
onChange={(e) => setContent(e.target.value)}
|
||||||
rows={10}
|
rows={10}
|
||||||
|
@ -94,7 +100,7 @@ export const PromptModal: FC<Props> = ({ prompt, onClose, onUpdatePrompt }) => {
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="mt-6 w-full rounded-lg border border-neutral-500 px-4 py-2 text-neutral-900 shadow hover:bg-neutral-100 focus:outline-none dark:border-neutral-800 dark:border-opacity-50 dark:bg-white dark:text-black dark:hover:bg-neutral-300"
|
className="w-full px-4 py-2 mt-6 border rounded-lg shadow border-neutral-500 text-neutral-900 hover:bg-neutral-100 focus:outline-none dark:border-neutral-800 dark:border-opacity-50 dark:bg-white dark:text-black dark:hover:bg-neutral-300"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const updatedPrompt = {
|
const updatedPrompt = {
|
||||||
...prompt,
|
...prompt,
|
||||||
|
@ -107,7 +113,7 @@ export const PromptModal: FC<Props> = ({ prompt, onClose, onUpdatePrompt }) => {
|
||||||
onClose();
|
onClose();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Save
|
{t('Save')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -127,7 +127,7 @@ export const Promptbar: FC<Props> = ({
|
||||||
|
|
||||||
{prompts.length > 1 && (
|
{prompts.length > 1 && (
|
||||||
<Search
|
<Search
|
||||||
placeholder="Search prompts..."
|
placeholder={t('Search prompts...') || ''}
|
||||||
searchTerm={searchTerm}
|
searchTerm={searchTerm}
|
||||||
onSearch={setSearchTerm}
|
onSearch={setSearchTerm}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -663,7 +663,7 @@ const Home: React.FC<HomeProps> = ({ serverSideApiKeyIsSet }) => {
|
||||||
</button>
|
</button>
|
||||||
<div
|
<div
|
||||||
onClick={handleToggleChatbar}
|
onClick={handleToggleChatbar}
|
||||||
className="absolute top-0 left-0 z-10 h-full w-full bg-black opacity-70 sm:hidden"
|
className="absolute top-0 left-0 z-10 w-full h-full bg-black opacity-70 sm:hidden"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
@ -713,7 +713,7 @@ const Home: React.FC<HomeProps> = ({ serverSideApiKeyIsSet }) => {
|
||||||
</button>
|
</button>
|
||||||
<div
|
<div
|
||||||
onClick={handleTogglePromptbar}
|
onClick={handleTogglePromptbar}
|
||||||
className="absolute top-0 left-0 z-10 h-full w-full bg-black opacity-70 sm:hidden"
|
className="absolute top-0 left-0 z-10 w-full h-full bg-black opacity-70 sm:hidden"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
@ -741,6 +741,7 @@ export const getServerSideProps: GetServerSideProps = async ({ locale }) => {
|
||||||
'chat',
|
'chat',
|
||||||
'sidebar',
|
'sidebar',
|
||||||
'markdown',
|
'markdown',
|
||||||
|
'promptbar'
|
||||||
])),
|
])),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"OpenAI API Key Required": "需要 OpenAI API 密钥",
|
"OpenAI API Key Required": "需要 OpenAI API 密钥",
|
||||||
"Please set your OpenAI API key in the bottom left of the sidebar.": "请在侧边栏左下角设置您的 OpenAI API 密钥。",
|
"Please set your OpenAI API key in the bottom left of the sidebar.": "请在侧边栏左下角设置您的 OpenAI API 密钥。",
|
||||||
|
"If you don't have an OpenAI API key, you can get one here: ": "如果你没有 OpenAI API 密钥,你可以在此获取:",
|
||||||
"Stop Generating": "停止生成",
|
"Stop Generating": "停止生成",
|
||||||
"Prompt limit is {{maxLength}} characters": "提示字数限制为 {{maxLength}} 个字符",
|
"Prompt limit is {{maxLength}} characters": "提示字数限制为 {{maxLength}} 个字符",
|
||||||
"System Prompt": "系统提示",
|
"System Prompt": "系统提示",
|
||||||
|
@ -12,14 +13,16 @@
|
||||||
"Conversation": "对话",
|
"Conversation": "对话",
|
||||||
"OR": "或",
|
"OR": "或",
|
||||||
"Loading...": "加载中...",
|
"Loading...": "加载中...",
|
||||||
"Type a message...": "输入一条消息...",
|
"Type a message or type \"/\" to select a prompt...": "输入一条消息或键入 \"/\" 以选择提示...",
|
||||||
"Error fetching models.": "获取模型时出错。",
|
"Error fetching models.": "获取模型时出错。",
|
||||||
"AI": "AI",
|
"AI": "AI",
|
||||||
"You": "你",
|
"You": "你",
|
||||||
|
"Cancel": "取消",
|
||||||
|
"Save & Submit": "保存并提交",
|
||||||
"Make sure your OpenAI API key is set in the bottom left of the sidebar.": "请确保您的 OpenAI API 密钥已在侧边栏左下角设置。",
|
"Make sure your OpenAI API key is set in the bottom left of the sidebar.": "请确保您的 OpenAI API 密钥已在侧边栏左下角设置。",
|
||||||
"If you completed this step, OpenAI may be experiencing issues.": "如果您已完成此步骤,OpenAI 可能遇到了问题。",
|
"If you completed this step, OpenAI may be experiencing issues.": "如果您已完成此步骤,OpenAI 可能遇到了问题。",
|
||||||
"Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "消息字数限制为 {{maxLength}} 个字符。您已输入 {{valueLength}} 个字符。",
|
"Message limit is {{maxLength}} characters. You have entered {{valueLength}} characters.": "消息字数限制为 {{maxLength}} 个字符。您已输入 {{valueLength}} 个字符。",
|
||||||
"Please enter a message": "请输入一条消息",
|
"Please enter a message": "请输入一条消息",
|
||||||
"Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI 是一个高级聊天机器人工具包,旨在模仿 OpenAI 聊天模型的 ChatGPT 界面和功能。",
|
"Chatbot UI is an advanced chatbot kit for OpenAI's chat models aiming to mimic ChatGPT's interface and functionality.": "Chatbot UI 是一个高级聊天机器人工具包,旨在模仿 OpenAI 聊天模型的 ChatGPT 界面和功能。",
|
||||||
"Are you sure you want to clear all messages?": "你确定要清除所有的消息吗?"
|
"Are you sure you want to clear all messages?": "你确定要清除所有的消息吗?"
|
||||||
}
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"New prompt": "新建提示",
|
||||||
|
"New folder": "新建文件夹",
|
||||||
|
"No prompts.": "无提示词",
|
||||||
|
"Search prompts...": "搜索提示...",
|
||||||
|
"Name": "名称",
|
||||||
|
"Description": "描述",
|
||||||
|
"A description for your prompt.": "提示词描述",
|
||||||
|
"Prompt": "提示词",
|
||||||
|
"Prompt content. Use {{}} to denote a variable. Ex: {{name}} is a {{adjective}} {{noun}}": "提示内容。使用 {{}} 表示一个变量。例如:{{name}} 是一个 {{adjective}} {{noun}}",
|
||||||
|
"Save": "保存"
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"New folder": "新建文件夹",
|
"New folder": "新建文件夹",
|
||||||
"New chat": "新建聊天",
|
"New chat": "新建聊天",
|
||||||
"No conversations.": "无对话。",
|
"No conversations.": "无对话",
|
||||||
"Search conversations...": "搜索对话...",
|
"Search conversations...": "搜索对话...",
|
||||||
"OpenAI API Key": "OpenAI API 密钥",
|
"OpenAI API Key": "OpenAI API 密钥",
|
||||||
"Import conversations": "导入对话",
|
"Import conversations": "导入对话",
|
||||||
|
|
Loading…
Reference in New Issue