1

Is there a way to register a CultureInfo only for the current process? I know the CultureAndRegionInfoBuilder.Register() method can do it permanently, but I don't want to do persist it or to have the application require administrative privileges.

I want to be able to create a custom culture, assign it a name and then retrieve it using that name, like:

var culture = new CultureInfo("X-myTestName");

The reason is that I think a third party library is passing the current culture name to a thread it creates.

Filip
  • 1,451
  • 1
  • 11
  • 19
  • Save it in a config file and retrieve when necessary? – Sach Jul 10 '20 at 17:18
  • 1
    Does [this answer](https://stackoverflow.com/a/7536117/3791245) help? – Sean Skelly Jul 10 '20 at 18:23
  • @Sach I'm not interested in retrieving it my code; I think a third party library is doing something like: var culture = new CultureInfo(Threading.Thread.CultureInfo.Name) and Threading.Thread.CultureInfo is a custom culture with a made up name. – Filip Jul 10 '20 at 20:12
  • @SeanSkelly I can try it next week, but probably not. Check the comment to Sach above. – Filip Jul 10 '20 at 20:13
  • I think I see. The link I posted is more for setting a culture as the default for threads in your AppDomain, but you want to _create a new culture option_, presumably to match the string "with a made up name" from your 3rd party library. All answers I can find on SO point to using `CultureAndRegionInfoBuilder.Register()` as _the_ way to create a custom CultureInfo. Not really seeing other options. – Sean Skelly Jul 10 '20 at 20:35

0 Answers0