[Updated to include 令和 (Reiwa) instead of the test entry]
Japanese Era Registry Key
I've posted about using the registry to test for the Japanese Era before (Win7+) -- some folks were looking for a little more guidance, so I created a couple registry files to help out.
Japanese calendar eras are enumerated in the registry, so adding a test era like the one below can help test your application's behavior when the era changes next year.
Windows Registry Editor Version 5.00
"1868 01 01"="明治_明_Meiji_M"
"1912 07 30"="大正_大_Taisho_T"
"1926 12 25"="昭和_昭_Showa_S"
"1989 01 08"="平成_平_Heisei_H"
"2019 05 01"="令和_令_Reiwa_R"
Selecting the Japanese Calendar
To test the Japanese Calendar behavior, your machine has to be configured to use the Japanese Calendar. This can be done on any machine, it doesn't have to be a Japanese Language machine. For thorough testing you may want to install the Japanese Language Pack as well, but it isn't required for basic testing. In either case, the Japanese Calendar is only available to the Japanese locale.
2) Select "Japanese (Japan)" from the "Format" drop down
3) Select "Additional Settings"
4) Select the "Date" tab.
5) In the "Calendar Type" dropdown, select the 2nd calendar "和暦", which is the Japanese Calendar.
(The 3 calendars listed are Gregorian (in Japanese), Japanese Calendar, and Gregorian (in English) calendars)
6) Select "Apply", "Ok"
7) Select "Apply", "Ok".
Your computer will now be configured to use the Japanese Calendar (and will reflect whichever eras are registered in the registry).
Reg Files For Testing
You can tweak the registry value(s) as described above to test your app or machine's behavior, but I've created a few .reg files that you can register to cover a couple of common test cases. The registry files are in a .zip downloadable from the link at the end of this post.
- RestoreJapaneseEra.reg to restore to the no-new-era state when you're done testing.
- AnticipatedJapaneseEra.reg which includes test date for the anticipated 1 May, 2019 transition date.
- ActiveTestJapaneseEra using a date that has already past to test behavior on machines as if there were already a new era.
Restore After Testing
Double click on the RestoreJapaneseEra.reg file to restore a machine to a state without a "new era". You probably want to use this after testing to avoid confusion.
Note that this will also revert the entries for a machine that has an officially released update after the official transition happens - so you probably don't want to do this after the official era has been announced!
Anticipated Era Transition Testing
AnticipatedJapaneseEra.reg adds a test era with the anticipated 1 May, 2019 date. Add this to your registry to test the upcoming transition.
- This is a test era and the test era names are not the "real" name of the new era, do not use them in a production enviornment!
- Era names for this test are expected to be "新元号" or "新" (abbreviated) - which I think means something like "new era." The English form is "Test Era" and "E".
- The transition date is the anticipated 1 May 2019 date. This can help test applications around the expected official transition date.
- Since the test date is in the future, current dates won't show the new information.
- The computer's clock may be advanced to dates after or around 1 May 2019 to test behavior at or after the official transition date.
- Any API's that don't explicitly select an Era should continue to see era information appropriate for the current 平成 (Heisei) Era. (Until the computer's clock advances to 1 May 2019.)
Active Era Transition Testing
Add ActiveTestJapaneseEra.reg to your registry to test with a new era start date of 1 May 2018 (a year prior to the anticipated date). This is helpful to test application behavior as if a new era already existed without requiring the machine's clock to be advanced to a future year.
- Era names for this test are expected to be "？？" - Japanese Full Width Question Marks. (English Era name is ?????? for this test era)
- ?? is expected - This is to avoid any geopolitical/cultural issues around using a real word for the new era. It should still be clear in an application that the date is correctly showing the new era.
- If you choose a string other than ??, please don't share any of that information externally.
- Transition date is 1 May 2018, so any dates, including the current machine time, after that date should display as the new era.
- Any APIs that don't explicitly select an Era should see display information appropriate for this test Era as it is the "current" era in this test configuration.
Notes on System Behavior
When testing the Japanese Era behavior, please note that we are also in the process of testing and addressing issues that Japanese Era testing may uncover. The most recent Insider releases have the most reliable Era behavior.
Test Registry Files
For convenience, some test registry values are in the zip file below. There is one file to test the anticipated era start date, another to test with an already active new era with a past date, and the last file to restore the era entries after testing.