Skip to content
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

Merged
merged 10 commits into from
Aug 8, 2023

Conversation

mkhamoyan
Copy link
Contributor

@mkhamoyan mkhamoyan commented Aug 4, 2023

Implement calendar data for hybrid mode on Apple platforms

Public APIs affected by the PR:

  • DateTimeFormatInfo.AbbreviatedDayNames
  • DateTimeFormatInfo.AbbreviatedMonthGenitiveNames
  • DateTimeFormatInfo.AbbreviatedMonthNames
  • DateTimeFormatInfo.CalendarWeekRule
  • DateTimeFormatInfo.DayNames
  • DateTimeFormatInfo.FirstDayOfWeek
  • DateTimeFormatInfo.FullDateTimePattern
  • DateTimeFormatInfo.LongDatePattern
  • DateTimeFormatInfo.LongTimePattern
  • DateTimeFormatInfo.MonthDayPattern
  • DateTimeFormatInfo.MonthGenitiveNames
  • DateTimeFormatInfo.MonthNames
  • DateTimeFormatInfo.NativeCalendarName
  • DateTimeFormatInfo.ShortDatePattern
  • DateTimeFormatInfo.ShortestDayNames
  • DateTimeFormatInfo.ShortTimePattern
  • DateTimeFormatInfo.YearMonthPattern

Contributes to #80689

cc @SamMonoRT

@ghost
Copy link

ghost commented Aug 4, 2023

Tagging subscribers to this area: @dotnet/area-system-globalization
See info in area-owners.md if you want to be subscribed.

Issue Details

null

Author: mkhamoyan
Assignees: -
Labels:

area-System.Globalization

Milestone: -

@mkhamoyan mkhamoyan changed the title Implement calendar info for hybrid mode [iOS][non-icu] HybridGlobalization implement calendar data Aug 4, 2023
@mkhamoyan
Copy link
Contributor Author

/azp run runtime-ioslike

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mkhamoyan
Copy link
Contributor Author

/azp run runtime-ioslike

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mkhamoyan mkhamoyan requested a review from ilonatommy August 4, 2023 15:09
@mkhamoyan mkhamoyan marked this pull request as ready for review August 4, 2023 15:10
@tarekgh tarekgh added the os-ios Apple iOS label Aug 4, 2023
@ghost
Copy link

ghost commented Aug 4, 2023

Tagging subscribers to 'os-ios': @steveisok, @akoeplinger, @kotlarmilos
See info in area-owners.md if you want to be subscribed.

Issue Details

Implement calendar data for hybrid mode on Apple platforms

Public APIs affected by the PR:

  • DateTimeFormatInfo.AbbreviatedDayNames
  • DateTimeFormatInfo.AbbreviatedMonthGenitiveNames
  • DateTimeFormatInfo.AbbreviatedMonthNames
  • DateTimeFormatInfo.CalendarWeekRule
  • DateTimeFormatInfo.DayNames
  • DateTimeFormatInfo.FirstDayOfWeek
  • DateTimeFormatInfo.FullDateTimePattern
  • DateTimeFormatInfo.LongDatePattern
  • DateTimeFormatInfo.LongTimePattern
  • DateTimeFormatInfo.MonthDayPattern
  • DateTimeFormatInfo.MonthGenitiveNames
  • DateTimeFormatInfo.MonthNames
  • DateTimeFormatInfo.NativeCalendarName
  • DateTimeFormatInfo.ShortDatePattern
  • DateTimeFormatInfo.ShortestDayNames
  • DateTimeFormatInfo.ShortTimePattern
  • DateTimeFormatInfo.YearMonthPattern

Contributes to #80689

cc @SamMonoRT

Author: mkhamoyan
Assignees: mkhamoyan
Labels:

area-System.Globalization, os-ios

Milestone: -

mkhamoyan and others added 2 commits August 7, 2023 20:46
…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>
src/libraries/Common/src/Interop/Interop.Calendar.iOS.cs Outdated Show resolved Hide resolved
Comment on lines 18 to 55
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;
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mkhamoyan
Copy link
Contributor Author

/azp run runtime-ioslike

@mkhamoyan mkhamoyan requested a review from mdh1418 August 8, 2023 12:08
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mkhamoyan
Copy link
Contributor Author

/azp run runtime-ioslike

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@mdh1418 mdh1418 left a 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

@mkhamoyan
Copy link
Contributor Author

Failures are not related.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants