Search code examples
reactjsantdant-design-pro

How to change button text language on protable filters in Ant Design Pro


I have a pro-table in ant design in which Ienter image description here want to apply filtering. However, the action buttons on the filters are always in Chinese as shown in the attached image. I want to change them to English. I would really appreciate any help.

Here is my code snippet:

const columns:ProColumns<GithubIssueItem>[]=[
       {      
        dataIndex: 'condition',
        title: 'Condition',
        ellipsis: true,
        // valueType: "select",
        filters: true,
        onFilter: true,
        valueEnum: {
          all: { text: "Okay", status: "Default" },
          open: {
            text: "unresolved",
            status: "Error",
          },
          closed: {
            text: "resolved",
            status: "Success",
            disabled: true,
          },
          processing: {
            text: "solving",
            status: "Processing",
          },
        },
      },
    ...
   ]

Solution

  • Alternative solution (other solutions didn't work for me):

    import { ConfigProvider } from '@ant-design/pro-provider';
    
    <ConfigProvider
      value={{
        intl: enUSIntl,
      }}
    >
      <ProTable />
    </ConfigProvider>;
    

    It can be declared in the main file (app.js for example) and it will change the language of all the pro components. Found here.