Skip to content

Commit 0149e1e

Browse files
authored
Add day of week abbreviation difference (dotnet#41833)
1 parent a76a486 commit 0149e1e

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

docs/core/compatibility/globalization/5.0/icu-globalization-api.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ string text = string.Format("{0:C}", 100);
5252
- In .NET Core 3.1 and earlier versions on Windows, the value of text is `"100,00 €"`.
5353
- In .NET 5 and later versions on Windows 19H1 and later versions, the value of text is `"100,00 ¤"`, which uses the international currency symbol instead of the euro. In ICU, the design is that a currency is a property of a country or region, not a language.
5454

55+
### Day-of-week abbreviations
56+
57+
The <xref:System.Globalization.DateTimeFormatInfo.GetShortestDayName(System.DayOfWeek)?displayProperty=nameWithType> method obtains the shortest abbreviated day name for a specified day of the week.
58+
59+
- In .NET Core 3.1 and earlier versions on Windows, these day-of-week abbreviations consisted of two characters, for example, "Su".
60+
- In .NET 5 and later versions, these day-of-week abbreviations consist of only one character, for example, "S".
61+
5562
## Reason for change
5663

5764
This change was introduced to unify .NET's globalization behavior across all supported operating systems. It also provides the ability for applications to bundle their own globalization libraries rather than depend on the operating system's built-in libraries.

docs/core/extensions/globalization-icu.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ Windows now incorporates a preinstalled [icu.dll](/windows/win32/intl/internatio
3535

3636
The following table shows which versions of .NET are capable of loading the ICU library across different Windows client and server versions:
3737

38-
.NET version| Windows version
39-
---|---
40-
.NET 5 or .NET 6|Windows client 10 version 1903 or later
41-
.NET 5 or .NET 6|Windows Server 2022 or later
42-
.NET 7 or later|Windows client 10 version 1703 or later
43-
.NET 7 or later|Windows Server 2019 or later
38+
| .NET version | Windows version |
39+
|------------------|-----------------------------------------|
40+
| .NET 5 or .NET 6 | Windows client 10 version 1903 or later |
41+
| .NET 5 or .NET 6 | Windows Server 2022 or later |
42+
| .NET 7 or later | Windows client 10 version 1703 or later |
43+
| .NET 7 or later | Windows Server 2019 or later |
4444

4545
> [!NOTE]
4646
> .NET 7 and later versions have the capability to load ICU on older Windows versions, in contrast to .NET 6 and .NET 5.
@@ -120,26 +120,33 @@ Console.WriteLine(foo.StartsWith('\0'));
120120
> False
121121
> ```
122122
123-
To avoid this behavior, use the `char` parameter overload or `StringComparison.Oridinal`.
123+
To avoid this behavior, use the `char` parameter overload or `StringComparison.Ordinal`.
124124
125125
#### TimeZoneInfo.FindSystemTimeZoneById
126126
127127
ICU provides the flexibility to create <xref:System.TimeZoneInfo> instances using [IANA](https://www.iana.org/time-zones) time zone IDs, even when the application is running on Windows. Similarly, you can create <xref:System.TimeZoneInfo> instances with Windows time zone IDs, even when running on non-Windows platforms. However, it's important to note that this functionality isn't available when using [NLS mode](#use-nls-instead-of-icu) or [globalization invariant mode](https://github.com/dotnet/runtime/blob/main/docs/design/features/globalization-invariant-mode.md).
128128
129-
#### ICU dependent APIs
129+
#### Day-of-week abbreviations
130+
131+
The <xref:System.Globalization.DateTimeFormatInfo.GetShortestDayName(System.DayOfWeek)?displayProperty=nameWithType> method obtains the shortest abbreviated day name for a specified day of the week.
132+
133+
- In .NET Core 3.1 and earlier versions on Windows, these day-of-week abbreviations consisted of two characters, for example, "Su".
134+
- In .NET 5 and later versions, these day-of-week abbreviations consist of only one character, for example, "S".
135+
136+
#### ICU-dependent APIs
130137
131138
.NET introduced APIs that are dependent on ICU. These APIs can succeed only when using ICU. Here are some examples:
132139
133140
- <xref:System.TimeZoneInfo.TryConvertIanaIdToWindowsId(System.String,System.String@)>
134141
- <xref:System.TimeZoneInfo.TryConvertWindowsIdToIanaId%2A>
135142
136-
On the Windows versions listed in the [ICU on Windows](#icu-on-windows) section table, the mentioned APIs will consistently succeed. However, on older versions of Windows, these APIs will consistently fail. In such cases, you can enable the [app-local ICU](#app-local-icu) feature to ensure the success of these APIs. On non-Windows platforms, these APIs will always succeed regardless of the version.
143+
On the Windows versions listed in the [ICU on Windows](#icu-on-windows) section table, the mentioned APIs succeed. However, on older versions of Windows, these APIs fail. In such cases, you can enable the [app-local ICU](#app-local-icu) feature to ensure the success of these APIs. On non-Windows platforms, these APIs always succeed regardless of the version.
137144
138145
In addition, it's crucial for apps to ensure that they're not running in [globalization invariant mode](https://github.com/dotnet/runtime/blob/main/docs/design/features/globalization-invariant-mode.md) or [NLS mode](#use-nls-instead-of-icu) to guarantee the success of these APIs.
139146
140147
### Use NLS instead of ICU
141148
142-
Using ICU instead of NLS might result in behavioral differences with some globalization-related operations. To revert back to using NLS, a developer can opt out of the ICU implementation. Applications can enable NLS mode in any of the following ways:
149+
Using ICU instead of NLS might result in behavioral differences with some globalization-related operations. To revert back to using NLS, you can opt out of the ICU implementation. Applications can enable NLS mode in any of the following ways:
143150
144151
- In the project file:
145152

0 commit comments

Comments
 (0)