You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be easy to write a simple factory method that did this.
public IPublicHolidays Factory(CultureInfoculture){switch(culture.Name){case"en-US":returnnew USAPublicHoliday();case"en-CA":returnnew CanadaPublicHoliday();case"en-GB":returnnew UKBankHoliday();default:thrownew InvalidOperationException("Culture not known or specified");}}
It becomes a bit more complex if you're dealing with regions (as in Canada), multi-language countries (Canada again), and regions that don't have an ISO culture code (Scotland, which has Scottish Gaelic gd-GB but not en-scot).
Also this library isn't really localized- hol.PublicHolidayNames() returns local names in the majority local language, but not language and regional variations (one exception is Belgium, where I did Flemish and French methods- and I still skipped German). To do this properly (and perhaps add language neutral variants) would be a major effort.
Is there any way to retrieve an
IPublicHoliday
based on a culture code likeen-US
?The text was updated successfully, but these errors were encountered: