Search code examples
c++enumslocalestdstandard-library

Language and region enumeration


In my company we deal with different locale options in our libraries. We take string parameters for locale settings. However, I prefer enums over strings since they are type safe and doesn't need string validations.

Is there an enumeration in standard library for language and regions? If not is there a plan to include a thing like this?

Creating a common library and defining a custom enum is not possible because of the compilation issues of static libraries on iOS. (Duplicate symbols.)


Solution

  • Not as of C++14, and I’m unfamiliar with plans to add one. Creating an exhaustive enumeration of region codes gets into all kinds of unpleasant political issues, like whether or not the Falkland Islands should be separate from the UK, and most standards committees are hesitant to take official stances.