Skip to content

Commit 22e5ca9

Browse files
authored
Merge pull request #1 from SyncfusionExamples/ES-975464
ES-975464 - Resolve the ReadMe file length issue in this sample repository
2 parents 77db809 + 9d7ae08 commit 22e5ca9

File tree

5 files changed

+61
-3
lines changed

5 files changed

+61
-3
lines changed

AddedCustomResourceFile.png

24.2 KB
Loading

AddingCustomResourceFile.png

56 KB
Loading

CustomResourceFileWithValue.png

62.4 KB
Loading

DefaultResourceFile.png

20.9 KB
Loading

README.md

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,61 @@
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+
![Included default resource file in the application](DefaultResourceFile.png)
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+
![Adding custom resource file in the application](AddingCustomResourceFile.png)
54+
55+
4. Now, select Add and add resource file for `German` culture in `Resources` folder.
56+
57+
![Included custom resource file in the application](AddedCustomResourceFile.png)
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+
![Key Values updated based on the culture](CustomResourceFileWithValue.png)

0 commit comments

Comments
 (0)