Skip to content

Commit 6c805f8

Browse files
committed
feat: Japanese language support
1 parent c6fd99a commit 6c805f8

17 files changed

Lines changed: 457 additions & 14 deletions

File tree

chat2db-client/src/blocks/Setting/BaseSetting/index.tsx

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ import classnames from 'classnames';
55
import themeDarkImg from '@/assets/img/theme-dark.png';
66
import themeLightImg from '@/assets/img/theme-light.png';
77
import themeAutoImg from '@/assets/img/theme-auto.png';
8-
import { Radio, Select } from 'antd';
8+
import { Select } from 'antd';
99
import Iconfont from '@/components/Iconfont';
1010
import { setLang as setLangLocalStorage } from '@/utils/localStorage';
1111
import { useTheme } from '@/hooks/useTheme';
1212

1313
import styles from './index.less';
1414

15-
const { Option } = Select;
16-
1715
const themeList = [
1816
{
1917
code: ThemeType.Light,
@@ -42,6 +40,13 @@ const themeList = [
4240
// },
4341
];
4442

43+
const languageOptions = [
44+
{ value: LangType.ZH_CN, label: '简体中文' },
45+
{ value: LangType.EN_US, label: 'English' },
46+
{ value: LangType.TR_TR, label: 'Turkish' },
47+
{ value: LangType.JA_JP, label: '日本語' },
48+
]
49+
4550
const colorList = [
4651
{
4752
code: 'golden-purple',
@@ -103,10 +108,10 @@ export default function BaseSetting() {
103108
};
104109

105110
function changeLang(e: any) {
106-
setLangLocalStorage(e.target.value);
111+
setLangLocalStorage(e);
107112
//切换语言时,需要设置cookie,用来改变后台服务的Locale
108113
const date = new Date('2030-12-30 12:30:00').toUTCString();
109-
document.cookie = `CHAT2DB.LOCALE=${e.target.value};Expires=${date}`;
114+
document.cookie = `CHAT2DB.LOCALE=${e};Expires=${date}`;
110115
location.reload();
111116
}
112117

@@ -118,10 +123,8 @@ export default function BaseSetting() {
118123
setCurrentTheme(backgroundColor);
119124
}
120125

121-
122-
const changeSqlEditorFontSize = (e: any) => {
123-
124-
}
126+
// const changeSqlEditorFontSize = (e: any) => {
127+
// }
125128

126129
return (
127130
<>
@@ -142,11 +145,17 @@ export default function BaseSetting() {
142145
</ul>
143146
<div className={styles.title}>{i18n('setting.title.language')}</div>
144147
<div className={styles.langBox}>
145-
<Radio.Group onChange={changeLang} value={currentLang}>
148+
{/* <Radio.Group onChange={changeLang} value={currentLang}>
146149
<Radio value={LangType.ZH_CN}>简体中文</Radio>
147150
<Radio value={LangType.EN_US}>English</Radio>
148151
<Radio value={LangType.TR_TR}>Turkish</Radio>
149-
</Radio.Group>
152+
</Radio.Group> */}
153+
<Select
154+
style={{ width: 120 }}
155+
onChange={changeLang}
156+
value={currentLang}
157+
options={languageOptions}
158+
/>
150159
</div>
151160
<div className={styles.title}>{i18n('setting.title.themeColor')}</div>
152161
<ul className={styles.primaryColorList}>

chat2db-client/src/components/ConsoleEditor/components/OperationLine/index.less

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
.runButton {
2727
display: flex;
28-
width: 70px;
2928
align-items: center;
3029
margin-right: 20px;
3130
height: 28px;

chat2db-client/src/constants/theme.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ export enum LangType {
2525
EN_US = 'en-us',
2626
ZH_CN = 'zh-cn',
2727
TR_TR = 'tr-tr',
28+
JA_JP = 'ja-jp',
2829
}

chat2db-client/src/i18n/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ import { getLang } from '@/utils/localStorage';
33
import { LangType } from '@/constants';
44
import zhCN from './zh-cn';
55
import enUS from './en-us';
6+
import trTR from './tr-tr';
7+
import jaJp from './ja-jp';
68

79
const locale = {
810
'en-us': enUS,
911
'zh-cn': zhCN,
12+
'tr-tr': trTR,
13+
'ja-jp': jaJp,
1014
};
1115

1216
export const currentLang: LangType = getLang() || LangType.EN_US;
@@ -17,6 +21,8 @@ export const isZH = currentLang === LangType.ZH_CN;
1721

1822
export const isTR = currentLang === LangType.TR_TR;
1923

24+
export const isJA = currentLang === LangType.JA_JP;
25+
2026
const langSet: Record<string, string> = locale[currentLang];
2127

2228
function i18n(key: keyof typeof zhCN, ...args: any[]) {
@@ -38,11 +44,11 @@ function i18n(key: keyof typeof zhCN, ...args: any[]) {
3844
}
3945

4046
function i18nElement(key: keyof typeof zhCN, ...args: React.ReactNode[]) {
41-
let str = langSet[key];
47+
const str = langSet[key];
4248
if (str === undefined) {
4349
return `[${key}]`;
4450
} else {
45-
let result: React.ReactNode[] = [];
51+
const result: React.ReactNode[] = [];
4652
str.split(/(\{\d\})/).forEach((item, i) => {
4753
if (/^\{\d\}$/.test(item)) {
4854
result.push(
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export default {
2+
'chat.input.remain': '残り {1} 回',
3+
'chat.input.tableSelect.placeholder': 'テーブルを選択してください',
4+
'chat.input.tableSelect.error.TooManyTable': '最大で8つのテーブルを選択できます',
5+
'chat.input.remain.dialog.tips': '公式アカウントをフォローし、"プロモーション"を送信して体験回数を増やす',
6+
'chat.input.syncTable.tips': 'すべてのテーブル構造をAIコンテキストに自動同期(Chat2DBAIモデルのみで使用可能、グループ内でグループオーナーに連絡し、Chat2DBAIのホワイトリストに申請)',
7+
'chat.input.remain.tooltip': '手動で選択したテーブルの構造はAIコンテキストに同期されます',
8+
'chat.input.syncTable.tempTips': '🎉リリース:すべてのテーブル構造をAIコンテキストに自動同期',
9+
};
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
export default {
2+
'common.text.no': 'いいえ',
3+
'common.text.is': 'は',
4+
'common.button.affirm': '確認する',
5+
'common.button.edit': '編集',
6+
'common.button.modify': '修正',
7+
'common.button.confirm': '確認',
8+
'common.button.cancel': 'キャンセル',
9+
'common.data.hour': '{1}時間',
10+
'common.data.minute': '{1}分',
11+
'common.tip.yesterday': '昨日{1}',
12+
'common.tip.tomorrow': '明日{1}',
13+
'common.tip.ago': '前',
14+
'common.tip.later': '後',
15+
'common.tip.now': '今',
16+
'common.tip.justNow': 'ちょうど今',
17+
'common.text.search': '検索',
18+
'common.placeholder.select': '{1}を選択してください',
19+
'common.text.serviceStarting': 'サービス開始中...',
20+
'common.text.serviceFail': 'サービスの開始に失敗しました',
21+
'common.text.column': '列',
22+
'common.text.row': '行',
23+
'common.text.indexes': 'インデックス',
24+
'common.button.save': '保存',
25+
'common.button.open': '開く',
26+
'common.button.refresh': '更新',
27+
'common.button.execute': '実行',
28+
"common.button.import": 'SQLをインポート',
29+
'common.button.format': 'フォーマット',
30+
'common.message.successfulConfig': '設定成功',
31+
'common.text.successful': '成功',
32+
'common.text.failure': '失敗',
33+
'common.message.modifySuccessfully': '修正成功',
34+
'common.message.addedSuccessfully': '追加成功',
35+
'common.text.custom': 'カスタム',
36+
'common.button.delete': '削除',
37+
'common.text.executionResult': '結果 {1}',
38+
'common.tips.deleteTable': 'このテーブルを削除してもよろしいですか?',
39+
'common.text.tableName': 'テーブル名',
40+
'common.text.submittedSuccessfully': '正常に送信されました',
41+
'common.text.successfullyDelete': '削除成功',
42+
'common.text.explainSQL': 'SQLを説明する',
43+
'common.text.optimizeSQL': 'SQLを最適化する',
44+
'common.text.conversionSQL': 'SQLを変換する',
45+
'common.text.table': 'テーブル',
46+
'common.tips.saveSuccessfully': '保存成功',
47+
'common.button.copy': 'コピー',
48+
'common.button.copyName': '名前をコピー',
49+
'common.button.copySuccessfully': 'コピー成功',
50+
'common.button.createConsole': '新しいコンソールを作成',
51+
'common.button.exportWord': 'Wordにエクスポート',
52+
'common.button.exportExcel': 'Excelにエクスポート',
53+
'common.button.exportHtml': 'Htmlにエクスポート',
54+
'common.button.exportMarkdown': 'Markdownにエクスポート',
55+
'common.button.exportPdf': 'Pdfにエクスポート',
56+
'common.text.successfulExecution': '実行成功',
57+
'common.text.result': '結果',
58+
'common.text.timeConsuming': '時間がかかる',
59+
'common.text.searchRow': '検索行数',
60+
'common.text.noData': 'データなし',
61+
'common.text.remindMeLater': '後でリマインド',
62+
'common.text.goToUpdate': '更新に進む',
63+
'common.text.updateReminder': '更新リマインダー',
64+
'common.text.detectionLatestVersion': '最新バージョンを検出',
65+
'common.text.setting': '設定',
66+
'common.text.tryToRestart': '再起動を試みる',
67+
'common.text.contactUs': 'お問い合わせ',
68+
'common.text.wechatPopularizeAi': 'WeChat公式アカウントをフォローし、「AI」を送信して無料体験を取得。',
69+
'common.text.wechatPopularizeAi2': 'WeChat公式アカウントをフォローし、「AI」を送信して無料でApiKeyを取得し、体験回数をプレゼント。',
70+
'common.text.wechatPopularize': '「プロモーション」を送信して、さらに無料体験を取得。',
71+
'common.text.export': 'エクスポート',
72+
'common.notification.detail': '詳細を見る',
73+
'common.notification.solution': '解決策',
74+
'common.button.copyError': 'エラーレポートをコピー',
75+
'common.button.copyErrorTips': '(ここではAPI情報と詳細なパラメータがコピーされます。機密情報がある場合は、JSONを解析してから送信してください)',
76+
'common.tips.formatError': 'フォーマット失敗、SQLが正しいかどうかを確認してください',
77+
'common.text.executeSelectedSQL': '選択したSQLを実行',
78+
'common.text.refreshPage': 'ページを更新',
79+
'common.text.saveConsole': 'コンソールを保存',
80+
'common.text.textToSQL': 'プレーンテキストをSQLに変換',
81+
'common.text.editorRightClick': 'エディタの右クリック',
82+
'common.form.error.required': '必須項目です!',
83+
'common.form.error.email': '正しいメール形式ではありません',
84+
'common.tips.delete.confirm': '削除してもよろしいですか?',
85+
'common.tips.updateSuccess': '更新成功',
86+
'common.tips.createSuccess': '作成成功',
87+
'common.text.action': '操作',
88+
'common.button.add': '追加',
89+
'common.text.errorMessage': 'エラーメッセージ',
90+
'common.button.cancelRequest': 'リクエストをキャンセル',
91+
'common.button.executionError': '実行エラー',
92+
'common.text.affectedRows': '影響を受けた行:{1}',
93+
'common.text.selectFile' : 'ファイルを選択',
94+
'common.text.noTableFoundUp' : '現在のデータベースにテーブルが見つかりません',
95+
'common.text.noTableFoundDown' : 'データベースを切り替えることができます',
96+
'common.text.updateNow' : 'すぐに更新',
97+
'common.title.preview' : 'プレビュー',
98+
'common.title.errorMessage': 'エラーメッセージ',
99+
'common.label.comment': 'コメント',
100+
'common.label.name': '名前',
101+
'common.title.create': '作成',
102+
'common.title.executiveLogging': '実行ログ',
103+
'common.text.executionTime': '{1}ms 完了',
104+
'common.button.copyRowAs': '行をコピー',
105+
'common.button.insertSql': 'Insert文',
106+
'common.button.updateSql': 'Update文',
107+
'common.button.tabularSeparatedValues': 'タブ区切り値',
108+
'common.button.tabularSeparatedValuesFieldName': 'タブ区切り値(フィールド名)',
109+
'common.button.tabularSeparatedValuesFieldNameAndData': 'タブ区切り値(フィールド名とデータ)',
110+
'common.button.cloneRow': '行を複製',
111+
'common.button.deleteRow': '行を削除',
112+
'common.button.setNull': 'NULLに設定',
113+
'common.button.setDefault': 'デフォルトに設定',
114+
'common.button.viewData': 'データを見る/修正する',
115+
'common.button.close': '閉じる',
116+
'common.button.closeAll': 'すべて閉じる',
117+
'common.button.closeOthers': '他を閉じる',
118+
'common.label.tcp': 'オンライン',
119+
'common.label.LocalFile': 'ローカルファイル',
120+
'common.text.rename': '名前を変更',
121+
};
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
export default {
2+
'connection.title': 'データソース',
3+
'connection.title.connections': '接続',
4+
'connection.title.createConnection': 'データソースを作成',
5+
'connection.title.editConnection': 'データソースを編集',
6+
'connection.title.importConnection': 'データソースをインポート',
7+
'connection.label.name': '名前',
8+
'connection.label.host': 'ホスト',
9+
'connection.label.authentication': '認証',
10+
'connection.label.database': 'データベース',
11+
'connection.label.JDBCDrive': 'JDBCドライバ',
12+
'connection.label.port': 'ポート',
13+
'connection.button.testConnection': '接続をテスト',
14+
'connection.label.advancedConfiguration': '高度な設定',
15+
'connection.label.sshConfiguration': 'SSH',
16+
'connection.button.addConnection': '接続を追加',
17+
'connection.button.connect': '接続',
18+
'connection.button.remove': '接続を削除',
19+
'connection.message.testConnectResult': '接続テスト{1}',
20+
'connection.message.testSshConnection': 'SSH接続をテスト',
21+
'connection.tableHeader.name': '名前',
22+
'connection.tableHeader.value': '値',
23+
'connection.title.uploadDriver': 'アップロード',
24+
'connection.tips.customUpload': 'ドライバをアップロード',
25+
'connection.title.driver': 'ドライバ',
26+
'connection.button.clickUpload': 'クリックしてアップロード',
27+
'connection.text.downloadDriver': 'ドライバをダウンロード',
28+
'connection.text.downloadSuccess': 'ダウンロード成功',
29+
'connection.text.tryAgainDownload': '再ダウンロードを試みる',
30+
'connection.text.downloading': 'ダウンロード中...',
31+
'connection.label.private': 'プライベート',
32+
'connection.label.shared': '共有',
33+
'connection.button.createConnection': '接続を作成',
34+
'connection.tips.noConnection': '現在、接続は作成されていません',
35+
'connection.tips.noConnectionTips': 'この接続の詳細を表示する権限がありませんが、直接接続することはできます',
36+
'connection.title.importTitle': 'ファイルをインポート, .ncx(navicat) または .dbp(dbever)',
37+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export default {
2+
"dashboard.title": "ダッシュボード",
3+
"dashboard.edit": "編集",
4+
"dashboard.modal.editTitle": "ダッシュボードの編集",
5+
"dashboard.modal.addTitle": "ダッシュボードの追加",
6+
"dashboard.modal.name.placeholder": "ダッシュボード名を入力してください",
7+
"dashboard.delete": "削除",
8+
"dashboard.export2image": "画像への出力",
9+
"dashboard.editor.cascader.placeholder": "接続を選択してください",
10+
"dashboard.editor.execute.noDataSource": "まず、データソースを選択してください",
11+
"dashboard.editor.execute.success": "実行成功。チャートの設定を選択してください"
12+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
export default {
2+
'editTable.tab.basicInfo': '基本情報',
3+
'editTable.tab.columnInfo': '列情報',
4+
'editTable.tab.indexInfo': 'インデックス情報',
5+
'editTable.label.tableName': 'テーブル名',
6+
'editTable.label.comment': 'コメント',
7+
'editTable.button.add': '追加',
8+
'editTable.button.delete': '削除',
9+
'editTable.button.up': '上に移動',
10+
'editTable.button.down': '下に移動',
11+
'editTable.label.indexName': 'インデックス名',
12+
'editTable.label.indexType': 'インデックスタイプ',
13+
'editTable.label.indexMethod': 'インデックス方法',
14+
'editTable.label.includeColumn': '含まれる列',
15+
'editTable.button.createTable': 'テーブルの作成',
16+
'editTable.button.importTable': 'テーブルのインポート',
17+
'editTable.label.index': '番号',
18+
'editTable.label.columnName': '列名',
19+
'editTable.label.columnSize': 'サイズ',
20+
'editTable.label.columnType': 'タイプ',
21+
'editTable.label.nullable': 'NULL可能',
22+
'editTable.label.prefixLength': '接頭辞の長さ',
23+
'editTable.label.defaultValue': 'デフォルト値',
24+
'editTable.label.sparse': 'スパース',
25+
'editTable.label.characterSet': '文字セット',
26+
'editTable.label.collation': '照合順序',
27+
'editTable.label.decimalPoint': '小数点',
28+
'editTable.label.unit': '単位',
29+
'editTable.label.value': '値',
30+
'editTable.label.autoIncrement': '自動増分',
31+
'editTable.label.engine': 'エンジン',
32+
'editTable.label.incrementValue': '増分値',
33+
'editTable.label.order': '順序',
34+
'editTable.label.primaryKey': '主キー',
35+
'editTable.title.sqlPreview': 'SQLプレビュー',
36+
'editTable.button.addColumn': '列を追加',
37+
'editTable.button.addIndex': 'インデックスを追加',
38+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
'editTableData.tips.addRow': '行を追加',
3+
'editTableData.tips.deleteRow': '行を削除',
4+
'editTableData.tips.revert': '取り消す',
5+
'editTableData.tips.previewPendingChanges': '保留中の変更をプレビュー',
6+
'editTableData.tips.submit': '変更を提出',
7+
};

0 commit comments

Comments
 (0)