Skip to main content
All docs
V25.1
  • TranslateAIContextMenuItem Class

    A context menu item that translates editor text into the specified language.

    Namespace: DevExpress.AIIntegration.Blazor.RichEdit

    Assembly: DevExpress.AIIntegration.Blazor.RichEdit.v25.1.dll

    NuGet Package: DevExpress.AIIntegration.Blazor.RichEdit

    Declaration

    public class TranslateAIContextMenuItem :
        BaseAIContextMenuItem

    Remarks

    Populate the DxRichEdit.AdditionalItems collection with the TranslateAIContextMenuItem object to add the Translate item to the editor context menu. This item translates the editor text into the specified language.

    Use the Languages property to specify a list of available languages.

    Read Tutorial: Get Started with AI-powered Extension for Blazor Rich Text Editor

    View Example: Rich Text Editor and HTML Editor for Blazor - How to integrate AI-powered extensions

    @using DevExpress.AIIntegration.Blazor.RichEdit
    @using DevExpress.Blazor.RichEdit
    
    <DxRichEdit>
        <AdditionalSettings>
            <SummarizeAIContextMenuItem />
            <ExplainAIContextMenuItem />
            <ProofreadAIContextMenuItem />
            <ExpandAIContextMenuItem />
            <ShortenAIContextMenuItem />
            <AskAssistantAIContextMenuItem />
            <ChangeStyleAIContextMenuItem />
            <ChangeToneAIContextMenuItem />
            <GenerateDescriptionAIContextMenuItem />
            <TranslateAIContextMenuItem Languages="@("German, French, Chinese")" />
        </AdditionalSettings>
    </DxRichEdit>
    

    AI-powered Extension for RichEdit

    If you assign an array of objects to the Languages property, use the ValueFieldName and TextFieldName properties to specify fields that contain language key values and display texts.

    <DxRichEdit>
        <AdditionalItems>
            ...
            <TranslateAIContextMenuItem Languages="@languages" ValueFieldName="id" TextFieldName="text" />
        </AdditionalItems>
    </DxRichEdit>
    
    @code {
        public class Language {
            public string id { get; set; }
            public string text { get; set; }
        }
    
        Language[] languages = {
            new() { id = "English", text = "English"},
            new() { id = "German", text = "Deutsch"},
            new() { id = "Chinese", text = "中國人"},
            new() { id = "Greek", text = "Ελληνικά"}
        };
    }
    

    Inheritance

    Object
    ComponentBase
    DevExpress.AIIntegration.Blazor.Internal.BasePopupItem
    BaseAIContextMenuItem
    TranslateAIContextMenuItem
    See Also