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

fix: 修改部分翻译

parent 7ce5b41d
......@@ -9,21 +9,21 @@ const mockData = {
key: 'zh-CN',
icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/china.png'
},
// {
// name: 'English-EN',
// key: 'en-US',
// icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/us.png'
// },
{
name: 'English-EN',
key: 'en-US',
icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/us.png'
},
// {
// name: '日本語-JP',
// key: 'jp',
// icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/japen.png'
// },
// {
// name: '한국어-KO',
// key: 'ko',
// icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/koren.png'
// }
{
name: '한국어-KO',
key: 'ko-KR',
icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/koren.png'
}
]
}
}
......
import { LogoutOutlined, LockOutlined } from '@ant-design/icons';
import { Avatar, Menu, Spin } from 'antd';
import React from 'react';
import { history, Link } from 'umi';
import { history, Link, useIntl } from 'umi';
import PersonDropdown from './PersonDropdown'
import styles from '../styles/RightContent.less';
import { removeAuth, removeRouters, getAuth } from '@/utils/auth';
......@@ -9,8 +9,9 @@ import { inject, observer } from 'mobx-react'
import Icon from '@ant-design/icons';
import { ReactComponent as DefaultAvatar } from '@/assets/imgs/default_avatar.svg';
const AvatarDropdown = (props) => {
const AvatarDropdown = (props) => {
const intl = useIntl();
const logout = () => {
removeAuth()
removeRouters()
......@@ -18,7 +19,7 @@ const AvatarDropdown = (props) => {
}
const currentUser = {
name: getAuth()?.company || '未知用户',
name: getAuth()?.company || intl.formatMessage({id: 'common.weizhiyonghu'}),
avatar: props.UserStore.avatar || '',
}
......@@ -34,11 +35,11 @@ const AvatarDropdown = (props) => {
</Menu.Item>
<Menu.Divider /> */}
<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 onClick={logout} key="logout">
<LogoutOutlined />
退出登录
{intl.formatMessage({id: 'common.tuichudenglu'})}
</Menu.Item>
</Menu>
)
......
......@@ -70,23 +70,6 @@ interface countryItem {
const HeaderDropdown: React.FC = () => {
// 此处暂时无接口, 对接接口后需用枚举类型做补充
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(() => {
console.log(getLocale(), "locale")
setCurrentLangKey(getLocale())
......@@ -99,14 +82,7 @@ const HeaderDropdown: React.FC = () => {
const menuHeaderDropdown = (
<Menu selectedKeys={[]}>
{
// 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)}>
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 }} />
......@@ -125,12 +101,7 @@ const HeaderDropdown: React.FC = () => {
const renderCurrentLang = () => {
let currentLang: countryItem
// GlobalConfig.publicSelect.siteList.map(item => {
// if (item.key === currentLangKey) {
// currentLang = item
// }
// })
locales.map(item => {
GlobalConfig.publicSelect.siteList.map(item => {
if (item.key === currentLangKey) {
currentLang = item
}
......
......@@ -4,7 +4,7 @@ import React, { useCallback, useRef, useLayoutEffect, useState, useEffect, useMe
import Avatar from './AvatarDropdown';
import SelectLang from './SelectLang';
import Location from './Location';
import { history, Link } from 'umi'
import { history, Link, useIntl } from 'umi'
import Roles from './Roles';
import { inject, observer } from 'mobx-react'
import styles from '../styles/RightContent.less';
......@@ -40,6 +40,7 @@ type WsMessage = {
}
const GlobalHeaderRight: React.FC<{ SiteStore?: any, isHome: boolean }> = (props) => {
const intl = useIntl();
const { SiteStore: { currentLayoutInfo }, isHome } = props;
const [message, setMessage] = useState<number>(0);
const className = styles.right;
......@@ -119,11 +120,11 @@ const GlobalHeaderRight: React.FC<{ SiteStore?: any, isHome: boolean }> = (props
</Link>
</div>
<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 />
{/* <Location /> */}
<SelectLang />
<Tooltip title="消息">
<Tooltip title={intl.formatMessage({id: 'common.xiaoxi'})}>
<Link
to="/memberCenter/systemSetting/message"
className={styles.action}
......
......@@ -33,7 +33,7 @@ const Roles: React.FC = () => {
}
const msg = message.loading({
content: '正在切换角色...',
content: intl.formatMessage({id: 'common.zhengzaiqiehuanjuese'}),
duration: 0,
});
......
......@@ -19,23 +19,6 @@ interface countryItem {
const SelectLang: React.FC = () => {
// 此处暂时无接口, 对接接口后需用枚举类型做补充
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(() => {
console.log(getLocale(), "locale")
setCurrentLangKey(getLocale())
......@@ -48,14 +31,7 @@ const SelectLang: React.FC = () => {
const menuHeaderDropdown = (
<Menu selectedKeys={[]}>
{
// 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)}>
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 }} />
......@@ -74,12 +50,7 @@ const SelectLang: React.FC = () => {
const renderCurrentLang = () => {
let currentLang: countryItem
// GlobalConfig.publicSelect.siteList.map(item => {
// if (item.key === currentLangKey) {
// currentLang = item
// }
// })
locales.map(item => {
GlobalConfig.publicSelect.siteList.map(item => {
if (item.key === currentLangKey) {
currentLang = item
}
......
......@@ -6,6 +6,7 @@ import { isString } from '@/utils/type';
import { getCookie } from '@/utils/cookie'
import HeaderDropdown from './HeaderDropdown';
import { useIntl } from 'umi';
export interface UserHeaderProps {
logo?: React.ReactNode,
......@@ -16,6 +17,7 @@ export interface UserHeaderProps {
* 登录、注册等用户头部
*/
const UserHeader: React.FC<UserHeaderProps> = (props) => {
const intl = useIntl();
const { pathname } = props?.location || {}
const [title, setTitle] = useState<string>()
......@@ -26,14 +28,14 @@ const UserHeader: React.FC<UserHeaderProps> = (props) => {
const getRouteName = () => {
switch (pathname) {
case '/user/login':
setTitle("欢迎登录")
setTitle(intl.formatMessage({id: 'common.huanyingdenglu'}))
break
case '/user/register':
setTitle("欢迎注册")
setTitle(intl.formatMessage({id: 'common.huanyingzhuce'}))
break
case '/user/getBack':
case '/user/forget':
setTitle("找回密码")
setTitle(intl.formatMessage({id: 'common.zhaohuimima'}))
break
}
}
......
......@@ -100,5 +100,14 @@
/** other */
'common.money':'¥',
'common.money.yuan':'元',
}
\ No newline at end of file
'common.money.yuan':'yuan',
'common.weizhiyonghu': 'Unknown user',
'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 {
/** 其他 */
'common.money': '¥',
'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 {
/** 其他 */
'common.money': '¥',
'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<{}> = () => {
productDetail?.logistics?.carriageType &&
<Row>
<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 span={20}>
<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