|
1 | | -# WinForms DataGrid Localization |
2 | | -This repository contains sample which shows localization of Syncfusion WinForms DataGrid (SfDataGrid). |
3 | | -https://help.syncfusion.com/windowsforms/localization#localize-syncfusion-windows-forms-control-using-resx-file |
| 1 | +# How to Apply Localization for WinForms DataGrid? |
| 2 | + |
| 3 | +This repository contains sample which shows localization of Syncfusion [WinForms DataGrid](https://www.syncfusion.com/winforms-ui-controls/datagrid) (SfDataGrid). |
| 4 | + |
| 5 | +You can [localize](https://help.syncfusion.com/windowsforms/localization#localize-syncfusion-windows-forms-control-using-resx-file) the `DataGrid` by adding resource file for each language. |
| 6 | + |
| 7 | +### Changing application culture |
| 8 | + |
| 9 | +When you are changing the application culture, then you can localize the application based on application culture by creating .resx file. |
| 10 | + |
| 11 | +#### C# |
| 12 | + |
| 13 | +``` csharp |
| 14 | +public partial class Form1 : Form |
| 15 | +{ |
| 16 | + public Form1() |
| 17 | + { |
| 18 | + Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("de-DE"); |
| 19 | + Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de-DE"); |
| 20 | + InitializeComponent(); |
| 21 | + } |
| 22 | +} |
| 23 | +``` |
| 24 | + |
| 25 | +#### VB |
| 26 | + |
| 27 | +``` vb |
| 28 | +Partial Public Class Form1 |
| 29 | + Inherits Form |
| 30 | + Public Sub New() |
| 31 | + Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("de-DE") |
| 32 | + Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo("de-DE") |
| 33 | + InitializeComponent() |
| 34 | + End Sub |
| 35 | +End Class |
| 36 | +``` |
| 37 | + |
| 38 | +### Creating .resx files |
| 39 | + |
| 40 | +You can create .resx files for any languages by following steps, |
| 41 | + |
| 42 | +1. Right click your project and click `New Folder` and set name as `Resources`. |
| 43 | + |
| 44 | +2. Add [Windows Forms Control Localization default resource files](https://github.com/syncfusion/winforms-controls-localization-resx-files) of libraries you are using into `Resources` folder. |
| 45 | + |
| 46 | +**Note:** |
| 47 | +Consider you are using `SfDataGrid` control in your application. Then you need to copy and include `Syncfusion.SfDataGrid.WinForms.resx` (SfDataGrid present in `Syncfusion.SfDataGrid.WinForms` library) file in your application under `Resources` folder. So, now you can know the key names and values of default strings used in `Syncfusion.SfDataGrid.WinForms.dll` library. |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +3. Now, right click on `Resources` folder and select `Add` and then `New Item`. In the `Add New Item wizard`, select Resources File option and name the file name as `Syncfusion.SfDataGrid.WinForms.<culture name>.resx` for German culture. For example, you have to give name as `Syncfusion.SfDataGrid.WinForms.de-DE.resx` for `German` culture. In the same way, add new resource files for other libraries used in your application. |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | +4. Now, select Add and add resource file for `German` culture in `Resources` folder. |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +5. Now, you can copy the key names from default resource files and change its corresponding value based on the culture. |
| 60 | + |
| 61 | + |
0 commit comments