TimeZoneInfo.GetSystemTimeZones() doesn't support localized display names
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- csharp, linux
- Domain
- localization, operating-systems
Research direction
Reproduce the minimal API on .NET 8.0.115 under Ubuntu and compare its TimeZoneInfo.GetSystemTimeZones() display names with .NET 6, changing CurrentUICulture to en, de, and zh. Done means the returned time-zone list uses the requested UI culture rather than the operating system locale.
Written by the indexing model from the issue text.
Description
Description
Our app have a method to return a localized list of time zones (simplified):
public IActionResult GetAllTimeZone(string lang = "") {
var reqCult = CultureInfo.GetCultureInfo(lang);
CultureInfo.CurrentUICulture = reqCult;
CultureInfo.CurrentCulture = reqCult;
CultureInfo.DefaultThreadCurrentUICulture = reqCult;
CultureInfo.DefaultThreadCurrentCulture = reqCult;
TimeZoneInfo.ClearCachedData();
return _mapper.Map<TimeZoneInfoDto[]>(TimeZoneInfo.GetSystemTimeZones());
}
We were using .net 6.0 in docker (Linux)
Calling it with "en", "de", "zh" produced expected results.
However when we upgraded to .net 8.0 the same code broke. It now produces always the same results not respecting CultureInfo.CurrentUICulture.
Reproduction Steps
Create minimal api project with one method that returns TimeZoneInfo.GetSystemTimeZones() as described earlier
Expected behavior
List of timezones with localized display names
Actual behavior
List of timezones with display names of the OS locale. When running in container it returns always English names. On dev machine it uses the OS locale.
Regression?
No response
Known Workarounds
No response
Configuration
Dev machine
dotnet SDK
Version: 8.0.115
Commit: 9c0387c3ea
Environment:
OS Name: ubuntu
OS Version: 24.04
OS Platform: Linux
RID: ubuntu.24.04-x64
Base Path: /usr/lib/dotnet/sdk/8.0.115/
Host:
Version: 8.0.15
Architecture: x64
Commit: 50c4cb9fc3
.NET SDKs installed:
6.0.136 [/usr/lib/dotnet/sdk]
8.0.115 [/usr/lib/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.36 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.15 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.15 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
Other information
No response
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/runtime
-
agentic-workflows untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
area-System.Reflection blocking-clean-ci-optional Known Build Error os-mac-os-x untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
area-CodeGen-coreclr untriaged
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
agentic-workflows untriaged
Difficulty 1/5 Under an hour Newbie friendliness 78/100
-
area-VM-meta-mono untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SubtitleEdit/subtitleedit#15108 · 1 comment ·
-
area/docs-content Bug pulumi/docs
Difficulty 1/5 1-3 hours Newbie friendliness 94/100
-
Create parent directories only after the containment check in InstallHelper.TryExtractToDirectory Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
PowerShell/PSResourceGet#2056 ·