Back to Devexpress

DxBlazorReportViewerLocalizerLocalizationService Class

xtrareports-devexpress-dot-blazor-dot-reporting-dot-localization.md

latest3.4 KB
Original Source

DxBlazorReportViewerLocalizerLocalizationService Class

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

Declaration

csharp
public class DxBlazorReportViewerLocalizerLocalizationService :
    DxBlazorViewerLocalizerLocalizationService,
    IDxReportingLocalizationService,
    IDxViewerLocalizationService,
    IDxLocalizationService
vb
Public Class DxBlazorReportViewerLocalizerLocalizationService
    Inherits DxBlazorViewerLocalizerLocalizationService
    Implements IDxReportingLocalizationService,
               IDxViewerLocalizationService,
               IDxLocalizationService

Remarks

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:

cs
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:

csharp
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:

Implements

IDxReportingLocalizationService

Inheritance

Object DxBlazorViewerLocalizerLocalizationService DxBlazorReportViewerLocalizerLocalizationService

See Also

DxBlazorReportViewerLocalizerLocalizationService Members

DevExpress.Blazor.Reporting.Localization Namespace