I am writing a multilingual application that uses many enumerations, and I would like to achieve the following goals:
- Display Enum names as localized strings
- Providing localized descriptions using attributes
- Enabling language analysis of parsing enumerations back into int values
I try to decorate enum using attributes + a resource file, so that localized strings can be obtained from information such as runtime. I used to be on the way to declaring a static class with static members, not an enumeration, but this represented as many problems as possible.
Is some typeDescriptor based mechanism suitable? Or is it even possible?
Moreover - how to achieve goal number 3 in a clean, general, reuse?
Asking this question, I ended up with an open source library that needed localized enum mappings. I went with the TypeConverters implementation technique. The full source is available at http://measures.codeplex.com/
enums c # internationalization localization
Mark Oct. 12 2018-10-12 12:32
source share