You can localize the WinForms control by following the given steps.
- The neutral resources of every WinForms component are present in the localization folder of each component’s source code. For the Tools package, the resources are present in the following path, assuming that C:\Program Files\ is the installation path for the Syncfusion components:
C:\Program Files\Syncfusion\Essential Studio<version>\Windows\Tools.Windows\Localization\
C:\Program Files\Syncfusion\Essential Studio<version>\Base\Shared.Base\Localization
- In the NeutralResources folder, there are four resource files corresponding to the Tools package. These resources contain the string representations for the English (default and neutral) culture.
- Microsoft Visual Studio.NET provides a tool, Resource Editor (ResEditor) that can be used to localize the string resources. It provides a graphic interface that allows you to construct resource files containing bitmaps, icons, and strings. The following figure shows how the Resource Editor looks when it is first opened.
Figure 1: Resource Editor
- By using the Resource Editor, open the resource file named Syncfusion.Windows.Forms.Tools.SR.resources present in the NeutralResources folder. The file is opened in the ResEditor as shown in the following image.
Figure 2: Resource file
- After opening the resource file in the Resource Editor, start entering the equivalent strings for the required culture. In this example, German is used. In the following figure, all the English strings are replaced by their German equivalent. For instance, the German equivalent of Close is & Schließen.
Figure 3: Strings in German
- In ResEditor, Click File > Save As and save the file. The file is saved as Syncfusion.Windows.Forms.Tools.SR.de-DE. You can save it as per your wish.
- Repeat the process for other resources, and save it. Now, in the Visual Studio.NET Command Prompt, enter the following command and press Enter. Make sure that you have the sf.publicsnk file from the localization folder.
al /t:lib /culture:de-DE /out: Syncfusion.Tools.Windows.resources.dll /v:188.8.131.52 /delay+ /keyf: sf.publicsnk /embed:Syncfusion.Windows.Forms.Tools.SR.de-DE.resources
Figure 4: Visual studio command prompt
al /t:lib /culture:de-DE /out: Syncfusion.Shared.Base.resources.dll /v:184.108.40.206 /delay+ /keyf: sf.publicsnk /embed: Syncfusion.Windows.Forms.Localization.SR.de-DE
- The version you specify for these DLLs in the al command should be based on the SatelliteContractVersionAttribute setting in the product AssemblyInfo. This also means that when a new version of the product is released (with a newer assembly version), you have to recreate (adding new resources, when available or necessary), and recompile your resource DLLs with a new version (in case the SatelliteContractVersionAttribute has changed).
- On successful execution, an assembly file named Syncfusion.Tools.Windows.resources.dll is created.
- Finally, mark this satellite DLL for verification skipping (since it is not signed with the same strong-name as the product assembly). To do this, enter the following code in the Visual Studio command prompt sn –Vr Syncfusion.Tools.Windows.resources.dll.
Figure 5: Satellite DLL for verification skipping
- Drop this DLL into an appropriate sub-directory under yours. EXE’s directory (bin\Debug), based on the naming conventions enforced in .NET. You should put it in the de-DE sub-directory in case this DLL contains resources from the German (Germany) culture.
- Finally, you should make your application fetch the German resources during run time. The following sample code does that. To change the UI culture of the current thread, add this code in the Forms constructor before the InitializeComponent ().
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de-DE");
- Now, run your application containing the Syncfusion Toolbar and Menu controls. The localization is applied to the Syncfusion controls as shown in the following images.
Figure 6: Localization in GroupBar
Figure 7: Localization in MainFrameBarManager
Figure 8: Localization in Customization dialog box
Figure 9: Localization in DockingManager
C#: How to Localize WinForm controls C#
VB: How to Localize WinForm controls VB