diff options
| author | Larvan2 <[email protected]> | 2023-05-17 13:24:44 +0800 |
|---|---|---|
| committer | Larvan2 <[email protected]> | 2023-05-17 13:26:58 +0800 |
| commit | 6990a507d7986d0a468b0cbb1bfeea0054f75eb3 (patch) | |
| tree | efe8dd0cc52af7a957672558b65f730a5d69dcbb /src | |
| parent | e0cdaf91aa6d7ab98e84350f2f28fb3a4f86a585 (diff) | |
fix locale
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/ConnectionTable.tsx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/components/ConnectionTable.tsx b/src/components/ConnectionTable.tsx index 2b0a12a..6696fcd 100644 --- a/src/components/ConnectionTable.tsx +++ b/src/components/ConnectionTable.tsx @@ -1,6 +1,6 @@ import cx from 'clsx'; import { formatDistance, Locale } from 'date-fns'; -import { enUS, zhCN } from 'date-fns/locale'; +import { enUS, zhCN, zhTW } from 'date-fns/locale'; import React from 'react'; import { ChevronDown } from 'react-feather'; import { useTranslation } from 'react-i18next'; @@ -64,7 +64,16 @@ function Table({ data }) { ); const { t, i18n } = useTranslation(); - const locale = i18n.language === 'zh' ? zhCN : enUS; + + let locale: Locale; + + if (i18n.language === 'zh-cn') { + locale = zhCN; + } else if (i18n.language === 'zh-tw') { + locale = zhTW; + } else { + locale = enUS; + } return ( <div {...getTableProps()}> |
