import React from "react" ; import styles from "./index.module.less" ; import { Card , Radio , RadioChangeEvent } from "antd" ; import { formatMessage , setLocale } from "../../components/locales" ; constructor const LocalePage = ( ) => { const [ value , setValue ] = React . useState ( localStorage . getItem ( "why__locale" ) || "zh-cn" ) ; const onChange = ( e ) => { setValue ( e . target . value ) ; setLocale ( e . target . value ) ; } ; return ( < Card title = { formatMessage ( { id : "switchLan" } ) } style = { { width : "500px" } } > < Radio . Group onChange = { onChange } value = { value } > < Radio value = { "zh-cn" } > { formatMessage ( { id : "switchToEn" } ) } < /Radio> < Radio value = { "en" } > { formatMessage ( { id : "switchToCh" } ) } < /Radio> < /Radio.Group> < div className = { styles . localLan } > { formatMessage ( { id : "localLan" } ) } react - intl < /div> < /Card>); } ; export default LocalePage ;