Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Add new era in Japan called "Reiwa" #23614

Merged
merged 2 commits into from
Apr 1, 2019
Merged

Conversation

acid-chicken
Copy link

@acid-chicken acid-chicken commented Apr 1, 2019

【お知らせ】新元号は「令和」に決まりました。
首相官邸 on Twitter

FYI: https://www.meti.go.jp/policy/it_policy/kaigen/20190405_kaigen_code.pdf

@acid-chicken acid-chicken changed the title Add new era in Japanese called "Reiwa" Add new era in Japan called "Reiwa" Apr 1, 2019
@krwq
Copy link
Member

krwq commented Apr 1, 2019

@acid-chicken we read Eras from the OS but updating fallback data is fine too I believe.

See i.e.:

private const string JapaneseErasHive = @"System\CurrentControlSet\Control\Nls\Calendars\Japanese\Eras";

cc: @tarekgh

@tarekgh
Copy link
Member

tarekgh commented Apr 1, 2019

@acid-chicken The hard coded table as it is not really used. On Windows we read the Windows registry which is going to be updated by Windows Updates. On Linux, we use ICU which also is going to release a new version with the updated era names.

The hard coded table is used only if we fail getting the needed information from the OS.

@krwq I am not seeing any harm to to take this change even if it is not used. at least the information would reflect the current state. we just want to ensure this change is not going to cause any side effect. I'll double check that quickly before we decide to merge it.

@tarekgh
Copy link
Member

tarekgh commented Apr 1, 2019

@acid-chicken could you please update the table in the following places too?

private static readonly string[] s_japaneseErasEnglishNames = new string[] { "M", "T", "S", "H" };

private static readonly string[] s_JapaneseErasEnglishNames = new string[] { "M", "T", "S", "H" };

@acid-chicken
Copy link
Author

@krwq @tarekgh Thanks for let me know. I just updated those tables too.

@tarekgh tarekgh merged commit 0ec4acb into dotnet:master Apr 1, 2019
Dotnet-GitSync-Bot pushed a commit to Dotnet-GitSync-Bot/corefx that referenced this pull request Apr 1, 2019
* Add new era in Japan called "Reiwa"

* Update Japanese eras English names

refs: <dotnet/coreclr#23614 (comment)>

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Dotnet-GitSync-Bot pushed a commit to Dotnet-GitSync-Bot/corert that referenced this pull request Apr 1, 2019
* Add new era in Japan called "Reiwa"

* Update Japanese eras English names

refs: <dotnet/coreclr#23614 (comment)>

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Dotnet-GitSync-Bot pushed a commit to Dotnet-GitSync-Bot/mono that referenced this pull request Apr 1, 2019
* Add new era in Japan called "Reiwa"

* Update Japanese eras English names

refs: <dotnet/coreclr#23614 (comment)>

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
@Gnbrkm41
Copy link

Gnbrkm41 commented Apr 1, 2019

It appears that some call sites of GetEraInfo() relies on the fact that the first item in the array is the current era. (e.g. GregorianCalendarHelper _helper field in JapaneseCalendar/JapaneseLunisolarCalendar is initialised with the data from GetEraInfo() with the assumption that the first item is the current era, which then is called in various public APIs). This means that some methods may behave weirdly as it will return the value for the new era (Reiwa) instead of the current era (Heisei). It wouldn't matter if this is going to be released after the 1st of May (which then becomes perfectly valid), however until then this would lead to some unexpected behaviour.

Also, s_japaneseErasEnglishNames field and GetJapaneseEnglishEraName() method does not appear to have been referenced in any places (i.e. dead code); Could we just remove them after all?

(By the way, considering that this hard-coded data is only used if every other method of obtaining data fail, which is very unlikely to happen, it might be okay to leave it as is.)

@@ -14,11 +14,11 @@ namespace System.Globalization
/// and the era begins on the day an emperor ascends the throne and continues until his death.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should change this comment as well, he's still going strong 😀

@tarekgh
Copy link
Member

tarekgh commented Apr 1, 2019

@Gnbrkm41 the change in PR is used only when we fallback when something catastrophic happen. So, your concerns regarding having this update before May 1st are not real and no one will experience this change .

for s_japaneseErasEnglishNames, we still need that.

For the comment, feel free to open a PR with the changes in that comment.

marek-safar pushed a commit to mono/mono that referenced this pull request Apr 1, 2019
* Add new era in Japan called "Reiwa"

* Update Japanese eras English names

refs: <dotnet/coreclr#23614 (comment)>

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
jkotas pushed a commit to dotnet/corert that referenced this pull request Apr 1, 2019
* Add new era in Japan called "Reiwa"

* Update Japanese eras English names

refs: <dotnet/coreclr#23614 (comment)>

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
jkotas pushed a commit to dotnet/corefx that referenced this pull request Apr 1, 2019
* Add new era in Japan called "Reiwa"

* Update Japanese eras English names

refs: <dotnet/coreclr#23614 (comment)>

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
acid-chicken added a commit to acid-chicken/mono that referenced this pull request Jun 8, 2019
monojenkins pushed a commit to monojenkins/mono that referenced this pull request Jun 11, 2019
marek-safar pushed a commit to mono/mono that referenced this pull request Jun 11, 2019
* Fix Japan's new era fallback isn't reflected in Mono

refs: <dotnet/coreclr#23614>

* Fix array length

* Fix MonoTests.System.Globalization.CalendarTest

* Fix MonoTests.System.Globalization.EastAsianLunisolarCalendarTest

* Fix era index

refs: 1715e1d

* Amend fixing

refs: 05af6e6
marek-safar pushed a commit to mono/mono that referenced this pull request Jun 14, 2019
* Fix Japan's new era fallback isn't reflected in Mono

refs: <dotnet/coreclr#23614>

* Fix array length

* Fix MonoTests.System.Globalization.CalendarTest

* Fix MonoTests.System.Globalization.EastAsianLunisolarCalendarTest

* Fix era index

refs: 1715e1d

* Amend fixing

refs: 05af6e6
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
* Add new era in Japan called "Reiwa"

* Update Japanese eras English names

refs: <dotnet/coreclr#23614 (comment)>


Commit migrated from dotnet/coreclr@0ec4acb
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants