diff --git a/README.md b/README.md index a010af1f27..addfd08eb4 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ Thank you to all the people who already contributed to TiDB Dashboard! + ## Architecture diff --git a/ui/dashboardApp/layout/translations/zh-CN.yaml b/ui/dashboardApp/layout/translations/zh.yaml similarity index 100% rename from ui/dashboardApp/layout/translations/zh-CN.yaml rename to ui/dashboardApp/layout/translations/zh.yaml diff --git a/ui/diagnoseReportApp/translations/zh-CN.yaml b/ui/diagnoseReportApp/translations/zh.yaml similarity index 100% rename from ui/diagnoseReportApp/translations/zh-CN.yaml rename to ui/diagnoseReportApp/translations/zh.yaml diff --git a/ui/lib/apps/ClusterInfo/translations/zh-CN.yaml b/ui/lib/apps/ClusterInfo/translations/zh.yaml similarity index 100% rename from ui/lib/apps/ClusterInfo/translations/zh-CN.yaml rename to ui/lib/apps/ClusterInfo/translations/zh.yaml diff --git a/ui/lib/apps/Diagnose/translations/zh-CN.yaml b/ui/lib/apps/Diagnose/translations/zh.yaml similarity index 100% rename from ui/lib/apps/Diagnose/translations/zh-CN.yaml rename to ui/lib/apps/Diagnose/translations/zh.yaml diff --git a/ui/lib/apps/InstanceProfiling/translations/zh-CN.yaml b/ui/lib/apps/InstanceProfiling/translations/zh.yaml similarity index 100% rename from ui/lib/apps/InstanceProfiling/translations/zh-CN.yaml rename to ui/lib/apps/InstanceProfiling/translations/zh.yaml diff --git a/ui/lib/apps/KeyViz/translations/zh-CN.yaml b/ui/lib/apps/KeyViz/translations/zh.yaml similarity index 100% rename from ui/lib/apps/KeyViz/translations/zh-CN.yaml rename to ui/lib/apps/KeyViz/translations/zh.yaml diff --git a/ui/lib/apps/Overview/translations/zh-CN.yaml b/ui/lib/apps/Overview/translations/zh.yaml similarity index 100% rename from ui/lib/apps/Overview/translations/zh-CN.yaml rename to ui/lib/apps/Overview/translations/zh.yaml diff --git a/ui/lib/apps/SearchLogs/translations/zh-CN.yaml b/ui/lib/apps/SearchLogs/translations/zh.yaml similarity index 100% rename from ui/lib/apps/SearchLogs/translations/zh-CN.yaml rename to ui/lib/apps/SearchLogs/translations/zh.yaml diff --git a/ui/lib/apps/SlowQuery/translations/zh-CN.yaml b/ui/lib/apps/SlowQuery/translations/zh.yaml similarity index 100% rename from ui/lib/apps/SlowQuery/translations/zh-CN.yaml rename to ui/lib/apps/SlowQuery/translations/zh.yaml diff --git a/ui/lib/apps/Statement/translations/zh-CN.yaml b/ui/lib/apps/Statement/translations/zh.yaml similarity index 100% rename from ui/lib/apps/Statement/translations/zh-CN.yaml rename to ui/lib/apps/Statement/translations/zh.yaml diff --git a/ui/lib/apps/UserProfile/translations/zh-CN.yaml b/ui/lib/apps/UserProfile/translations/zh.yaml similarity index 100% rename from ui/lib/apps/UserProfile/translations/zh-CN.yaml rename to ui/lib/apps/UserProfile/translations/zh.yaml diff --git a/ui/lib/components/ColumnsSelector/index.tsx b/ui/lib/components/ColumnsSelector/index.tsx index 7aa97215a5..185cf8bf1e 100644 --- a/ui/lib/components/ColumnsSelector/index.tsx +++ b/ui/lib/components/ColumnsSelector/index.tsx @@ -13,7 +13,7 @@ const translations = { select: 'Select', reset: 'Reset', }, - 'zh-CN': { + zh: { trigger_text: '选择列', select: '选择', reset: '重置', diff --git a/ui/lib/components/CopyLink/index.tsx b/ui/lib/components/CopyLink/index.tsx index 29214edf1f..7a395b51f9 100644 --- a/ui/lib/components/CopyLink/index.tsx +++ b/ui/lib/components/CopyLink/index.tsx @@ -16,7 +16,7 @@ const translations = { text: 'Copy', success: 'Copied', }, - 'zh-CN': { + zh: { text: '复制', success: '已复制', }, diff --git a/ui/lib/components/DateTime/Calendar.tsx b/ui/lib/components/DateTime/Calendar.tsx index c79ea392ae..5ea895b778 100644 --- a/ui/lib/components/DateTime/Calendar.tsx +++ b/ui/lib/components/DateTime/Calendar.tsx @@ -22,7 +22,7 @@ const translations = { lastWeek: '[Last] dddd h:mm A', sameElse: 'lll', }, - 'zh-CN': { + zh: { sameDay: '[今天] HH:mm', nextDay: '[明天] HH:mm', nextWeek: '[下]dddd HH:mm', diff --git a/ui/lib/components/Expand/index.tsx b/ui/lib/components/Expand/index.tsx index a46e9d9b7a..9c2b55c026 100644 --- a/ui/lib/components/Expand/index.tsx +++ b/ui/lib/components/Expand/index.tsx @@ -24,7 +24,7 @@ const translations = { expandText: 'Expand', collapseText: 'Collapse', }, - 'zh-CN': { + zh: { expandText: '展开', collapseText: '收起', }, diff --git a/ui/lib/components/InstanceSelect/index.tsx b/ui/lib/components/InstanceSelect/index.tsx index 8d99537543..9e672267e0 100644 --- a/ui/lib/components/InstanceSelect/index.tsx +++ b/ui/lib/components/InstanceSelect/index.tsx @@ -51,7 +51,7 @@ const translations = { status: 'Status', }, }, - 'zh-CN': { + zh: { placeholder: '选择实例', filterPlaceholder: '过滤实例', selected: { diff --git a/ui/lib/components/InstanceStatusBadge/index.tsx b/ui/lib/components/InstanceStatusBadge/index.tsx index 3af04b4587..06cbde9544 100644 --- a/ui/lib/components/InstanceStatusBadge/index.tsx +++ b/ui/lib/components/InstanceStatusBadge/index.tsx @@ -15,7 +15,7 @@ const translations = { unreachable: 'Unreachable', }, }, - 'zh-CN': { + zh: { status: { up: '在线', down: '离线', diff --git a/ui/lib/components/MultiSelect/index.tsx b/ui/lib/components/MultiSelect/index.tsx index 2926d1eb15..b4e747530f 100644 --- a/ui/lib/components/MultiSelect/index.tsx +++ b/ui/lib/components/MultiSelect/index.tsx @@ -18,7 +18,7 @@ const translations = { selected: '{{n}} selected', columnTitle: 'Items', }, - 'zh-CN': { + zh: { filterPlaceholder: '过滤', selected: '已选择 {{n}} 项', columnTitle: '选择项', diff --git a/ui/lib/utils/i18n.ts b/ui/lib/utils/i18n.ts index c102b50885..001504d06b 100644 --- a/ui/lib/utils/i18n.ts +++ b/ui/lib/utils/i18n.ts @@ -37,7 +37,7 @@ export function addTranslationResource(lang, translations) { } export const ALL_LANGUAGES = { - 'zh-CN': '简体中文', + zh: '简体中文', en: 'English', } @@ -47,6 +47,7 @@ i18next .init({ resources: {}, // oh! this line is a big pitfall, we can't remove it, else it will cause strange crash! fallbackLng: 'en', + whitelist: ['zh', 'en'], interpolation: { escapeValue: false, }, diff --git a/ui/lib/utils/tableColumns.tsx b/ui/lib/utils/tableColumns.tsx index 8217e4544e..581613a542 100644 --- a/ui/lib/utils/tableColumns.tsx +++ b/ui/lib/utils/tableColumns.tsx @@ -15,7 +15,7 @@ const translations = { time: 'Time', desc: 'Description', }, - 'zh-CN': { + zh: { name: '名称', value: '值', time: '时间', diff --git a/ui/src/setupProxy.js b/ui/src/setupProxy.js index ccc8d95bbd..aa14ca8cba 100644 --- a/ui/src/setupProxy.js +++ b/ui/src/setupProxy.js @@ -11,7 +11,7 @@ const dashboardApiPrefix = module.exports = function (app) { // Proxy the `data.js` trick to the backend server. // Proxy http://localhost:3001/dashboard/api/diagnose/reports/*/data.js to - // http://http://127.0.0.1:12333/dashboard/api/diagnose/reports/*/data.js + // http://127.0.0.1:12333/dashboard/api/diagnose/reports/*/data.js app.use( '/', createProxyMiddleware('/dashboard/api/diagnose/reports/*/data.js', {