Eu concordo com você que às vezes há muita escolha, mas o mundo é um lugar grande e há muitas festas diferentes para agradar, então alguém obviamente queria isso.
Se você procurar nas bibliotecas libc, encontrará esta função:
7.6.2 Pinpoint Access to Locale Data
When writing the X/Open Portability Guide the authors realized that the localeconv function is not enough to provide reasonable access to locale information. The information which was meant to be available in the locale (as later specified in the POSIX.1 standard) requires more ways to access it. Therefore the nl_langinfo function was introduced.
— Function: char * nl_langinfo (nl_item item)
The nl_langinfo function can be used to access individual elements of the locale categories. Unlike the localeconv function, which returns all the information, nl_langinfo lets the caller select what information it requires. This is very fast and it is not a problem to call this function multiple times.
A second advantage is that in addition to the numeric and monetary formatting information, information from the LC_TIME and LC_MESSAGES categories is available.
The type nl_type is defined in nl_types.h. The argument item is a numeric value defined in the header langinfo.h. The X/Open standard defines the following values:
Um dos nl_items
que você pode fornecer a função nl_langinfo
é ERA
.
ERA
The return value represents the era used in the current locale. Most locales do not define this value. An example of a locale which does define this value is the Japanese one. In Japan, the traditional representation of dates includes the name of the era corresponding to the then-emperor's reign.
Normally it should not be necessary to use this value directly. Specifying the E modifier in their format strings causes the strftime functions to use this information. The format of the returned string is not specified, and therefore you should not assume knowledge of it on different systems.