feat: support 日本語 locale

This commit is contained in:
steven
2023-04-19 11:12:51 +08:00
parent 609f6c3dec
commit d1bc7dffff
6 changed files with 90 additions and 3 deletions

View File

@ -355,11 +355,11 @@ const CreateConnectionModal = (props: Props) => {
</div>
<div className="space-x-2 flex flex-row justify-center">
<button className="btn btn-outline" onClick={close}>
Close
{t("common.close")}
</button>
<button className="btn" disabled={isRequesting || !allowSave} onClick={handleCreateConnection}>
{isRequesting && <Icon.BiLoaderAlt className="w-4 h-auto animate-spin mr-1" />}
Save
{t("common.save")}
</button>
</div>
</div>

View File

@ -20,6 +20,10 @@ const localeItemList: LocaleItem[] = [
value: "es",
label: "Español",
},
{
value: "jp",
label: "日本語",
},
];
const LocaleSelector = () => {

View File

@ -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");
}

View File

@ -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",
});

77
src/locales/jp.json Normal file
View File

@ -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でローンチしました。投票してください 🚀🚀🚀"
}
}

View File

@ -1,4 +1,4 @@
export type Locale = "en" | "zh" | "es";
export type Locale = "en" | "zh" | "es" | "jp";
export type Theme = "light" | "dark" | "system";