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

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 App() 
{ 
    LocalizationManager.Instance.StringLoader = new TelerikStringLoader(); 
} 

Here you can see the changed result:

WinUI 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 required steps:

  1. Create a new resource file:
    WinUI New Resourse File
    WinUI My Resources
  2. Open the file you 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 which are not required.
  3. Set the value of the "DragToGroup" key to "Telerik Drag to Group" and save the file:
    WinUI Resource File
  4. Finally, you have to assign your resource file to the resource map of the application in the code behind.

Example 3: Load Custom Resource File

public App() 
{ 
    this.InitializeComponent(); 
    LocalizationManager.Instance.UserResourceMap = LocalizationManager.Instance.ResourceManager.MainResourceMap.GetSubtree("MyResources"); 
} 
The result is:
WinUI Data Grid Localization
In this article
Not finding the help you need?