@ckeditor/ckeditor5-ai
Version:
AI features for CKEditor 5.
140 lines (139 loc) • 3.41 kB
TypeScript
/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/
/**
* @module ai/aitranslate/aitranslate
* @publicApi
*/
import { ContextPlugin } from '@ckeditor/ckeditor5-core';
import { AITranslateController } from './aitranslatecontroller.js';
import { AITranslateUI } from './aitranslateui.js';
import { AIReviewCoreEditing } from '../aireviewcore/aireviewcoreediting.js';
/**
* The AI Translate feature.
*
* The Translate feature provides users with AI-powered translation for their content by automatically translating text
* into different languages.
*
* You can configure the feature by setting the {@link module:ai/aitranslate/aitranslate~AITranslateConfig} property.
*
* Learn more about AI features in CKEditor in the {@glink features/ai/ckeditor-ai-overview AI Overview} documentation.
*/
export declare class AITranslate extends ContextPlugin {
/**
* @inheritDoc
*/
static get requires(): readonly [typeof AITranslateController, typeof AITranslateUI, typeof AIReviewCoreEditing];
/**
* @inheritDoc
*/
static get pluginName(): "AITranslate";
/**
* @inheritDoc
*/
static get isOfficialPlugin(): true;
/**
* @inheritDoc
*/
static get isPremiumPlugin(): true;
}
/**
* The configuration of the {@link module:ai/aitranslate/aitranslate~AITranslate AI Translate feature}.
*
* The properties defined in this config are set in the `config.ai.translate` namespace.
*
* ```ts
* ClassicEditor
* .create( {
* ai: {
* translate: {
* // AI Translate configuration.
* }
* }
* } )
* .then( ... )
* .catch( ... );
* ```
*
* See {@link module:ai/aiconfig~AIConfig the full AI configuration}.
*
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
*/
export interface AITranslateConfig {
/**
* The list of languages available in the AI Translate feature.
*
* The list must be an array of objects containing the `id` and `label` properties like on example below:
*
* ```ts
* ClassicEditor
* .create( {
* ai: {
* translate: {
* languages: [
* {
* id: 'german',
* label: 'German'
* },
* {
* id: 'french',
* label: 'French'
* }
* ]
* }
* }
* } )
* .then( ... )
* .catch( ... );
* ```
*
* Languages available by default are:
*
* {
* label: 'English',
* id: 'english'
* },
* {
* label: 'Spanish',
* id: 'spanish'
* },
* {
* label: 'French',
* id: 'french'
* },
* {
* label: 'German',
* id: 'german'
* },
* {
* label: 'Chinese (Simplified)',
* id: 'chinese'
* },
* {
* label: 'Japanese',
* id: 'japanese'
* },
* {
* label: 'Russian',
* id: 'russian'
* },
* {
* label: 'Portuguese',
* id: 'portuguese'
* },
* {
* label: 'Korean',
* id: 'korean'
* },
* {
* label: 'Italian',
* id: 'italian'
* }
*/
languages?: Array<AITranslateLanguage>;
}
export interface AITranslateLanguage {
id: string;
label: string;
}