Commit 588d80ec authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

fix: 修改部分翻译

parent 7ce5b41d
...@@ -9,21 +9,21 @@ const mockData = { ...@@ -9,21 +9,21 @@ const mockData = {
key: 'zh-CN', key: 'zh-CN',
icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/china.png' icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/china.png'
}, },
// { {
// name: 'English-EN', name: 'English-EN',
// key: 'en-US', key: 'en-US',
// icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/us.png' icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/us.png'
// }, },
// { // {
// name: '日本語-JP', // name: '日本語-JP',
// key: 'jp', // key: 'jp',
// icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/japen.png' // icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/japen.png'
// }, // },
// { {
// name: '한국어-KO', name: '한국어-KO',
// key: 'ko', key: 'ko-KR',
// icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/koren.png' icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/koren.png'
// } }
] ]
} }
} }
......
import { LogoutOutlined, LockOutlined } from '@ant-design/icons'; import { LogoutOutlined, LockOutlined } from '@ant-design/icons';
import { Avatar, Menu, Spin } from 'antd'; import { Avatar, Menu, Spin } from 'antd';
import React from 'react'; import React from 'react';
import { history, Link } from 'umi'; import { history, Link, useIntl } from 'umi';
import PersonDropdown from './PersonDropdown' import PersonDropdown from './PersonDropdown'
import styles from '../styles/RightContent.less'; import styles from '../styles/RightContent.less';
import { removeAuth, removeRouters, getAuth } from '@/utils/auth'; import { removeAuth, removeRouters, getAuth } from '@/utils/auth';
...@@ -9,8 +9,9 @@ import { inject, observer } from 'mobx-react' ...@@ -9,8 +9,9 @@ import { inject, observer } from 'mobx-react'
import Icon from '@ant-design/icons'; import Icon from '@ant-design/icons';
import { ReactComponent as DefaultAvatar } from '@/assets/imgs/default_avatar.svg'; import { ReactComponent as DefaultAvatar } from '@/assets/imgs/default_avatar.svg';
const AvatarDropdown = (props) => {
const AvatarDropdown = (props) => {
const intl = useIntl();
const logout = () => { const logout = () => {
removeAuth() removeAuth()
removeRouters() removeRouters()
...@@ -18,7 +19,7 @@ const AvatarDropdown = (props) => { ...@@ -18,7 +19,7 @@ const AvatarDropdown = (props) => {
} }
const currentUser = { const currentUser = {
name: getAuth()?.company || '未知用户', name: getAuth()?.company || intl.formatMessage({id: 'common.weizhiyonghu'}),
avatar: props.UserStore.avatar || '', avatar: props.UserStore.avatar || '',
} }
...@@ -34,11 +35,11 @@ const AvatarDropdown = (props) => { ...@@ -34,11 +35,11 @@ const AvatarDropdown = (props) => {
</Menu.Item> </Menu.Item>
<Menu.Divider /> */} <Menu.Divider /> */}
<Menu.Item key="changePwd"> <Menu.Item key="changePwd">
<Link to="/memberCenter/systemSetting/accountSetting"><LockOutlined />修改密码</Link> <Link to="/memberCenter/systemSetting/accountSetting"><LockOutlined />{intl.formatMessage({id: 'common.xiugaimima'})}</Link>
</Menu.Item> </Menu.Item>
<Menu.Item onClick={logout} key="logout"> <Menu.Item onClick={logout} key="logout">
<LogoutOutlined /> <LogoutOutlined />
退出登录 {intl.formatMessage({id: 'common.tuichudenglu'})}
</Menu.Item> </Menu.Item>
</Menu> </Menu>
) )
......
...@@ -70,23 +70,6 @@ interface countryItem { ...@@ -70,23 +70,6 @@ interface countryItem {
const HeaderDropdown: React.FC = () => { const HeaderDropdown: React.FC = () => {
// 此处暂时无接口, 对接接口后需用枚举类型做补充 // 此处暂时无接口, 对接接口后需用枚举类型做补充
const [currentLangKey, setCurrentLangKey] = useState<string>('cn') const [currentLangKey, setCurrentLangKey] = useState<string>('cn')
const [locales] = useState<countryItem[]>([
{
"name": "简体中文-ZH",
"key": "zh-CN",
"icon": ChinaImg
},
{
"name": "英文-US",
"key": "en-US",
"icon": us
},
{
"name": "韩文-KR",
"key": "ko-KR",
"icon": korenImg
},
])
useEffect(() => { useEffect(() => {
console.log(getLocale(), "locale") console.log(getLocale(), "locale")
setCurrentLangKey(getLocale()) setCurrentLangKey(getLocale())
...@@ -99,14 +82,7 @@ const HeaderDropdown: React.FC = () => { ...@@ -99,14 +82,7 @@ const HeaderDropdown: React.FC = () => {
const menuHeaderDropdown = ( const menuHeaderDropdown = (
<Menu selectedKeys={[]}> <Menu selectedKeys={[]}>
{ {
// GlobalConfig.publicSelect.siteList.map(v => <Menu.Item key={v.key} onClick={() => setLang(v)}> GlobalConfig.publicSelect.siteList.map(v => <Menu.Item key={v.key} onClick={() => setLang(v)}>
// <Space>
// {currentLangKey === v.key ? <img src={gou} style={{ width: 20, height: 20 }} /> : <div style={{ width: 20, height: 20 }}></div>}
// <img src={v.icon} style={{ width: 24, height: 17 }} />
// <span>{v.name}</span>
// </Space>
// </Menu.Item>)
locales.map(v => <Menu.Item key={v.key} onClick={() => setLang(v)}>
<Space> <Space>
{currentLangKey === v.key ? <img src={gou} style={{ width: 20, height: 20 }} /> : <div style={{ width: 20, height: 20 }}></div>} {currentLangKey === v.key ? <img src={gou} style={{ width: 20, height: 20 }} /> : <div style={{ width: 20, height: 20 }}></div>}
<img src={v.icon} style={{ width: 24, height: 17 }} /> <img src={v.icon} style={{ width: 24, height: 17 }} />
...@@ -125,12 +101,7 @@ const HeaderDropdown: React.FC = () => { ...@@ -125,12 +101,7 @@ const HeaderDropdown: React.FC = () => {
const renderCurrentLang = () => { const renderCurrentLang = () => {
let currentLang: countryItem let currentLang: countryItem
// GlobalConfig.publicSelect.siteList.map(item => { GlobalConfig.publicSelect.siteList.map(item => {
// if (item.key === currentLangKey) {
// currentLang = item
// }
// })
locales.map(item => {
if (item.key === currentLangKey) { if (item.key === currentLangKey) {
currentLang = item currentLang = item
} }
......
...@@ -4,7 +4,7 @@ import React, { useCallback, useRef, useLayoutEffect, useState, useEffect, useMe ...@@ -4,7 +4,7 @@ import React, { useCallback, useRef, useLayoutEffect, useState, useEffect, useMe
import Avatar from './AvatarDropdown'; import Avatar from './AvatarDropdown';
import SelectLang from './SelectLang'; import SelectLang from './SelectLang';
import Location from './Location'; import Location from './Location';
import { history, Link } from 'umi' import { history, Link, useIntl } from 'umi'
import Roles from './Roles'; import Roles from './Roles';
import { inject, observer } from 'mobx-react' import { inject, observer } from 'mobx-react'
import styles from '../styles/RightContent.less'; import styles from '../styles/RightContent.less';
...@@ -40,6 +40,7 @@ type WsMessage = { ...@@ -40,6 +40,7 @@ type WsMessage = {
} }
const GlobalHeaderRight: React.FC<{ SiteStore?: any, isHome: boolean }> = (props) => { const GlobalHeaderRight: React.FC<{ SiteStore?: any, isHome: boolean }> = (props) => {
const intl = useIntl();
const { SiteStore: { currentLayoutInfo }, isHome } = props; const { SiteStore: { currentLayoutInfo }, isHome } = props;
const [message, setMessage] = useState<number>(0); const [message, setMessage] = useState<number>(0);
const className = styles.right; const className = styles.right;
...@@ -119,11 +120,11 @@ const GlobalHeaderRight: React.FC<{ SiteStore?: any, isHome: boolean }> = (props ...@@ -119,11 +120,11 @@ const GlobalHeaderRight: React.FC<{ SiteStore?: any, isHome: boolean }> = (props
</Link> </Link>
</div> </div>
<div className={styles.rightContent}> <div className={styles.rightContent}>
<span style={{ color: 'rgba(0, 0, 0, 0.85)', cursor: "pointer" }} onClick={handleBackMall}>返回商城</span> <span style={{ color: 'rgba(0, 0, 0, 0.85)', cursor: "pointer" }} onClick={handleBackMall}>{intl.formatMessage({id: 'common.fanhuishangcheng'})}</span>
<Roles /> <Roles />
{/* <Location /> */} {/* <Location /> */}
<SelectLang /> <SelectLang />
<Tooltip title="消息"> <Tooltip title={intl.formatMessage({id: 'common.xiaoxi'})}>
<Link <Link
to="/memberCenter/systemSetting/message" to="/memberCenter/systemSetting/message"
className={styles.action} className={styles.action}
......
...@@ -33,7 +33,7 @@ const Roles: React.FC = () => { ...@@ -33,7 +33,7 @@ const Roles: React.FC = () => {
} }
const msg = message.loading({ const msg = message.loading({
content: '正在切换角色...', content: intl.formatMessage({id: 'common.zhengzaiqiehuanjuese'}),
duration: 0, duration: 0,
}); });
......
...@@ -19,23 +19,6 @@ interface countryItem { ...@@ -19,23 +19,6 @@ interface countryItem {
const SelectLang: React.FC = () => { const SelectLang: React.FC = () => {
// 此处暂时无接口, 对接接口后需用枚举类型做补充 // 此处暂时无接口, 对接接口后需用枚举类型做补充
const [currentLangKey, setCurrentLangKey] = useState<string>('cn') const [currentLangKey, setCurrentLangKey] = useState<string>('cn')
const [locales] = useState<countryItem[]>([
{
"name": "简体中文-ZH",
"key": "zh-CN",
"icon": ChinaImg
},
{
"name": "英文-US",
"key": "en-US",
"icon": us
},
{
"name": "韩文-KR",
"key": "ko-KR",
"icon": korenImg
},
])
useEffect(() => { useEffect(() => {
console.log(getLocale(), "locale") console.log(getLocale(), "locale")
setCurrentLangKey(getLocale()) setCurrentLangKey(getLocale())
...@@ -48,14 +31,7 @@ const SelectLang: React.FC = () => { ...@@ -48,14 +31,7 @@ const SelectLang: React.FC = () => {
const menuHeaderDropdown = ( const menuHeaderDropdown = (
<Menu selectedKeys={[]}> <Menu selectedKeys={[]}>
{ {
// GlobalConfig.publicSelect.siteList.map(v => <Menu.Item key={v.key} onClick={() => setLang(v)}> GlobalConfig.publicSelect.siteList.map(v => <Menu.Item key={v.key} onClick={() => setLang(v)}>
// <Space>
// {currentLangKey === v.key ? <img src={gou} style={{ width: 20, height: 20 }} /> : <div style={{ width: 20, height: 20 }}></div>}
// <img src={v.icon} style={{ width: 24, height: 17 }} />
// <span>{v.name}</span>
// </Space>
// </Menu.Item>)
locales.map(v => <Menu.Item key={v.key} onClick={() => setLang(v)}>
<Space> <Space>
{currentLangKey === v.key ? <img src={gou} style={{ width: 20, height: 20 }} /> : <div style={{ width: 20, height: 20 }}></div>} {currentLangKey === v.key ? <img src={gou} style={{ width: 20, height: 20 }} /> : <div style={{ width: 20, height: 20 }}></div>}
<img src={v.icon} style={{ width: 24, height: 17 }} /> <img src={v.icon} style={{ width: 24, height: 17 }} />
...@@ -74,12 +50,7 @@ const SelectLang: React.FC = () => { ...@@ -74,12 +50,7 @@ const SelectLang: React.FC = () => {
const renderCurrentLang = () => { const renderCurrentLang = () => {
let currentLang: countryItem let currentLang: countryItem
// GlobalConfig.publicSelect.siteList.map(item => { GlobalConfig.publicSelect.siteList.map(item => {
// if (item.key === currentLangKey) {
// currentLang = item
// }
// })
locales.map(item => {
if (item.key === currentLangKey) { if (item.key === currentLangKey) {
currentLang = item currentLang = item
} }
......
...@@ -6,6 +6,7 @@ import { isString } from '@/utils/type'; ...@@ -6,6 +6,7 @@ import { isString } from '@/utils/type';
import { getCookie } from '@/utils/cookie' import { getCookie } from '@/utils/cookie'
import HeaderDropdown from './HeaderDropdown'; import HeaderDropdown from './HeaderDropdown';
import { useIntl } from 'umi';
export interface UserHeaderProps { export interface UserHeaderProps {
logo?: React.ReactNode, logo?: React.ReactNode,
...@@ -16,6 +17,7 @@ export interface UserHeaderProps { ...@@ -16,6 +17,7 @@ export interface UserHeaderProps {
* 登录、注册等用户头部 * 登录、注册等用户头部
*/ */
const UserHeader: React.FC<UserHeaderProps> = (props) => { const UserHeader: React.FC<UserHeaderProps> = (props) => {
const intl = useIntl();
const { pathname } = props?.location || {} const { pathname } = props?.location || {}
const [title, setTitle] = useState<string>() const [title, setTitle] = useState<string>()
...@@ -26,14 +28,14 @@ const UserHeader: React.FC<UserHeaderProps> = (props) => { ...@@ -26,14 +28,14 @@ const UserHeader: React.FC<UserHeaderProps> = (props) => {
const getRouteName = () => { const getRouteName = () => {
switch (pathname) { switch (pathname) {
case '/user/login': case '/user/login':
setTitle("欢迎登录") setTitle(intl.formatMessage({id: 'common.huanyingdenglu'}))
break break
case '/user/register': case '/user/register':
setTitle("欢迎注册") setTitle(intl.formatMessage({id: 'common.huanyingzhuce'}))
break break
case '/user/getBack': case '/user/getBack':
case '/user/forget': case '/user/forget':
setTitle("找回密码") setTitle(intl.formatMessage({id: 'common.zhaohuimima'}))
break break
} }
} }
......
...@@ -100,5 +100,14 @@ ...@@ -100,5 +100,14 @@
/** other */ /** other */
'common.money':'¥', 'common.money':'¥',
'common.money.yuan':'元', 'common.money.yuan':'yuan',
} 'common.weizhiyonghu': 'Unknown user',
\ No newline at end of file 'common.xiugaimima': 'Change the password',
'common.tuichudenglu': 'Log out',
'common.xiaoxi': 'The message',
'common.fanhuishangcheng': 'Return to the mall',
'common.zhengzaiqiehuanjuese': 'Switching roles...',
'common.zhaohuimima': 'Retrieve password',
'common.huanyingzhuce': 'Welcome to register',
'common.huanyingdenglu': 'Welcome to login',
}
...@@ -101,4 +101,13 @@ export default { ...@@ -101,4 +101,13 @@ export default {
/** 其他 */ /** 其他 */
'common.money': '¥', 'common.money': '¥',
'common.money.yuan': '원.', 'common.money.yuan': '원.',
'common.weizhiyonghu': '알 수 없는 사용자',
'common.xiugaimima': '비밀번호 변경',
'common.tuichudenglu': '로그아웃',
'common.xiaoxi': '소식',
'common.fanhuishangcheng': '귀환 쇼핑몰',
'common.zhengzaiqiehuanjuese': '역할 전환 중...',
'common.zhaohuimima': '비밀번호 찾기',
'common.huanyingzhuce': '등록을 환영합니다',
'common.huanyingdenglu': '로그인을 환영합니다',
} }
...@@ -101,4 +101,13 @@ export default { ...@@ -101,4 +101,13 @@ export default {
/** 其他 */ /** 其他 */
'common.money': '¥', 'common.money': '¥',
'common.money.yuan': '元', 'common.money.yuan': '元',
'common.weizhiyonghu': '未知用户',
'common.xiugaimima': '修改密码',
'common.tuichudenglu': '退出登录',
'common.xiaoxi': '消息',
'common.fanhuishangcheng': '返回商城',
'common.zhengzaiqiehuanjuese': '正在切换角色...',
'common.zhaohuimima': '找回密码',
'common.huanyingzhuce': '欢迎注册',
'common.huanyingdenglu': '欢迎登录',
} }
...@@ -349,7 +349,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -349,7 +349,7 @@ const viewProducts: React.FC<{}> = () => {
productDetail?.logistics?.carriageType && productDetail?.logistics?.carriageType &&
<Row> <Row>
<Col span={4}> <Col span={4}>
<p>{intl.formatMessage({ id: 'commodity.products.viewProducts.card.3.carriageType' })}</p> <p>{intl.formatMessage({ id: 'commodity.products.viewProducts.card.3.carriageTypeLabel' })}</p>
</Col> </Col>
<Col span={20}> <Col span={20}>
<p>{carriageTypeLabel[productDetail?.logistics?.carriageType]}</p> <p>{carriageTypeLabel[productDetail?.logistics?.carriageType]}</p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment