question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resource based localization not working for flags enum

See original GitHub issue

Describe 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: image nl-NL: image

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:closed
  • Created 2 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
whvanderpostcommented, Mar 23, 2021

Thanks for contacting us. Please provide the repro app as a minimalistic GitHub repo. We won’t b e able to use repros in other formats going forward.

repro available: https://github.com/whvanderpost/core-issue-repro

0reactions
hishamcocommented, Jun 19, 2023

Looks good

Read more comments on GitHub >

github_iconTop 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 >
Localizing .NET Enums
Describes a technique for displaying localized text for enums.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found