情報源: coreclr/JapaneseCalendar.cs at master · dotnet/coreclr
設定ファイル化されているわけでは無いので、上Core CLRのソース変更が必要なようですね。
internal static EraInfo[] GetEraInfo()
{
// See if we need to build it
if (japaneseEraInfo == null)
{
japaneseEraInfo = GetJapaneseEras();
// See if we have to use the built-in eras
if (japaneseEraInfo == null)
{
// We know about some built-in ranges
EraInfo[] defaultEraRanges = new EraInfo[4];
defaultEraRanges[0] = new EraInfo(4, 1989, 1, 8, 1988, 1, GregorianCalendar.MaxYear - 1988,
"\x5e73\x6210", "\x5e73", "H"); // era #4 start year/month/day, yearOffset, minEraYear
defaultEraRanges[1] = new EraInfo(3, 1926, 12, 25, 1925, 1, 1989 - 1925,
"\x662d\x548c", "\x662d", "S"); // era #3,start year/month/day, yearOffset, minEraYear
defaultEraRanges[2] = new EraInfo(2, 1912, 7, 30, 1911, 1, 1926 - 1911,
"\x5927\x6b63", "\x5927", "T"); // era #2,start year/month/day, yearOffset, minEraYear
defaultEraRanges[3] = new EraInfo(1, 1868, 1, 1, 1867, 1, 1912 - 1867,
"\x660e\x6cbb", "\x660e", "M"); // era #1,start year/month/day, yearOffset, minEraYear
// Remember the ranges we built
japaneseEraInfo = defaultEraRanges;
}
}
// return the era we found/made
return japaneseEraInfo;
}
ちょうどこの部分かな。
後はこれ。
File not found ?? dotnet/coreclr
CoreCLR is the runtime for .NET Core. It includes the garbage collector, JIT compiler, primitive data types and low-leve...
private static EraInfo[] GetJapaneseEras()
{
int erasCount = WinRTInterop.Callbacks.GetJapaneseEraCount();
if (erasCount < 4)
{
return null;
}
EraInfo[] eras = new EraInfo[erasCount];
int lastMaxYear = GregorianCalendar.MaxYear;
for (int i = erasCount; i > 0; i--)
{
DateTimeOffset dateOffset;
string eraName;
string abbreviatedEraName;
if (!GetJapaneseEraInfo(i, out dateOffset, out eraName, out abbreviatedEraName))
{
return null;
}
DateTime dt = new DateTime(dateOffset.Ticks);
eras[erasCount - i] = new EraInfo(i, dt.Year, dt.Month, dt.Day, dt.Year - 1, 1, lastMaxYear - dt.Year + 1,
eraName, abbreviatedEraName, GetJapaneseEnglishEraName(i)); // era #4 start year/month/day, yearOffset, minEraYear
lastMaxYear = dt.Year;
}
return eras;
}
Windowsの場合、Windows側がWindows Update等で対応すれば問題無いかも。Unix/Linuxもシステム側の同じような感じ。
File not found ?? dotnet/coreclr
CoreCLR is the runtime for .NET Core. It includes the garbage collector, JIT compiler, primitive data types and low-leve...
private static EraInfo[] GetJapaneseEras()
{
string[] eraNames;
if (!CalendarData.EnumCalendarInfo("ja-JP", CalendarId.JAPAN, CalendarDataType.EraNames, out eraNames))
{
return null;
}
string[] abbrevEnglishEraNames;
if (!CalendarData.EnumCalendarInfo("en", CalendarId.JAPAN, CalendarDataType.AbbrevEraNames, out abbrevEnglishEraNames))
{
return null;
}
List eras = new List();
int lastMaxYear = GregorianCalendar.MaxYear;
int latestEra = Interop.GlobalizationInterop.GetLatestJapaneseEra();
for (int i = latestEra; i >= 0; i--)
{
DateTime dt;
if (!GetJapaneseEraStartDate(i, out dt))
{
return null;
}
if (dt < JapaneseCalendar.calendarMinValue)
{
// only populate the Eras that are valid JapaneseCalendar date times
break;
}
eras.Add(new EraInfo(i, dt.Year, dt.Month, dt.Day, dt.Year - 1, 1, lastMaxYear - dt.Year + 1,
eraNames[i], GetAbbreviatedEraName(eraNames, i), abbrevEnglishEraNames[i]));
lastMaxYear = dt.Year;
}
// remap the Era numbers, now that we know how many there will be
for (int i = 0; i < eras.Count; i++)
{
eras[i].era = eras.Count - i;
}
return eras.ToArray();
}