How to support all cultures on machine in applications using different .NET versions?

69 Views Asked by At

I have 2 applications, Application1 uses .NET 4 and Application2 uses .NET 6, I'm trying get all machine supported cultures using CultureInfo.GetCultures(CultureTypes.AllCultures), but there is a difference in the cultures fetched in both applications run on the same machine, in Application1 using .NET 4 I see more cultures and in Application2 using .NET 6 I see less cultures. But I need all cultures supported in Application1 to be supported in Application2. Is there a way to achieve this?

And I'm using this logic in Application2 to add supported cultures to RequestLocalizationOptions options.AddSupportedCultures() in Program.cs, is there any way all supported cultures can be taken implicitly without using this fetch cultures logic?

I tried adding languages required in appsettings.json but I don't want to go with that solution as every time a language needs to be added I need to modify the supported list, I want to find a way to read all supported cultures on the machine, and I want to know if there is any way all supported cultures can be taken implicitly without using this fetch cultures logic?

0

There are 0 best solutions below