xtrareports-devexpress-dot-blazor-dot-reporting-dot-localization.md
Allows you to change localizable text at runtime.
Namespace : DevExpress.Blazor.Reporting.Localization
Assembly : DevExpress.Blazor.Reporting.v25.2.Viewer.dll
NuGet Package : DevExpress.Blazor.Reporting.Viewer
public class DxBlazorReportViewerLocalizerLocalizationService :
DxBlazorViewerLocalizerLocalizationService,
IDxReportingLocalizationService,
IDxViewerLocalizationService,
IDxLocalizationService
Public Class DxBlazorReportViewerLocalizerLocalizationService
Inherits DxBlazorViewerLocalizerLocalizationService
Implements IDxReportingLocalizationService,
IDxViewerLocalizationService,
IDxLocalizationService
The DxBlazorReportViewerStringId enumeration lists the Report Viewer’s localizable strings. You can implement and register a custom service to replace a specific localizable string with custom text at runtime.
To do this, create a custom CustomLocalizationService class that inherits from the DxBlazorReportViewerLocalizerLocalizationService class and override the GetString method:
using DevExpress.Blazor.Reporting.Localization;
// ...
public class CustomLocalizationService: DxBlazorReportViewerLocalizerLocalizationService
{
protected override string GetString(string key)
{
switch (key)
{
case "DxBlazorReportViewerStringId.TabPanel_Parameters_Title":
return "Please specify your report parameters";
break;
default:
return base.GetString(key);
break;
}
}
}
Register the CustomLocalizationService at application startup:
using Microsoft.AspNetCore.Hosting;
using DevExpress.Blazor.Reporting.Localization;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddScoped<IDxReportingLocalizationService, CustomLocalizationService>();
var app = builder.Build();
The following image shows the result:
IDxReportingLocalizationService
Object DxBlazorViewerLocalizerLocalizationService DxBlazorReportViewerLocalizerLocalizationService
See Also