mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
chore: add i18n support for ai confirm modal (#8116)
This commit is contained in:
@@ -410,17 +410,25 @@ const AISettings = () => {
|
||||
const onToggleAI = useCallback(
|
||||
(checked: boolean) => {
|
||||
openConfirmModal({
|
||||
title: checked ? 'Enable AI?' : 'Disable AI?',
|
||||
description: `Are you sure you want to ${checked ? 'enable' : 'disable'} AI?`,
|
||||
confirmText: checked ? 'Enable' : 'Disable',
|
||||
cancelText: 'Cancel',
|
||||
title: checked
|
||||
? t['com.affine.settings.editorSettings.general.ai.enable.title']()
|
||||
: t['com.affine.settings.editorSettings.general.ai.disable.title'](),
|
||||
description: checked
|
||||
? t[
|
||||
'com.affine.settings.editorSettings.general.ai.enable.description'
|
||||
]()
|
||||
: t[
|
||||
'com.affine.settings.editorSettings.general.ai.disable.description'
|
||||
](),
|
||||
confirmText: checked ? t['Enable']() : t['Disable'](),
|
||||
cancelText: t['Cancel'](),
|
||||
onConfirm: () => onAIChange(checked),
|
||||
confirmButtonOptions: {
|
||||
variant: checked ? 'primary' : 'error',
|
||||
},
|
||||
});
|
||||
},
|
||||
[openConfirmModal, onAIChange]
|
||||
[openConfirmModal, t, onAIChange]
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { ConfirmModal, NotificationCenter, notify } from '@affine/component';
|
||||
import { events } from '@affine/electron-api';
|
||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||
import { useI18n } from '@affine/i18n';
|
||||
import {
|
||||
GlobalContextService,
|
||||
useLiveData,
|
||||
@@ -185,6 +186,7 @@ export const SignOutConfirmModal = () => {
|
||||
};
|
||||
|
||||
export const AIReloadConfirmModal = () => {
|
||||
const t = useI18n();
|
||||
const editorSettingService = useService(EditorSettingService);
|
||||
const enableAI = useLiveData(
|
||||
editorSettingService.editorSetting.settings$.selector(s => s.enableAI)
|
||||
@@ -208,12 +210,14 @@ export const AIReloadConfirmModal = () => {
|
||||
confirmButtonOptions={{
|
||||
variant: 'primary',
|
||||
}}
|
||||
title={'You need to reload the page'}
|
||||
description={
|
||||
'AI settings have been updated. Please reload the page to apply the changes.'
|
||||
}
|
||||
cancelText={'Cancel'}
|
||||
confirmText={'Reload'}
|
||||
title={t['com.affine.settings.editorSettings.general.ai.reload.title']()}
|
||||
description={t[
|
||||
'com.affine.settings.editorSettings.general.ai.reload.description'
|
||||
]()}
|
||||
cancelText={t['Cancel']()}
|
||||
confirmText={t[
|
||||
'com.affine.settings.editorSettings.general.ai.reload.confirm'
|
||||
]()}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user