Skip to content

Commit b93bafc

Browse files
ES-975464 - Addressed the concerns
1 parent 4eec1f4 commit b93bafc

File tree

6 files changed

+22
-3
lines changed

6 files changed

+22
-3
lines changed

AddingCustomResourceFile.png

57.1 KB
Loading

CustomResourceFile.png

25.9 KB
Loading

DefaultResourceFile.png

24.4 KB
Loading

LocalizationAppliedToDataGrid.png

59.1 KB
Loading

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
# Localization in WPF DataGrid (SfDataGrid)
1+
# How to Apply the Localization in WPF DataGrid?
22

3-
This repository contains sample which shows localization of Syncfusion [WPF DataGrid](https://www.syncfusion.com/wpf-controls/datagrid).
3+
This repository contains sample which shows localization of Syncfusion [WPF DataGrid](https://www.syncfusion.com/wpf-controls/datagrid) (SfDataGrid).
44

55
[Localization](https://help.syncfusion.com/wpf/localization) is the process of translating the application resources into different language for the specific cultures. You can localize the WPF DataGrid by adding a resource file for each language.
66

77
### Changing application culture
88

99
When you change the application culture, you can localize the application based on application culture by creating .resx file.
1010

11+
#### C#
12+
1113
``` csharp
1214
public partial class MainWindow
1315
{
@@ -19,6 +21,17 @@ public partial class MainWindow
1921
}
2022
```
2123

24+
#### VB
25+
26+
``` vb
27+
Partial Public Class MainWindow
28+
Public Sub New()
29+
InitializeComponent()
30+
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de")
31+
End Sub
32+
End Class
33+
```
34+
2235
### Creating .resx files
2336

2437
You can create .resx files for any language by following these steps:
@@ -27,10 +40,16 @@ You can create .resx files for any language by following these steps:
2740

2841
2. Add the [default resource files](https://github.com/syncfusion/wpf-controls-localization-resx-files) to the libraries you are using to the `Resources` folder and ensure `AccessModifier` is specified as Public.
2942

43+
![Included the default resource file for localization](DefaultResourceFile.png)
44+
3045
3. Now, right-click `Resources` folder and select Add and then `NewItem`. In the `Add New Item` wizard, select the Resource File option and name the filename as `Syncfusion.SfGrid.WPF.<culture name>.resx`. For example, you have to give name as `Syncfusion.SfGrid.WPF.de.resx` for `German` culture. In the same way, add new resource files for other libraries used in your application.
3146

47+
![Adding custom resource file for localization](AddingCustomResourceFile.png)
48+
3249
4. Now, select Add and add resource file for German culture in `Resources` folder and set `AccessModifier` property to No code generation.
3350

51+
![Included the custom resource file for localization](CustomResourceFile.png)
52+
3453
5. Now, you can copy the key names from the default resource files and assign values based on the culture and the resource files’ targets.
3554

36-
![Localized WPF DataGrid](wpf-datagrid-localization.PNG)
55+
![DataGrid with Localization applied](LocalizationAppliedToDataGrid.png)

wpf-datagrid-localization.PNG

-50.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)