Partager via


Japanese Calendars, How do I Test Support for Additional Eras?

The Japanese Calendar is labeled by the reign of the current emporer.  Windows has supported 4 Japanese calendar Eras, however in the future there may be more eras.  Realizing this, we've added support in Windows 7, Server 2008R2 & .Net v4 for additional Japanese Eras.

There're a few things applications should know about extended Japanese Era support:

  • The first is that applications may see more than 4 eras!.
  • The current era could end
  • Future dates could change, moving from the current era to a new era.  (So "Heisei 71" could be "something 12" or something like that)
  • The era numbers themselves could change, so the 1-4 era numbers shouldn't be relied upon.

Cool, so if we're being careful about all of those things, and are pretty sure we don't have any hard-coded dependencies on the Japanese Eras or when they are, how do we test it?

On Windows 7 / Server 2008 R2 (beta) and CLRv4 (beta) Japanese era information can be found in the registry:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Calendars\Japanese\Eras]
"1868 01 01"="明治_明_Meiji_M"
"1912 07 30"="大正_大_Taisho_T"
"1926 12 25"="昭和_昭_Showa_S"
"1989 01 08"="平成_平_Heisei_H"

Additional eras can be added just by adding an entry to the table.  The format for the value "YYYY MM DD"="JE_AJE_EE_AEE" where the first day of the era is represented in the value name by YYYY for the year (gregorian), MM for the month, and DD for the day.  The value data contains the era strings, the "full" era name, followed by the abbreviated name (in Japanese), then the full name followed by the abbreviated name in English.  Each value is seperated by _ (underscore).  So in "YYYY MM DD"="JE_AJE_EE_AEE", JE represents the Japanese Era name, AJE represents the abbreviated Japanese Era.  EE represents the English Era name, and AEE represents the abbreviated English Era name.

An example would be:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Calendars\Japanese\Eras]
"1868 01 01"="明治_明_Meiji_M"
"1912 07 30"="大正_大_Taisho_T"
"1926 12 25"="昭和_昭_Showa_S"
"1989 01 08"="平成_平_Heisei_H"
"20219 05 01"="仮名_仮_Test Era_X"

(I'm not trying to make any predictions with the 2019, it's just a test number :)  Also remember this only works in Windows 7 and other newer products.

[Edited:  This is intended to support the possibility of a future era, not to enable older eras.  There's the potential that lots of stuff won't work correctly if eras prior to the existing 4 are added].  Also note that this registry key is pretty flexible.  If you want you could add a bunch of data for a bunch of eras < 1868.  (I don't have the data.)  That might break more stuff because then "Era 1" would turn into "Era 8" or something.  (Which is why I said not to depend on the Era number, it's pretty meaningless and arbitrary for us).  As noted, we only really intended to support adding new eras, not the historical ones.  Prior to 1870 or so the calendar was lunar not gregorian based, so conversions prior to then are pretty meaningless anyway.

 

Hope this is interesting,

 

Shawn

Comments

  • Anonymous
    September 24, 2009
    The actual relevance of traditional eras has been shrinking since the mid 20th century. Most Japanese memorize the era year of their birth, but are often troubled to remember what the current era year is, and may likely be off by a year or too if asked. (Many people use the Word functional to insert the date just to figure out what year it is when needed.) Focusing on support for future eras is of only questionable marginal value. Rather there should be much more extensive support for historical eras. In a historical context they are extremely important. So much that it is more common to talk about history in terms of the era, with a Gregorian year in parentheses only as a nice afterthought, if given at all. The other thing to note is that a new era year does NOT necessarily, and usually will not, begin on January 1st. So a single Gregorian year may fall on two separate traditional eras. Just for reference, Wikipedia has quite an extensive amount of info on the Japanese eras, often with sub-entries for specific entries: http://en.wikipedia.org/wiki/Japanese_era_name

  • Anonymous
    September 24, 2009
    It's easily gleaned from here: http://en.wikipedia.org/wiki/Japanese_era_name#Conversion_table_from_Gregorian_calendar_years_to_neng.C5.8D Unless I counted wrong, your Era 1 (Meiji) is really Era 246.  Note that there are some periods with no eras, and most early eras were short.

  • Anonymous
    September 27, 2009
    The comment has been removed

  • Anonymous
    September 29, 2009
    The comment has been removed