Localizing your application using Infragistics NetAdvantage for WPF

Kiril Matev / Monday, June 28, 2010

If your users’ native language is not English, you’re all too often faced with a localization requirement. You can easily setup the user code to display control strings in the required language, but what about the strings displayed in Infragistics WPF controls? In the 10.2 release, both our Silverlight and WPF products include control strings in German. As shown in this blogpost, showing control strings in German is rather straightforward to set up.

However, you may need your control strings to be displayed in languages other than the provided ones. This blogpost demonstrates how you can provide your own translations to control strings in Infragistics WPF controls. Control strings include warning messages, dialog box captions, and others. They are stored as assembly resource strings.

Keep in mind that resource-string customization is a run-time feature that affects all the controls in the assembly whose resources you’re changing. This means that all instances of the control in the application will display the modified string. Also, you have to run this code before your application initializes the user interface.

I’ve written a simple application, which changes the default strings of the docking pane button tooltips and the grouping area of the XamGrid to demonstrate the approach. 

The application uses the following code in the OnStartup handler of the App.xaml.cs file to replace the default strings:

protected override void OnStartup(StartupEventArgs e)
{

base.OnStartup(e);

 //change XamDataGrid resource strings for the group by area
Infragistics.Windows.DataPresenter.Resources.Customizer.SetCustomizedString("GroupByArea_Prompt1", "Grouper");           Infragistics.Windows.DataPresenter.Resources.Customizer.SetCustomizedString("GroupByArea_Prompt2", "");

//change the XamDockManager resource strings for the docking
Infragistics.Windows.DockManager.Resources.Customizer.SetCustomizedString("CloseButtonToolTip", "Fermer");           Infragistics.Windows.DockManager.Resources.Customizer.SetCustomizedString("PinButtonToolTip", "Masquer automatiquement");                           Infragistics.Windows.DockManager.Resources.Customizer.SetCustomizedString("PositionMenuToolTip", "Position de la fenêtre");

}

The code above changes the text shown in the group by area of the grid, and redefines some of the tooltip strings for the docking component.

The links below lead to lists of resource strings in the different assemblies, with the controls in the corresponding assembly listed next to it. Open these lists to see the strings you can localize, the key you have to use to modify the value, and the default value:

Using this simple approach, you can go ahead and provide translations for the string of the controls you’re using in your localized applications. This frees you to provide your application in any language you wish, and to be able to deliver solutions, which relate to users in their native language.

If you have any questions, do not hesitate to email me at kmatev@infragistics.com