fixup: translation context

This commit is contained in:
Yifei Zhang 2023-04-02 18:02:03 +00:00
parent b85245e317
commit e3c3cd3d18
6 changed files with 25 additions and 5 deletions

View File

@ -133,13 +133,13 @@ function PromptToast(props: {
> >
<BrainIcon /> <BrainIcon />
<span className={chatStyle["prompt-toast-content"]}> <span className={chatStyle["prompt-toast-content"]}>
{context.length} {Locale.Context.Toast(context.length)}
</span> </span>
</div> </div>
{props.showModal && ( {props.showModal && (
<div className="modal-mask"> <div className="modal-mask">
<Modal <Modal
title="编辑前置上下文" title={Locale.Context.Edit}
onClose={() => props.setShowModal(false)} onClose={() => props.setShowModal(false)}
actions={[ actions={[
<IconButton <IconButton
@ -194,7 +194,7 @@ function PromptToast(props: {
<div className={chatStyle["context-prompt-row"]}> <div className={chatStyle["context-prompt-row"]}>
<IconButton <IconButton
icon={<AddIcon />} icon={<AddIcon />}
text="新增" text={Locale.Context.Add}
bordered bordered
className={chatStyle["context-prompt-button"]} className={chatStyle["context-prompt-button"]}
onClick={() => onClick={() =>

View File

@ -146,6 +146,11 @@ const cn = {
Success: "已写入剪切板", Success: "已写入剪切板",
Failed: "复制失败,请赋予剪切板权限", Failed: "复制失败,请赋予剪切板权限",
}, },
Context: {
Toast: (x: any) => `已设置 ${x} 条前置上下文`,
Edit: "前置上下文和历史记忆",
Add: "新增一条",
},
}; };
export type LocaleType = typeof cn; export type LocaleType = typeof cn;

View File

@ -54,7 +54,7 @@ const en: LocaleType = {
Close: "Close", Close: "Close",
}, },
Lang: { Lang: {
Name: "Language", Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
Options: { Options: {
cn: "简体中文", cn: "简体中文",
en: "English", en: "English",
@ -150,6 +150,11 @@ const en: LocaleType = {
Success: "Copied to clipboard", Success: "Copied to clipboard",
Failed: "Copy failed, please grant permission to access clipboard", Failed: "Copy failed, please grant permission to access clipboard",
}, },
Context: {
Toast: (x: any) => `With ${x} contextual prompts`,
Edit: "Contextual and Memory Prompts",
Add: "Add One",
},
}; };
export default en; export default en;

View File

@ -152,6 +152,11 @@ const es: LocaleType = {
Failed: Failed:
"La copia falló, por favor concede permiso para acceder al portapapeles", "La copia falló, por favor concede permiso para acceder al portapapeles",
}, },
Context: {
Toast: (x: any) => `With ${x} contextual prompts`,
Edit: "Contextual and Memory Prompts",
Add: "Add One",
},
}; };
export default es; export default es;

View File

@ -5,7 +5,7 @@ import ES from "./es";
export type { LocaleType } from "./cn"; export type { LocaleType } from "./cn";
export const AllLangs = ["en", "cn", "tw", "es"] as const; export const AllLangs = ["cn", "tw", "en", "es"] as const;
type Lang = (typeof AllLangs)[number]; type Lang = (typeof AllLangs)[number];
const LANG_KEY = "lang"; const LANG_KEY = "lang";

View File

@ -145,6 +145,11 @@ const tw: LocaleType = {
Success: "已複製到剪貼簿中", Success: "已複製到剪貼簿中",
Failed: "複製失敗,請賦予剪貼簿權限", Failed: "複製失敗,請賦予剪貼簿權限",
}, },
Context: {
Toast: (x: any) => `已設置 ${x} 條前置上下文`,
Edit: "前置上下文和歷史記憶",
Add: "新增壹條",
},
}; };
export default tw; export default tw;