blazor-devexpress-dot-aiintegration-dot-blazor-dot-richedit-dot-translateaicontextmenuitem.md
Specifies a list of languages available for translation.
Namespace : DevExpress.AIIntegration.Blazor.RichEdit
Assembly : DevExpress.AIIntegration.Blazor.RichEdit.v25.2.dll
NuGet Package : DevExpress.AIIntegration.Blazor.RichEdit
[Parameter]
public object Languages { get; set; }
| Type | Description |
|---|---|
| Object |
An object that contains a list of languages.
|
Use the Languages property to specify a list of languages displayed in the Translate context menu item.
@using DevExpress.AIIntegration.Blazor.RichEdit
@using DevExpress.Blazor.RichEdit
<DxRichEdit>
<Extensions>
<SummarizeAIContextMenuItem />
<ExplainAIContextMenuItem />
<ProofreadAIContextMenuItem />
<ExpandAIContextMenuItem />
<ShortenAIContextMenuItem />
<AskAssistantAIContextMenuItem />
<ChangeStyleAIContextMenuItem />
<ChangeToneAIContextMenuItem />
<TranslateAIContextMenuItem Languages="@("German, French, Chinese")" />
</Extensions>
</DxRichEdit>
The Languages property accepts data in the following formats:
String
string languages = "English, German, French, Chinese";
Array of strings
string[] languages = new string[4] { "English", "German", "French", "Chinese" };
Array of anonymous objects
object[] languages = new object[] {
new { id = "eng", text = "English" },
new { id = "de", text = "German" },
new { id = "fr", text = "French" },
new { id = "zh", text = "Chinese" }
};
Array of objects
public class Language {
public string Id { get; set; }
public string Text { get; set; }
public Language(string id, string text) {
Id = id;
Text = text;
}
}
Language[] languages = {
new Language("eng","English"),
new Language("de", "German"),
new Language("fr", "French"),
new Language("zh", "Chinese")
};
If you assign an array of objects to the Languages property, use ValueFieldName and TextFieldName properties to specify fields that contain language key values and display texts.
<DxRichEdit>
<Extensions>
...
<TranslateAIContextMenuItem Languages="@languages" ValueFieldName="id" TextFieldName="text" />
</Extensions>
</DxRichEdit>
@code {
object[] languages = new object[] {
new { id = "English", text = "English" },
new { id = "German", text = "Deutsch" },
new { id = "Chinese", text = "中國人" },
new { id = "Greek", text = "Ελληνικά" }
};
}
See Also
TranslateAIContextMenuItem Class