Skip to main content

IDxLocalizationService.GetString(String) Method

Returns a translated string by key.

Namespace: DevExpress.Blazor.Localization

Assembly: DevExpress.Blazor.v22.2.dll

NuGet Package: DevExpress.Blazor


string GetString(
    string key


Name Type Description
key String

A string value that specifies a key.


Type Description

The translated string that corresponds to the specified key.


Use the GetString(key) method to obtain translated application resources (button captions, menu items, and etc.) to localize you Blazor applications. For more information, refer to Localization.

The code below demonstrates how to implement a custom service to localize an application:

using DevExpress.Blazor.Localization;
using System.Globalization;

namespace LocalizationService.Services {
    public class LocalizationService : DxLocalizationService, IDxLocalizationService {
        string? IDxLocalizationService.GetString(string key) {
            return CultureInfo.CurrentUICulture.Name == "it-IT" ?
                LocalizationProvider.GetString(key) :

        public static class LocalizationProvider {
            public static Dictionary<string, string> localization = new Dictionary<string, string> {
                {"DxBlazorStringId.Calendar_TodayButton", "Oggi"},
                {"DxBlazorStringId.Calendar_ClearButton", "Pulisci"},
                {"DxBlazorStringId.Scheduler_CancelButton", "Annulla"},
                /* ... */

            public static string? GetString(string key) {
                localization.TryGetValue(key, out string? value);
                return value;

View Example: Localize DevExpress Blazor components

See Also