From d1bc7dffff28954cc987d1161f1e5f7160eeed47 Mon Sep 17 00:00:00 2001 From: steven Date: Wed, 19 Apr 2023 11:12:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20support=20=E6=97=A5=E6=9C=AC=E8=AA=9E?= =?UTF-8?q?=20locale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CreateConnectionModal.tsx | 4 +- src/components/LocaleSelector.tsx | 4 ++ src/components/LocaleSwitch.tsx | 2 + src/locales/i18n.ts | 4 ++ src/locales/jp.json | 77 ++++++++++++++++++++++++ src/types/setting.ts | 2 +- 6 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 src/locales/jp.json diff --git a/src/components/CreateConnectionModal.tsx b/src/components/CreateConnectionModal.tsx index 5cbbf1a..6f452c6 100644 --- a/src/components/CreateConnectionModal.tsx +++ b/src/components/CreateConnectionModal.tsx @@ -355,11 +355,11 @@ const CreateConnectionModal = (props: Props) => {
diff --git a/src/components/LocaleSelector.tsx b/src/components/LocaleSelector.tsx index cb49b61..41233c1 100644 --- a/src/components/LocaleSelector.tsx +++ b/src/components/LocaleSelector.tsx @@ -20,6 +20,10 @@ const localeItemList: LocaleItem[] = [ value: "es", label: "Español", }, + { + value: "jp", + label: "日本語", + }, ]; const LocaleSelector = () => { diff --git a/src/components/LocaleSwitch.tsx b/src/components/LocaleSwitch.tsx index d09383b..a8dbcd9 100644 --- a/src/components/LocaleSwitch.tsx +++ b/src/components/LocaleSwitch.tsx @@ -10,6 +10,8 @@ const LocaleSwitch = () => { settingStore.setLocale("zh"); } else if (locale === "zh") { settingStore.setLocale("es"); + } else if (locale === "es") { + settingStore.setLocale("jp"); } else { settingStore.setLocale("en"); } diff --git a/src/locales/i18n.ts b/src/locales/i18n.ts index 3c4fd4b..b064663 100644 --- a/src/locales/i18n.ts +++ b/src/locales/i18n.ts @@ -3,6 +3,7 @@ import { initReactI18next } from "react-i18next"; import enLocale from "./en.json"; import zhLocale from "./zh.json"; import esLocale from "./es.json"; +import jpLocale from "./jp.json"; i18n.use(initReactI18next).init({ resources: { @@ -15,6 +16,9 @@ i18n.use(initReactI18next).init({ es: { translation: esLocale, }, + jp: { + translation: jpLocale, + }, }, fallbackLng: "en", }); diff --git a/src/locales/jp.json b/src/locales/jp.json new file mode 100644 index 0000000..c0198fd --- /dev/null +++ b/src/locales/jp.json @@ -0,0 +1,77 @@ +{ + "common": { + "clear": "クリア", + "close": "閉じる", + "confirm": "確認", + "save": "保存", + "edit": "編集", + "loading": "読み込み中", + "setting": "設定", + "copy": "コピー", + "delete": "削除", + "execute": "実行" + }, + "conversation": { + "new-chat": "新しいチャット", + "conversation-title": "会話タイトル", + "update": "会話を更新", + "title": "タイトル" + }, + "connection": { + "self": "接続", + "new": "接続を作成", + "edit": "接続を編集", + "select-database": "データベースを選択", + "database-type": "データベースタイプ", + "title": "タイトル", + "host": "ホスト", + "port": "ポート", + "database-name": "データベース名", + "username": "ユーザー名", + "password": "パスワード" + }, + "assistant": { + "self": "ボット", + "create-your-bot": "必要なボットが見つからない場合は、作成してください" + }, + "execution": { + "title": "SQLを実行", + "message": { + "executing": "クエリを実行中...", + "no-connection": "接続が選択されていません", + "no-data": "データが返されませんでした" + } + }, + "editor": { + "placeholder": "ここに質問を入力してください..." + }, + "setting": { + "self": "設定", + "basic": { + "self": "基本", + "language": "言語" + }, + "theme": { + "self": "テーマ", + "system": "システムに従う", + "light": "ライト", + "dark": "ダーク" + }, + "openai-api-configuration": { + "self": "OpenAI APIの設定" + }, + "data": { + "self": "データ", + "clear-all-data": "すべてのデータをクリア" + } + }, + "social": { + "join-discord-channel": "Discordチャンネルに参加", + "join-wechat-group": "WeChatグループに参加" + }, + "banner": { + "data-storage": "接続設定はローカルブラウザに保存されます", + "non-select-sql-warning": "現在のステートメントは非SELECT SQLである可能性があり、データベースのスキーマまたはデータの変更につながる可能性があります。自分が何をしているか確認してください。", + "product-hunt": "🚀🚀🚀 Product Huntでローンチしました。投票してください! 🚀🚀🚀" + } +} diff --git a/src/types/setting.ts b/src/types/setting.ts index 56a9ef1..cdf6458 100644 --- a/src/types/setting.ts +++ b/src/types/setting.ts @@ -1,4 +1,4 @@ -export type Locale = "en" | "zh" | "es"; +export type Locale = "en" | "zh" | "es" | "jp"; export type Theme = "light" | "dark" | "system";