New to Telerik UI for Blazor? Download free 30-day trial

Localize Selected Localization Keys with Custom Strings


Product UI for Blazor


This knowledge base article addresses the following scenarios.

  • If I want to change a single localized string, is there any mechanism to fall back to component integrated localization?

  • Is there a way to not maintain a complete version of your localization files across all Telerik versions only because I want to change a single string?

  • How to achieve partial localization?

  • If I use a limited part of a component, I want to avoid providing and maintaining a full set of localized resources.


To localize selected keys with custom strings:

  1. Create a project with Telerik UI for Blazor. For detailed instructions, see:
  2. Create a Services folder and implement the Telerik localization service with a list of all needed localization keys and their corresponding custom strings. The service also relies on a ~/Resources folder with the necessary .resx files. You can find an up-to-date list of the used strings in the Blazor API documentation and the offline version of the Blazor Demo solution. Telerik updates the main TelerikMessages.resx file (in English) with each new release.


    using Telerik.Blazor.Services;
    public class ResxLocalizer : ITelerikStringLocalizer
        private readonly ITelerikStringLocalizer _fallback;
        // Here is the list of the desired localization keys with their custom string values.
        private Dictionary<string, string> _ownStrings = new Dictionary<string, string>()
            { "Wizard_Next", "Your Custom Text" }
        public ResxLocalizer()
            // This is your public implementation of ITelerikStringLocalizer!
            _fallback = new TelerikStringLocalizer();
        public string this[string name]
                if (_ownStrings?.ContainsKey(name) ?? false)
                    return _ownStrings[name];
                    return _fallback[name];
  3. Modify the Program.cs file and register the custom localizer.


    var builder = WebApplication.CreateBuilder(args);
    // Add services to the container.
    // Example of how to register a service in the project (add only if such exists)
    // After registering the Telerik services, register a custom localizer for the Telerik components.
    builder.Services.AddSingleton(typeof(ITelerikStringLocalizer), typeof(ResxLocalizer));
    var app = builder.Build();
    // Configure the HTTP request pipeline.
    if (!app.Environment.IsDevelopment())
        // The default HSTS value is 30 days. You may want to change this for production scenarios, see
  4. (optional) Add the desired .resx files to the ~/Resources folder.

    • Name the files like this ~/Resources/TelerikMessages.<culture-locale>.resx, for example You can use different names (for example, in our demos we use TelerikMessages.resx). The file names affect the static class that is generated and how you use it in your code (for example, to localize other elements you define yourself, such as grid command buttons or your own buttons).

    • Make sure to add the resource file provided in your Telerik UI for Blazor installation that matches the version used in your project. This is the file that contains the current set of localizable strings and whose designer file need to be generated by the build.

    • Make sure to:

    • Mark the .resx files as Embedded Resource (right click > Properties > Build Action).

    • Have the following in your ProjectName.csproj file so the designer file is generated. It should be added when you add the main messages file, or when you open and save it. Copy the snippet in case it is not added. If the Designer file does not get generated, open the .resx file in Visual Studio and toggle its Access Modifier to Public.


        <Compile Update="Resources\TelerikMessages.designer.cs">
        <EmbeddedResource Update="Resources\TelerikMessages.resx">

See Also

In this article