Browse Source

fixup: translation context

Yifei Zhang 1 year ago
parent
commit
e3c3cd3d18
6 changed files with 25 additions and 5 deletions
  1. 3 3
      app/components/chat.tsx
  2. 5 0
      app/locales/cn.ts
  3. 6 1
      app/locales/en.ts
  4. 5 0
      app/locales/es.ts
  5. 1 1
      app/locales/index.ts
  6. 5 0
      app/locales/tw.ts

+ 3 - 3
app/components/chat.tsx

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

+ 5 - 0
app/locales/cn.ts

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

+ 6 - 1
app/locales/en.ts

@@ -54,7 +54,7 @@ const en: LocaleType = {
       Close: "Close",
     },
     Lang: {
-      Name: "Language",
+      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
       Options: {
         cn: "简体中文",
         en: "English",
@@ -150,6 +150,11 @@ const en: LocaleType = {
     Success: "Copied to 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;

+ 5 - 0
app/locales/es.ts

@@ -152,6 +152,11 @@ const es: LocaleType = {
     Failed:
       "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;

+ 1 - 1
app/locales/index.ts

@@ -5,7 +5,7 @@ import ES from "./es";
 
 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];
 
 const LANG_KEY = "lang";

+ 5 - 0
app/locales/tw.ts

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