-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[iOS][non-icu] HybridGlobalization implement calendar data #90004
Conversation
Tagging subscribers to this area: @dotnet/area-system-globalization Issue Detailsnull
|
/azp run runtime-ioslike |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-ioslike |
Azure Pipelines successfully started running 1 pipeline(s). |
Tagging subscribers to 'os-ios': @steveisok, @akoeplinger, @kotlarmilos Issue DetailsImplement calendar data for hybrid mode on Apple platforms Public APIs affected by the PR:
Contributes to #80689 cc @SamMonoRT
|
.../System.Globalization.Calendars/tests/Hybrid/System.Globalization.Calendars.IOS.Tests.csproj
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.iOS.cs
Outdated
Show resolved
Hide resolved
…em.Globalization.Calendars.IOS.Tests.csproj Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
this.sNativeName = GetCalendarInfoNative(localeName, calendarId, CalendarDataType.NativeName); | ||
this.sMonthDay = GetCalendarInfoNative(localeName, calendarId, CalendarDataType.MonthDay); | ||
this.saShortDates = GetCalendarInfoNative(localeName, calendarId, CalendarDataType.ShortDates).Split("||"); | ||
this.saLongDates = GetCalendarInfoNative(localeName, calendarId, CalendarDataType.LongDates).Split("||"); | ||
this.saYearMonths = GetCalendarInfoNative(localeName, calendarId, CalendarDataType.YearMonths).Split("||"); | ||
this.saDayNames = GetCalendarInfoNative(localeName, calendarId, CalendarDataType.DayNames).Split("||"); | ||
this.saAbbrevDayNames = GetCalendarInfoNative(localeName, calendarId, CalendarDataType.AbbrevDayNames).Split("||"); | ||
this.saSuperShortDayNames = GetCalendarInfoNative(localeName, calendarId, CalendarDataType.SuperShortDayNames).Split("||"); | ||
|
||
string? leapHebrewMonthName = null; | ||
this.saMonthNames = NormalizeMonthArray(GetCalendarInfoNative(localeName, calendarId, CalendarDataType.MonthNames).Split("||"), calendarId, ref leapHebrewMonthName); | ||
if (leapHebrewMonthName != null) | ||
{ | ||
Debug.Assert(this.saMonthNames != null); | ||
|
||
// In Hebrew calendar, get the leap month name Adar II and override the non-leap month 7 | ||
Debug.Assert(calendarId == CalendarId.HEBREW && saMonthNames.Length == 13); | ||
saLeapYearMonthNames = (string[]) saMonthNames.Clone(); | ||
saLeapYearMonthNames[6] = leapHebrewMonthName; | ||
|
||
// The returned data has 6th month name as 'Adar I' and 7th month name as 'Adar' | ||
// We need to adjust that in the list used with non-leap year to have 6th month as 'Adar' and 7th month as 'Adar II' | ||
// note that when formatting non-leap year dates, 7th month shouldn't get used at all. | ||
saMonthNames[5] = saMonthNames[6]; | ||
saMonthNames[6] = leapHebrewMonthName; | ||
|
||
} | ||
this.saAbbrevMonthNames = NormalizeMonthArray(GetCalendarInfoNative(localeName, calendarId, CalendarDataType.AbbrevMonthNames).Split("||"), calendarId, ref leapHebrewMonthName); | ||
this.saMonthGenitiveNames = NormalizeMonthArray(GetCalendarInfoNative(localeName, calendarId, CalendarDataType.MonthGenitiveNames).Split("||"), calendarId, ref leapHebrewMonthName); | ||
this.saAbbrevMonthGenitiveNames = NormalizeMonthArray(GetCalendarInfoNative(localeName, calendarId, CalendarDataType.AbbrevMonthGenitiveNames).Split("||"), calendarId, ref leapHebrewMonthName); | ||
|
||
this.saEraNames = NormalizeEraNames(calendarId, GetCalendarInfoNative(localeName, calendarId, CalendarDataType.EraNames).Split("||")); | ||
this.saAbbrevEraNames = Array.Empty<string>();//NormalizeEraNames(calendarId, GetCalendarInfoNative(localeName, calendarId, CalendarDataType.AbbrevEraNames).Split("||")); | ||
|
||
return this.sNativeName != null && this.saShortDates != null && this.saLongDates != null && this.saYearMonths != null && | ||
this.saDayNames != null && this.saAbbrevDayNames != null && this.saSuperShortDayNames != null && this.saMonthNames != null && | ||
this.saAbbrevMonthNames != null && this.saMonthGenitiveNames != null && this.saAbbrevMonthGenitiveNames != null && | ||
this.saEraNames != null && this.saAbbrevEraNames != null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was following same style as in https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.cs#L118 . Will remove as it is not necessary.
src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.iOS.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.iOS.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.iOS.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.iOS.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.iOS.cs
Show resolved
Hide resolved
/azp run runtime-ioslike |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-ioslike |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thanks
Failures are not related. |
Implement calendar data for hybrid mode on Apple platforms
Public APIs affected by the PR:
Contributes to #80689
cc @SamMonoRT