You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blazor/common/globalization.md
+58-3Lines changed: 58 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,64 @@ documentation: ug
9
9
10
10
# Globalization in Blazor Application
11
11
12
-
*Globalization is the combination of adapting the control to various languages by parsing and formatting the date or numbers (`Internationalization (L18N)`) and adding cultural-specific customizations and translating the text (`Localization (L10N)`).
12
+
Globalization is the combination of adapting the control to various languages by parsing and formatting the dates, times, numbers or currencies (`Internationalization (L18N)`) and adding cultural-specific customizations and translating the text (`Localization (L10N)`).
13
13
14
-
* The Syncfusion Blazor UI components are specific to the `American English (en-US)` culture by default. It utilizes the `Blazor Internationalization` package to parse and format the number and date objects based on the chosen culture.
14
+
The Syncfusion Blazor UI components are specific to the `American English (en-US)` culture by default. It utilizes the `Blazor Internationalization` package to parse and format the number and date objects based on the chosen culture.
15
+
16
+
Blazor uses the built-in .NET types from the `System.Globalization` namespace, such as the `CultureInfo` class and its `CurrentCulture` property.
17
+
18
+
* Culture ([CultureInfo.CurrentCulture](https://learn.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo.currentculture?view=net-8.0#system-globalization-cultureinfo-currentculture)): Determines the formatting of numbers, dates, and times. It's mainly concerned with how data is presented and interpreted.
19
+
* UI Culture ([CultureInfo.CurrentUICulture](https://learn.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo.currentuiculture?view=net-8.0#system-globalization-cultureinfo-currentuiculture)): Determines the language of the user interface, including which resource files (like .resx files) are used for localizing the app’s UI.
20
+
21
+
When dealing with form fields in Blazor, it’s important to note that certain input types automatically respect the user's culture settings using [CultureInfo.InvariantCulture](https://learn.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo.invariantculture?view=net-8.0#system-globalization-cultureinfo-invariantculture).
22
+
23
+
For example, the following input types are culture-sensitive:
24
+
25
+
*`date`
26
+
*`number`
27
+
28
+
Blazor relies on the browser’s handling of these input types, which ensures that the user input is parsed and rendered according to their specific culture settings.
29
+
30
+
However, some form field types are not yet fully supported across all browsers, making them less reliable in Blazor applications. These include:
31
+
32
+
*`datetime-local`
33
+
*`month`
34
+
*`week`
35
+
36
+
37
+
The following code snippet serves as an example to demonstrate how globalization can be implemented in a Blazor application. It illustrates the process of localizing content, formatting dates and numbers.
* Suppose, if you want to change any specific culture, then add the corresponding culture resource (`.resx`) file by using the below reference.
17
-
*[Changing culture and Adding Resx file in the application](https://blazor.syncfusion.com/documentation/common/localization#how-to-enable-localization-in-blazor-application)
66
+
67
+
[Changing culture and Adding Resx file in the application](https://blazor.syncfusion.com/documentation/common/localization#how-to-enable-localization-in-blazor-application)
68
+
69
+
## See also
70
+
*[ASP.NET Core Blazor globalization and localization](https://learn.microsoft.com/en-us/aspnet/core/blazor/globalization-localization?view=aspnetcore-8.0)
0 commit comments