Resource based localization not working for flags enum
See original GitHub issueDescribe the bug
I’m using localization in my ASP .Net Core WebApplication (.net 5). Translation of a (flags) enums work perfectly, but when I have a value with more than one flag it does not translate, as seen in the screenshots below:
en-US:
nl-NL:
Translation of a single item (Missing) works, translation of a value with 2 flags (LampFailure and Missing) doesn’t work.
To Reproduce
Included is a solution (WebApplication1.zip). In this solution identity is also added to be able to quickly change the UI language, to change it:
- Create a user account
- Login
- Go to the user profile page and change the Language with the pull down menu.
- Go back to the home page to see the test values.
Exceptions (if any)
Further technical details
- ASP.NET Core version: 5
- Include the output of
dotnet --info
:
.NET SDK (reflecting any global.json):
Version: 5.0.201
Commit: a09bd5c86c
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19042
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.201\
Host (useful for support):
Version: 5.0.4
Commit: f27d337295
.NET SDKs installed:
3.1.407 [C:\Program Files\dotnet\sdk]
5.0.201 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
- The IDE:
Microsoft Visual Studio Community 2019 - Version 16.9.2
VisualStudio.16.Release/16.9.2+31112.23
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
c# - Enum localization
I am getting this error Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Resources.Admin.
Read more >entity framework - Localized Enum in C# 6
1 Answer 1 ... You really shouldn't mix event and data-binding together. The proper way of updating value from UI, would be using...
Read more >How to Localize Enums in C# - YouTube
The first problem will be solved by using an enum custom type ... use of the ResourceManager to localize enums based on the...
Read more >How to localize enum values in ChartControl
Hello, I am rebuilding my non-working ChartControl. So, I would like to display enum values (but not only enum values in general) in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
repro available: https://github.com/whvanderpost/core-issue-repro
Looks good