我试图在 antd 中翻译标题,modal.confirm()
但总是收到错误消息useLingui hook was used without I18nProvider
。在其他页面中,翻译工作正常。
这是我的代码:
async function onLogout() {
Modal.confirm({
title: <Trans>Confirm Logout</Trans>,
icon: <LogoutOutlined />,
content: <Trans>Are you sure you want to logout?</Trans>,
async onOk() {
const logout = await dispatch(logoutUser())
if (logout === "Success") {
history.push("/login")
}
},
})
}