Skip to content

Commit e6b8293

Browse files
committed
fix: Table chart locale
1 parent 9995f0d commit e6b8293

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

frontend/src/app/components/ChartGraph/BasicTableChart/AntdTableWrapper.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
* limitations under the License.
1717
*/
1818

19-
import { Table } from 'antd';
19+
import { ConfigProvider, Table } from 'antd';
20+
import { antdLocales } from 'locales/i18n';
2021
import { FC, memo } from 'react';
22+
import { useTranslation } from 'react-i18next';
2123
import styled from 'styled-components/macro';
2224

2325
interface TableStyleConfigProps {
@@ -47,6 +49,8 @@ const AntdTableWrapper: FC<{
4749
summaryFn?: (data) => { total: number; summarys: [] };
4850
}> = memo(
4951
({ dataSource, columns, children, summaryFn, tableStyleConfig, ...rest }) => {
52+
const { i18n } = useTranslation();
53+
5054
const getTableSummaryRow = pageData => {
5155
if (!summaryFn) {
5256
return undefined;
@@ -68,13 +72,15 @@ const AntdTableWrapper: FC<{
6872
};
6973

7074
return (
71-
<StyledTable
72-
{...rest}
73-
tableStyleConfig={tableStyleConfig}
74-
dataSource={dataSource}
75-
columns={columns}
76-
summary={getTableSummaryRow}
77-
/>
75+
<ConfigProvider locale={antdLocales[i18n.language]}>
76+
<StyledTable
77+
{...rest}
78+
tableStyleConfig={tableStyleConfig}
79+
dataSource={dataSource}
80+
columns={columns}
81+
summary={getTableSummaryRow}
82+
/>
83+
</ConfigProvider>
7884
);
7985
},
8086
);

0 commit comments

Comments
 (0)