Skip to content

Commit dc0a877

Browse files
committedJan 25, 2025·
🌐 i18n: add zh-CN as gen source
1 parent de5cefb commit dc0a877

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed
 

‎src/app/(main)/profile/(home)/Client.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import AvatarWithUpload from '@/features/AvatarWithUpload';
99
import UserAvatar from '@/features/User/UserAvatar';
1010
import { useUserStore } from '@/store/user';
1111
import { authSelectors, userProfileSelectors } from '@/store/user/selectors';
12+
1213
import SSOProvidersList from './features/SSOProvidersList';
1314

1415
type SettingItemGroup = ItemGroup;
@@ -46,10 +47,10 @@ const Client = memo<{ mobile?: boolean }>(() => {
4647
{
4748
children: <SSOProvidersList />,
4849
hidden: !isLoginWithNextAuth,
49-
label: 'profile.sso.providers',
50-
minWidth: undefined,
50+
label: t('profile.sso.providers'),
51+
labelAlign: 'left',
5152
layout: 'vertical',
52-
labelAlign: 'left'
53+
minWidth: undefined,
5354
},
5455
],
5556
title: t('tab.profile'),

‎src/app/(main)/profile/(home)/features/SSOProvidersList/index.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ActionIcon, CopyButton, List } from '@lobehub/ui';
22
import { Popconfirm } from 'antd';
33
import { RotateCw, Unlink } from 'lucide-react';
44
import { memo, useState } from 'react';
5+
import { useTranslation } from 'react-i18next';
56
import { Flexbox } from 'react-layout-kit';
67

78
import { useOnlyFetchOnceSWR } from '@/libs/swr';
@@ -13,19 +14,24 @@ const { Item } = List;
1314

1415
export const SSOProvidersList = memo(() => {
1516
const [allowUnlink, setAllowUnlink] = useState<boolean>(false);
17+
1618
const { data, isLoading, mutate } = useOnlyFetchOnceSWR('profile-sso-providers', async () => {
1719
const list = await userService.getUserSSOProviders();
1820
setAllowUnlink(list?.length > 1);
1921
return list;
2022
});
23+
2124
const handleUnlinkSSO = async (provider: string, providerAccountId: string) => {
2225
await userService.unlinkSSOProvider(provider, providerAccountId);
2326
mutate();
2427
};
28+
29+
const { t } = useTranslation('auth');
30+
2531
return isLoading ? (
2632
<Flexbox align={'center'} gap={4} horizontal>
2733
<ActionIcon icon={RotateCw} spin />
28-
{'stats.modelsRank.loading'}
34+
{t('profile.sso.loading')}
2935
</Flexbox>
3036
) : (
3137
<Flexbox>
@@ -37,7 +43,7 @@ export const SSOProvidersList = memo(() => {
3743
<Popconfirm
3844
onConfirm={() => handleUnlinkSSO(item.provider, item.providerAccountId)}
3945
placement="topRight"
40-
title="Are you sure to unlink this account?"
46+
title={t('profile.sso.unlink', { provider: item.provider })}
4147
>
4248
<ActionIcon disable={!allowUnlink} icon={Unlink} size={'small'} />
4349
</Popconfirm>

‎src/locales/default/auth.ts

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ export default {
3434
profile: {
3535
avatar: '头像',
3636
email: '电子邮件地址',
37+
sso: {
38+
loading: '正在加载已绑定的第三方账户',
39+
providers: '第三方账户绑定',
40+
unlink: '是否解绑该第三方账户 {{provider}} ?',
41+
},
3742
username: '用户名',
3843
},
3944
signout: '退出登录',

0 commit comments

Comments
 (0)