Skip to main content
All docs
V25.1
  • Localizing Your DevExpress-powered .NET App – Your Feedback Matters

    We hope to validate a few hypotheses about our Localization Service, Unified Component Installer, overall localization quality, and ways to translate strings in general.

    Take the survey Not interested

    DxBlazorViewerLocalizerLocalizationService Class

    Allows you to change localizable text at runtime.

    Namespace: DevExpress.Blazor.Localization

    Assembly: DevExpress.Blazor.v25.1.Viewer.dll

    NuGet Package: DevExpress.Blazor.Viewer

    #Declaration

    C#
    public class DxBlazorViewerLocalizerLocalizationService :
        IDxViewerLocalizationService,
        IDxLocalizationService

    #Remarks

    The DxBlazorViewerStringId enumeration lists the Viewer’s localizable strings. You can implement and register a custom service to replace a specific localizable string with custom text at runtime.

    Create a custom class CustomLocalizationService that inherits from the DxBlazorViewerLocalizerLocalizationService class and override the GetString method:

    C#
    using DevExpress.Blazor.Localization;
    // ...
        public class CustomLocalizationService: DxBlazorViewerLocalizerLocalizationService
        {
            protected override string GetString(string key)
            {
                switch (key)
                {
                    case "DxBlazorViewerStringId.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.Localization;
    
    var builder = WebApplication.CreateBuilder(args);
    
    builder.Services.AddScoped<IDxReportingLocalizationService, CustomLocalizationService>();
    
    var app = builder.Build();
    

    #Inheritance

    Object
    DxBlazorViewerLocalizerLocalizationService
    See Also