DxRichEdit.DocumentCulture Property
Specifies the name of an open document’s culture for the spell check feature.
Namespace: DevExpress.Blazor.RichEdit
Assembly: DevExpress.Blazor.RichEdit.v24.2.dll
NuGet Package: DevExpress.Blazor.RichEdit
Declaration
[Parameter]
public string DocumentCulture { get; set; }
Property Value
Type | Description |
---|---|
String | The name of the culture in the following format: |
Remarks
A culture name is a string in the following format:
<languagecode>-<country/regioncode>
<languagecode>
is a lowercase two-letter code in ISO 639-1 format.<country/regioncode>
is a BCP-47 language tag or uppercase two-letter code in ISO 3166 format.
The component uses this string to create a CultureInfo object that stores information about the document’s culture. An empty string or string in another format corresponds to an InvariantCulture. Refer to the following article for a table with the Language tags column that lists available culture names: Microsoft Documentation.
The built-in spell check service checks spelling against all dictionaries when the component’s DocumentCulture
property corresponds to an invariant culture. Otherwise, the service uses only the dictionaries whose culture is invariant or matches the document’s culture.
Inside a custom spell check service‘s code, you can use the Culture property to get the current document culture. Depending on this culture, you can change the behavior of your service.
The following code snippet loads a document and changes the document culture:
<DxRichEdit @ref="@richEditor" CheckSpelling="true" DocumentCulture=@culture />
@code {
DxRichEdit richEditor;
string culture = "en-US";
protected override async Task OnAfterRenderAsync(bool firstRender) {
if (firstRender)
try {
await InitializeDocument();
}
catch (TaskCanceledException) { }
await base.OnAfterRenderAsync(firstRender);
}
async Task InitializeDocument() {
await richEditor.LoadDocumentAsync("C:\\Users\\Public\\rapport.docx");
culture = "fr-FR";
StateHasChanged();
}
}