Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Blazor WASM] CultureInfo.DisplayName not consistent #55348

Closed
enricobenedos opened this issue Jun 30, 2021 · 6 comments
Closed

[Blazor WASM] CultureInfo.DisplayName not consistent #55348

enricobenedos opened this issue Jun 30, 2021 · 6 comments
Labels
arch-wasm WebAssembly architecture
Milestone

Comments

@enricobenedos
Copy link

Describe the bug

CultureInfo DisplayName property does not return a consistent value in Blazor WASM projects.

To Reproduce

Example:

var enCulture = new CultureInfo("en-US");
Console.WriteLine(enCulture.DisplayName);

Actual Value
en (US)

Expected Value
English (United States)
(as described in https://docs.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo.displayname?view=net-5.0)

Exceptions (if any)

No exceptions.

Further technical details

  • .NET 5.0
  • Include the output of dotnet --info
 dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.301
 Commit:    ef17233f86

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19043
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.301\

Host (useful for support):
  Version: 5.0.7
  Commit:  556582d964

.NET SDKs installed:
  5.0.301 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
Microsoft Visual Studio Professional 2019
Version 16.10.3
@javiercn
Copy link
Member

javiercn commented Jul 5, 2021

@enricobenedos thanks for contacting us.

Have you setup <InvariantGlobalization>false</InvariantGlobalization> in your MSBuild project file?

@enricobenedos
Copy link
Author

This is my project file with the new InvariantGlobalization as suggested:

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
    <DockerfileContext>.</DockerfileContext>
    <AssemblyVersion>0.1.0.0</AssemblyVersion>
    <FileVersion>0.1.0.0</FileVersion>
    <Version>0.1.0</Version>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Blazored.LocalStorage" Version="4.1.1" />
    <PackageReference Include="FmsAgvShared" Version="1.10.2" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.7" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="5.0.7" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.7" PrivateAssets="all" />
    <PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.7" />
    <PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.Localization" Version="5.0.7" />
    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.13" />
    <PackageReference Include="NetTopologySuite.IO.GeoJSON4STJ" Version="2.1.1" />
    <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.11.1" />
    <PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
    <PackageReference Include="Telerik.UI.for.Blazor" Version="2.24.1" />
  </ItemGroup>

  <PropertyGroup>
	<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
	<UserSecretsId>02d32efe-6558-4f81-b5a4-b35602ac9c1d</UserSecretsId>
	<InvariantGlobalization>false</InvariantGlobalization>
  </PropertyGroup>	
	
</Project>

but nothing has changed.

@mkArtakMSFT mkArtakMSFT transferred this issue from dotnet/aspnetcore Jul 8, 2021
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jul 8, 2021
@lewing lewing removed the untriaged New issue has not been triaged by the area owner label Jul 8, 2021
@lewing lewing added this to the 7.0.0 milestone Jul 8, 2021
@lewing lewing added the arch-wasm WebAssembly architecture label Jul 8, 2021
@svick
Copy link
Contributor

svick commented Jul 17, 2021

Blazor WASM has its own cut-down version of culture data, and, as I understand it, that excludes culture names. (Though that article does not explicitly mention DisplayName for some reason.) I think that explains the behavior you see.

@enricobenedos
Copy link
Author

Hi @svick,
probably you are right. But I think that Blazor WASM as frontend framework cannot miss the DisplayName feature.
I understand that it is for performance purposes but at this point I think that it can be solved using an adjunctive dependency that include the right cultures names. So every developer can decide if include it on his projects.

@ilonatommy
Copy link
Member

This is a dupe of #44739 let's keep the discussion there.

@ghost ghost locked as resolved and limited conversation to collaborators Aug 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture
Projects
None yet
Development

No branches or pull requests

6 participants