From 0c487ab496334793c5dad1e6afdfbc4459297b06 Mon Sep 17 00:00:00 2001 From: Dreamacro <8615343+Dreamacro@users.noreply.github.com> Date: Tue, 3 Nov 2020 22:26:15 +0800 Subject: [PATCH] Fix: connections filter i18n --- src/containers/Connections/Devices/index.tsx | 10 ++++++++-- src/i18n/en_US.ts | 3 +++ src/i18n/zh_CN.ts | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/containers/Connections/Devices/index.tsx b/src/containers/Connections/Devices/index.tsx index d228676..2db3110 100644 --- a/src/containers/Connections/Devices/index.tsx +++ b/src/containers/Connections/Devices/index.tsx @@ -1,6 +1,7 @@ -import React from 'react' +import React, { useMemo } from 'react' import classnames from 'classnames' import { BaseComponentProps } from '@models' +import { useI18n } from '@stores' import './style.scss' interface DevicesProps extends BaseComponentProps { @@ -10,6 +11,9 @@ interface DevicesProps extends BaseComponentProps { } export function Devices (props: DevicesProps) { + const { translation } = useI18n() + const t = useMemo(() => translation('Connections').t, [translation]) + const { className, style } = props const classname = classnames('connections-devices', className) function handleSelected (label: string) { @@ -18,7 +22,9 @@ export function Devices (props: DevicesProps) { return (
-
handleSelected('')}>全部
+
handleSelected('')}> + { t('filter.all') } +
{ props.devices.map( device => ( diff --git a/src/i18n/en_US.ts b/src/i18n/en_US.ts index 057fe04..1179c22 100644 --- a/src/i18n/en_US.ts +++ b/src/i18n/en_US.ts @@ -60,6 +60,9 @@ const EN = { title: 'Warning', content: 'This would close all connections' }, + filter: { + all: 'All' + }, columns: { host: 'Host', network: 'Network', diff --git a/src/i18n/zh_CN.ts b/src/i18n/zh_CN.ts index 9ce6dd9..0b2832d 100644 --- a/src/i18n/zh_CN.ts +++ b/src/i18n/zh_CN.ts @@ -60,6 +60,9 @@ const CN = { title: '警告', content: '将会关闭所有连接' }, + filter: { + all: '全部' + }, columns: { host: '域名', network: '网络',