Skip to content

Commit 3848a09

Browse files
955646-Added Localization Content
1 parent 2583f95 commit 3848a09

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

maui-toolkit/Calendar/localization.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,57 @@ documentation: ug
1111

1212
By default, the calendar control supports US English localizations. You can change to other languages by adding the `Globalization` namespace to your application.
1313

14+
## Setting CurrentUICulture to the application
15+
1416
The application culture can be changed by setting `CurrentUICulture`. in the `App.xaml.cs` file.
1517

1618
{% tabs %}
17-
{% highlight c# tabtitle="App.xaml.cs" hl_lines="2 9" %}
19+
{% highlight c# tabtitle="App.xaml.cs" hl_lines="1 2 13 14" %}
1820

19-
using Syncfusion.Maui.Toolkit.Calendar;
21+
using System.Resources;
22+
using Syncfusion.Toolkit.Calendar;
2023
using System.Globalization;
2124

2225
public partial class App : Application
2326
{
2427
public App()
2528
{
2629
InitializeComponent();
30+
31+
//// ResXPath => Full path of the resx file;
32+
//// For example : SfCalendarResources.ResourceManager = new ResourceManager("MauiTestCalendarLocalization.Resources.SfCalendar", Application.Current.GetType().Assembly);
2733
CultureInfo.CurrentUICulture = CultureInfo.CreateSpecificCulture("ja-JP");
34+
SfCalendarResources.ResourceManager = new ResourceManager("ResxPath", Application.Current.GetType().Assembly);
35+
MainPage = new AppShell();
2836
}
2937
}
3038

3139
{% endhighlight %}
3240
{% endtabs %}
3341

3442
![Month view localization in .NET MAUI Calendar.](images/localization/maui-month-view-localization.png)
43+
44+
N>
45+
The required `resx` files with `Build Action` as `EmbeddedResource` (File name should contain culture code) into the `Resources` folder.
46+
47+
## Localize application level
48+
49+
To localize the `Calendar` based on `CurrentUICulture` using `resource` files, follow the below steps.
50+
51+
1. Create new folder, named as `Resources` in the application.
52+
53+
2. Right-click on the `Resources` folder, select `Add` and then `NewItem.`
54+
55+
3. In Add New Item wizard, select the Resource File option and name the filename as `SfCalendar.<culture name>.resx.` For example, give the name as `SfCalendar.ja-JP.resx` for French culture.
56+
57+
4. The culture name indicates the name of the language and country.
58+
59+
![shows-the-name-of-resource-file-to-be-added-for-maui-calendar](images/localization/shows-the-name-of-resource-file-to-be-added-for-maui-calendar.png)
60+
61+
5. Now, select `Add` option to add the resource file in **Resources** folder.
62+
63+
![shows-the-added-resource-file-for-french-language-in-maui-calendar](images/localization/shows-the-added-resource-file-for-french-language-in-maui-calendar.png)
64+
65+
6. Add the Name/Value pair in Resource Designer of `SfCalendar.ja-JP.resx` file and change its corresponding value to corresponding culture.
66+
67+
![shows-the-added-resource-file-name-value-pair-in-the-resource-designer-in-maui-calendar](images/localization/shows-the-added-resource-file-name-value-pair-in-the-resource-designer-in-maui-calendar.png)

0 commit comments

Comments
 (0)