diff --git a/components/chat/chat-input.tsx b/components/chat/chat-input.tsx index 761c6cd..a7aea91 100644 --- a/components/chat/chat-input.tsx +++ b/components/chat/chat-input.tsx @@ -241,7 +241,7 @@ export const ChatInput: FC = ({}) => { className="ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring text-md flex w-full resize-none rounded-md border-none bg-transparent px-14 py-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50" placeholder={t( // `Ask anything. Type "@" for assistants, "/" for prompts, "#" for files, and "!" for tools.` - `Ask anything. Type @ / # !` + "inputPlaceholder" )} onValueChange={handleInputChange} value={userInput} diff --git a/components/ui/image-picker.tsx b/components/ui/image-picker.tsx index d815de7..da5643e 100644 --- a/components/ui/image-picker.tsx +++ b/components/ui/image-picker.tsx @@ -3,6 +3,8 @@ import { ChangeEvent, FC, useState } from "react" import { toast } from "sonner" import { Input } from "./input" +import { useTranslation } from "react-i18next" + interface ImagePickerProps { src: string image: File | null @@ -20,6 +22,8 @@ const ImagePicker: FC = ({ width = 200, height = 200 }) => { + const { t } = useTranslation() + const [previewSrc, setPreviewSrc] = useState(src) const [previewImage, setPreviewImage] = useState(image) @@ -28,7 +32,7 @@ const ImagePicker: FC = ({ const file = e.target.files[0] if (file.size > 6000000) { - toast.error("Image must be less than 6MB!") + toast.error(t("side.imageTooLarge")) return } @@ -42,7 +46,7 @@ const ImagePicker: FC = ({ const ctx = canvas.getContext("2d") if (!ctx) { - toast.error("Unable to create canvas context.") + toast.error(t("side.canvasError")) return } diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index abb163f..3cee364 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -1,5 +1,5 @@ { - "Ask anything. Type \"/\" for prompts, \"@\" for files, and \"#\" for tools.": "Ask anything. Type \"/\" for prompts, \"@\" for files, and \"#\" for tools.", + "inputPlaceholder": "Ask anything. Type \"/\" for prompts, \"@\" for files, and \"#\" for tools.", "Company Name": "Jelly Drops LLC", "Clock In": "Clock In", @@ -13,12 +13,6 @@ }, "login": { - "chatTime": { - "Today": "Today", - "Yesterday": "Yesterday", - "PreviousWeek": "Previous Week", - "Older": "Older" - }, "email": "Email", "emailPlaceholder": "you@example.com", "password": "Password", @@ -134,6 +128,12 @@ }, "side": { + "chatTime": { + "Today": "Today", + "Yesterday": "Yesterday", + "PreviousWeek": "Previous Week", + "Older": "Older" + }, "selectWorkspace": "Select workspace...", "newWorkspace": "New Workspace", "searchWorkspaces": "Search workspaces...", @@ -209,7 +209,9 @@ "toolDescriptionPlaceholder": "Tool description...", "customHeadersLabel": "Custom Headers", "schemaLabel": "Schema", - "dropFileHere": "Drop file here" + "dropFileHere": "Drop file here", + "imageTooLarge": "Image must be less than 6MB!", + "canvasError": "Unable to create canvas context." }, "contentType": { diff --git a/public/locales/ja/translation.json b/public/locales/ja/translation.json index 20fcfef..6b8cfbb 100644 --- a/public/locales/ja/translation.json +++ b/public/locales/ja/translation.json @@ -1,5 +1,5 @@ { - "Ask anything. Type \"/\" for prompts, \"@\" for files, and \"#\" for tools.": "何でも聞いてください。「/」でプロンプト、「@」でファイル、「#」でツールを入力してください。", + "inputPlaceholder": "何でも聞いてください。「/」でプロンプト、「@」でファイル、「#」でツールを入力してください。", "Company Name": "Jelly Drops LLC", "Clock In": "出勤する", "setup": { @@ -208,7 +208,9 @@ "toolDescriptionPlaceholder": "ツールの説明...", "customHeadersLabel": "カスタムヘッダー", "schemaLabel": "スキーマ", - "dropFileHere": "ここにファイルをドロップ" + "dropFileHere": "ここにファイルをドロップ", + "imageTooLarge": "画像は6MB未満である必要があります!", + "canvasError": "キャンバスコンテキストを作成できませんでした。" }, "contentType": { diff --git a/public/locales/zh/translation.json b/public/locales/zh/translation.json index 8a7f3b6..2b07afc 100644 --- a/public/locales/zh/translation.json +++ b/public/locales/zh/translation.json @@ -1,5 +1,5 @@ { - "Ask anything. Type \"/\" for prompts, \"@\" for files, and \"#\" for tools.": "随便问点什么。输入“/”查找提示,“@”查找文件,“#”查找工具。", + "inputPlaceholder": "随便问点什么。输入“/”查找提示,“@”查找文件,“#”查找工具。", "Company Name": "深圳果冻移民咨询有限责任公司", "Clock In": "打卡", "setup": { @@ -208,7 +208,9 @@ "toolDescriptionPlaceholder": "工具描述...", "customHeadersLabel": "自定义请求头", "schemaLabel": "Schema", - "dropFileHere": "将文件拖放到此处" + "dropFileHere": "将文件拖放到此处", + "imageTooLarge": "图片必须小于6MB!", + "canvasError": "无法创建画布上下文。" }, "contentType": {