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

Enums not picking up resource text on release mode #1527

Open
elvato87 opened this issue Jul 16, 2024 · 1 comment
Open

Enums not picking up resource text on release mode #1527

elvato87 opened this issue Jul 16, 2024 · 1 comment

Comments

@elvato87
Copy link

elvato87 commented Jul 16, 2024

I have a Net MAUI 8 app, and I'm using Humanizer.Core and Humanizer.Core.es V2.14.1 and I only have one resource file

I have enums like this

public enum WorkType { [Display(Description = "Homework", ResourceType = typeof(AppResources))] Homework, [Display(Description = "ClassWork", ResourceType = typeof(AppResources))] ClassWork }

To display text I Use the .Humanize()work.WorkType.Humanize() method, when working on debug mode it works as expected pulling the string from the resource file, but on release mode it displays the Description instead, this happens on Android,
haven't tested on iOS.

Is there anything I'm missing?

@gregoriusus
Copy link

For me also doesn't work neither in debug in ASP.NET core. I created Class and I added resx files. If I use IStringLocalizer<Resources.FieldTranslations> it works, but not with Humanize and enums.

This is how I set:
public enum Fields
{
[Display(Description = "CountryId", ResourceType = typeof(Resources.FieldTranslations))]
CountryId

}
This is really great feature to localize enums, but couldn't find any solution of this problem...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants