update i18n

This commit is contained in:
JimmFly
2022-08-30 10:32:52 +08:00
parent 0bda0feb83
commit e656941084
7 changed files with 64 additions and 68 deletions
@@ -17,12 +17,13 @@ const _defaultTabsKeys = ['layout', 'comment', 'settings'] as const;
export const ContainerTabs = () => {
const { activeCommentId, resolveComment } = useActiveComment();
const { t } = useTranslation();
const getSettingsTabsData = useCallback((): SettingsTabItemType[] => {
return [
{
type: 'layout',
text: 'Layout',
text: t('Setting.Layout'),
icon: (
<IconWrapper>
<LayoutIcon />
@@ -32,7 +33,7 @@ export const ContainerTabs = () => {
},
{
type: 'comment',
text: 'Comment',
text: t('Setting.Comment'),
icon: (
<IconWrapper>
<CommentIcon />
@@ -49,7 +50,7 @@ export const ContainerTabs = () => {
},
{
type: 'settings',
text: 'Settings',
text: t('Setting.Settings'),
icon: (
<IconWrapper>
<SettingsIcon />
@@ -68,7 +69,6 @@ export const ContainerTabs = () => {
_defaultTabsKeys as unknown as string[],
'settings'
);
const { t } = useTranslation();
return (
<>
<StyledTabsTitlesContainer>
@@ -76,7 +76,7 @@ export const ContainerTabs = () => {
const { type, text, icon } = tab;
return (
<TabItemTitle
title={t(`stetting.${text}.title`)}
title={text}
icon={icon}
isActive={activeTab === type}
onClick={() => {
@@ -12,8 +12,8 @@ import { useSettings } from './use-settings';
export const SettingsList = () => {
const settings = useSettings();
const { t, i18n } = useTranslation();
const changeLanguage = (event: any) => {
const { i18n } = useTranslation();
const changeLanguage = event => {
i18n.changeLanguage(event);
};
@@ -45,7 +45,7 @@ export const SettingsList = () => {
return (
<ListItem key={item.name} onClick={() => item.onClick()}>
{t(`stetting.Settings.${item.name}`)}
{item.name}
{item.name === 'Language' ? (
<div style={{ marginLeft: '12em' }}>
<Select
@@ -1,9 +1,10 @@
import { message } from '@toeverything/components/ui';
import { copyToClipboard } from '@toeverything/utils';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import { useSettingFlags, type SettingFlags } from './use-setting-flags';
import {
// useReadingMode,
clearWorkspace,
duplicatePage,
exportHtml,
@@ -64,6 +65,7 @@ export const useSettings = (): SettingItem[] => {
const { workspaceId, pageId } = useWorkspaceAndPageId();
const navigate = useNavigate();
const settingFlags = useSettingFlags();
const { t } = useTranslation();
// const { toggleReadingMode, readingMode } = useReadingMode();
const settings: SettingItem[] = [
@@ -80,7 +82,7 @@ export const useSettings = (): SettingItem[] => {
// },
{
type: 'button',
name: 'Duplicate Page',
name: t('Setting.Settings.Duplicate Page'),
onClick: async () => {
const newPageInfo = await duplicatePage({
workspaceId,
@@ -91,7 +93,7 @@ export const useSettings = (): SettingItem[] => {
},
{
type: 'button',
name: 'Copy Page Link',
name: t('Setting.Settings.Copy Page Link'),
onClick: () => {
copyToClipboard(window.location.href);
message.success('Page link copied successfully');
@@ -99,9 +101,9 @@ export const useSettings = (): SettingItem[] => {
},
{
type: 'button',
name: 'Language',
name: t('Setting.Settings.Language'),
onClick: () => {
console.log('Language is change');
//Do noting
},
},
{
@@ -148,7 +150,7 @@ export const useSettings = (): SettingItem[] => {
},
{
type: 'button',
name: 'Clear Workspace',
name: t('Setting.Settings.Clear Workspace'),
onClick: () => clearWorkspace(workspaceId),
flag: 'booleanClearWorkspace',
},