In JavaScript, there will be a Intl.LocaleMatcher to match the best suitable locale from a list of available locales with a specific locale. Polyfill here.
So in C# / .NET, is there a method to find the best suitable CultureInfo from a list available CultureInfos?
For example, I have some resource files for strings. I hope the application will choose the best suitable language resource file according to user’s system language. Although system will automatically choost the culture when name them with “Resources.de-DE.resx” or some like this and put in the “Properties” folder, user cannot hot change the language manually unless restart the application.
I have these culture infos: en-US, zh-CN, zh-TW, ja-JP, vi-VN, id-ID.
If user’s is fr-FR, choose en-US, because English is the default culture.
If user’s is zh-HK, choose zh-TW, because both zh-TW and zh-HK are Traditional Chinese. So zh-CN shouldn’t be used, which is Simplified Chinese.
If user’s is ms-MY, choose id-ID, because Malay and Indonesian are mutually intelligible. The default language English shouldn’t be chosen at this time.
Is there a built-in method or other package that can resolve this in C#?