Localization in Windows Forms Spreadsheet

9 Oct 20231 minute to read

Localization is the process of configuring the application to a specific language. Spreadsheet provides support to localize all the static text in a Ribbon and all dialogs to any desired language. Localization can be done by adding resource file and setting the specific culture in the application.

Spreadsheet allows you to set custom resource using Resx file. You can define your string values in resource file for a specific culture and set the culture in your application.

Set current UI culture to the application

To set the CultureInformation in the Application, set the CurrentUICulture before the InitializeComponent() method is called.

Setting of the culture information,

public MainWindow()
{
    System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("ja-JP");
    InitializeComponent();
}

Now, the Application is set to the Japanese Culture info.

Localization using resource file

The following steps show how to implement the localization in Spreadsheet,

  • Create a folder and name it as ‘Resources’ in your application.
  • Add the default resource[English(“en-US”)] file of Spreadsheet in the ‘Resources’ folder named as Syncfusion.Spreadsheet.Windows.resx.
    You can download the Resx file here
  • Create Resx(resource) file under the ‘Resources’ folder and name it as Syncfusion.Spreadsheet.Windows.[Culture name].resx.
    For example, Syncfusion.Spreadsheet.Windows.ja.resx for Japanese culture.

Multiple resource files to change the default strings

  • Add the resource key such as name and its corresponding localized value in Resource Designer of Syncfusion.Spreadsheet.Windows.ja.resx file.
    For your reference, you can download the Japanese(“ja-JP”) Resx file here

Resource file for Japanese culture

The following screenshot shows you the localization in Spreadsheet,

Localized strings with Japanese culture

Modifying the localized strings in resource file

Users can modify the default localized strings in Resource file by adding the default Resx (resource) file of Spreadsheet in the ‘Resources’ folder of your application and name it as Syncfusion.Spreadsheet.Windows.resx.

Now, the default localized strings can be modified by changing the Name/Value pair in the Syncfusion.Spreadsheet.Windows.resx file.

Modified default strings of English culture