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

How to Localize

The LocalizationManager class represents a singleton class that manages application string resources and supports two ways to change the localization in the current assembly:

  • Using StringLoader - with highest priority
  • Using resource map

Both ways will be described below.

For a complete list of all localizable keys, see the Localization Keys topic for each control.

Localization Using StringLoader

The following example demonstrates how to create and use a StringLoader. Let's say you want to change the value of the key "Drag a column header here to group" on the RadDataGrid to "Telerik Group":

  1. First you need to create a class that inherits from the IStringResourceLoader interface and implement the GetString() method that accepts the key you want to change and return the value you want to set.

You will need to add the following namespace : Telerik.Core

Example 1: Implement IStringResourceLoader

public class TelerikStringLoader : IStringResourceLoader 
{ 
    public string GetString(string key) 
    { 
        switch (key) 
        { 
            case "DragToGroup": 
                return "Custom String Here"; 
            default: 
                return null; 
        } 
    } 
} 
1. Then set an instance of your implementation to the LocalizationManager:

Example 2: Set StringLoader Property

public MainPage() 
{ 
    LocalizationManager.Instance.StringLoader = new TelerikStringLoader(); 
} 

Here you can see the changed result:

Data Grid Example

Localize using Resource Files

The following example demonstrates how to create a resource file and change the DragToGroup key of RadDataGrid control to "Telerik Drag to Group". Here are the basic steps:

  1. Create a new resource file:
    New Resourse File
    My Resources
  2. Open the file you have just created and you will see a table with three columns: Name, Value and Comment.
    • "Name" is the field where you have to put the key you want to change.
    • "Value" is the field where you have to set the value you want.
    • The "Comment" field is for comments.
  3. Set the value of the key "DragToGroup" to "Telerik Drag to Group" and save the file:
    Resource File
  4. Finally, you have to assign your resource file to the resource map of the application in the code behind.

You need to add the following namespace: Windows.ApplicationModel.Resources.Core

Example 3: Load Custom Resource File

public MainPage() 
{ 
    LocalizationManager.Instance.UserResourceMap = ResourceManager.Current.MainResourceMap.GetSubtree("MyResources"); 
} 

The result is:
Data Grid Localization

In this article
Not finding the help you need?