microsoft / dotnet

This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Foundation.
https://devblogs.microsoft.com/dotnet/
MIT License
14.38k stars 2.22k forks source link

Custom Strongly Typed Resource Designer.cs #1292

Open kurtisane opened 3 years ago

kurtisane commented 3 years ago

Hi, I'm already googleing and going through nealy decade year old threads for hours. I want to automatically generate a Designer.cs where the CultureInfo is able to be passed to the GetString Method. Changing the resourceCulture that is currently generated is not thread-safe when multiple threads are accessing the same Designer.cs.

This is the current generated snipped: public static string Account_AccountInactivated { get { return ResourceManager.GetString("Account_AccountInactivated", resourceCulture); } }

I would rather get a static method with the same name and a cultureinfo parameter.

I was looking into creating a custom StronglyTypedResourceBuilder, but I really dont have any clue what to do with that. The documentation is lacking. How do I tell the IDE to use this ? Where am I registering this as a option in Properties of a .resx file ? How should the StronglyTypedResourceBuilder even look like ?

Any ideas how to achive this ?

Sorry if I'm wrong here.