Skip to content

Commit

Permalink
UI: Add a whitelist in i18next to fix the issue #675 (#677)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsyh authored Jul 13, 2020
1 parent 0b4ca2a commit df16fb0
Show file tree
Hide file tree
Showing 22 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Thank you to all the people who already contributed to TiDB Dashboard!

<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

## Architecture
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion ui/lib/components/ColumnsSelector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const translations = {
select: 'Select',
reset: 'Reset',
},
'zh-CN': {
zh: {
trigger_text: '选择列',
select: '选择',
reset: '重置',
Expand Down
2 changes: 1 addition & 1 deletion ui/lib/components/CopyLink/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const translations = {
text: 'Copy',
success: 'Copied',
},
'zh-CN': {
zh: {
text: '复制',
success: '已复制',
},
Expand Down
2 changes: 1 addition & 1 deletion ui/lib/components/DateTime/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion ui/lib/components/Expand/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const translations = {
expandText: 'Expand',
collapseText: 'Collapse',
},
'zh-CN': {
zh: {
expandText: '展开',
collapseText: '收起',
},
Expand Down
2 changes: 1 addition & 1 deletion ui/lib/components/InstanceSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const translations = {
status: 'Status',
},
},
'zh-CN': {
zh: {
placeholder: '选择实例',
filterPlaceholder: '过滤实例',
selected: {
Expand Down
2 changes: 1 addition & 1 deletion ui/lib/components/InstanceStatusBadge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const translations = {
unreachable: 'Unreachable',
},
},
'zh-CN': {
zh: {
status: {
up: '在线',
down: '离线',
Expand Down
2 changes: 1 addition & 1 deletion ui/lib/components/MultiSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const translations = {
selected: '{{n}} selected',
columnTitle: 'Items',
},
'zh-CN': {
zh: {
filterPlaceholder: '过滤',
selected: '已选择 {{n}} 项',
columnTitle: '选择项',
Expand Down
3 changes: 2 additions & 1 deletion ui/lib/utils/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function addTranslationResource(lang, translations) {
}

export const ALL_LANGUAGES = {
'zh-CN': '简体中文',
zh: '简体中文',
en: 'English',
}

Expand All @@ -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,
},
Expand Down
2 changes: 1 addition & 1 deletion ui/lib/utils/tableColumns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const translations = {
time: 'Time',
desc: 'Description',
},
'zh-CN': {
zh: {
name: '名称',
value: '值',
time: '时间',
Expand Down
2 changes: 1 addition & 1 deletion ui/src/setupProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down

0 comments on commit df16fb0

Please sign in to comment.