React & TypeScript/React

[React / Ant Design] Ant Design에서 Calendar Localization 하는 법

yoonjong Park 2022. 12. 19.

Antd ConfigProvider 적용

import React from "react";
import AppLayout from "./components/AppLayout/AppLayout";
import { ConfigProvider } from "antd";

import "dayjs/locale/ko";  // 1번
import koKR from "antd/locale/ko_KR";  // 2번

const App = () => {

  return (
    <>
      <ConfigProvider locale={koKR}>
        <AppLayout/>
      </ConfigProvider>
    </>
  );
};

export default App;

1번 라인 : Jan~Dec -> 1월 ~ 12월로 표현 바뀜 (세부목록은 json 참고)

2번 라인 : 전체 placeHolder 가 적용되는 것

참고

https://cdn.jsdelivr.net/npm/dayjs@1/locale.json

https://ant.design/docs/react/i18n

 

Internationalization - Ant Design

The default language of [email protected] is currently English. If you wish to use other languages, follow the instructions below. ConfigProvider antd provides a React Component ConfigProvider for configuring antd locale text globally. import { ConfigProv

ant.design

 

댓글